OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 virtual void Initialize(DemuxerStream* stream, | 41 virtual void Initialize(DemuxerStream* stream, |
42 const PipelineStatusCB& init_cb, | 42 const PipelineStatusCB& init_cb, |
43 const StatisticsCB& statistics_cb, | 43 const StatisticsCB& statistics_cb, |
44 const TimeCB& time_cb, | 44 const TimeCB& time_cb, |
45 const BufferingStateCB& buffering_state_cb, | 45 const BufferingStateCB& buffering_state_cb, |
46 const base::Closure& ended_cb, | 46 const base::Closure& ended_cb, |
47 const PipelineStatusCB& error_cb) = 0; | 47 const PipelineStatusCB& error_cb) = 0; |
48 | 48 |
49 // Signal audio playback to start at the current rate. It is expected that | 49 // Signal audio playback to start at the current rate. It is expected that |
50 // |time_cb| will eventually start being run with time updates. | 50 // |time_cb| will eventually start being run with time updates. |
| 51 // |
| 52 // TODO(scherkus): Fold into TimeSource API. |
51 virtual void StartRendering() = 0; | 53 virtual void StartRendering() = 0; |
52 | 54 |
53 // Signal audio playback to stop until further notice. It is expected that | 55 // Signal audio playback to stop until further notice. It is expected that |
54 // |time_cb| will no longer be run. | 56 // |time_cb| will no longer be run. |
| 57 // |
| 58 // TODO(scherkus): Fold into TimeSource API. |
55 virtual void StopRendering() = 0; | 59 virtual void StopRendering() = 0; |
56 | 60 |
| 61 // Sets the media time to start rendering from. Only valid to call while not |
| 62 // currently rendering. |
| 63 // |
| 64 // TODO(scherkus): Fold into TimeSource API. |
| 65 virtual void SetMediaTime(base::TimeDelta time) = 0; |
| 66 |
57 // Discard any audio data, executing |callback| when completed. | 67 // Discard any audio data, executing |callback| when completed. |
58 // | 68 // |
59 // Clients should expect |buffering_state_cb| to be called with | 69 // Clients should expect |buffering_state_cb| to be called with |
60 // BUFFERING_HAVE_NOTHING while flushing is in progress. | 70 // BUFFERING_HAVE_NOTHING while flushing is in progress. |
61 virtual void Flush(const base::Closure& callback) = 0; | 71 virtual void Flush(const base::Closure& callback) = 0; |
62 | 72 |
63 // Starts playback by reading from |stream| and decoding and rendering audio. | 73 // Starts playback by reading from |stream| and decoding and rendering audio. |
64 // |timestamp| is the media timestamp playback should start rendering from. | |
65 // | 74 // |
66 // Only valid to call after a successful Initialize() or Flush(). | 75 // Only valid to call after a successful Initialize() or Flush(). |
67 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; | 76 virtual void StartPlaying() = 0; |
68 | 77 |
69 // Stop all operations in preparation for being deleted, executing |callback| | 78 // Stop all operations in preparation for being deleted, executing |callback| |
70 // when complete. | 79 // when complete. |
71 virtual void Stop(const base::Closure& callback) = 0; | 80 virtual void Stop(const base::Closure& callback) = 0; |
72 | 81 |
73 // Updates the current playback rate. | 82 // Updates the current playback rate. |
74 virtual void SetPlaybackRate(float playback_rate) = 0; | 83 virtual void SetPlaybackRate(float playback_rate) = 0; |
75 | 84 |
76 // Sets the output volume. | 85 // Sets the output volume. |
77 virtual void SetVolume(float volume) = 0; | 86 virtual void SetVolume(float volume) = 0; |
78 | 87 |
79 private: | 88 private: |
80 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); | 89 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); |
81 }; | 90 }; |
82 | 91 |
83 } // namespace media | 92 } // namespace media |
84 | 93 |
85 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ | 94 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ |
OLD | NEW |