Chromium Code Reviews| Index: media/base/audio_renderer.h |
| diff --git a/media/base/audio_renderer.h b/media/base/audio_renderer.h |
| index 0c9c5829be54f539d347bb95061bdb77383a6b05..5351b004e952fecd6db5f22d9a36de054f4888c0 100644 |
| --- a/media/base/audio_renderer.h |
| +++ b/media/base/audio_renderer.h |
| @@ -16,11 +16,32 @@ namespace media { |
| class AudioDecoder; |
| -class MEDIA_EXPORT AudioRenderer : public Filter { |
| +// TODO(scherkus): replace this interface with additional callbacks passed to |
| +// Initialize() similar to the underflow and time update callbacks. |
| +class MEDIA_EXPORT AudioRendererHost { |
| public: |
| - // Used to update the pipeline's clock time. The first parameter is the |
| - // current time, and the second parameter is the time that the clock must not |
| - // exceed. |
| + virtual ~AudioRendererHost() {}; |
| + |
| + // Notifcation that audio rendering has reached the end of the stream. |
|
acolwell GONE FROM CHROMIUM
2012/07/10 16:34:37
nit: s/Notifcation/Notification
scherkus (not reviewing)
2012/07/17 03:43:00
Done.
|
| + virtual void AudioRendererEnded() = 0; |
| + |
| + // Notification that audio rendering has been disabled due to external factors |
| + // (i.e., device was removed). Time update callbacks will no longer be |
| + // executed. |
| + virtual void AudioRendererDisabled() = 0; |
| +}; |
| + |
| +class MEDIA_EXPORT AudioRenderer |
| + : public base::RefCountedThreadSafe<AudioRenderer> { |
| + public: |
| + // Assigns the host object responsible for this AudioRenderer. Must be set |
| + // prior to calling Initialize(). The host is expected to outlive the |
| + // lifetime of an AudioRenderer. |
| + virtual void SetHost(AudioRendererHost* host) = 0; |
| + |
| + // Called whenever time has advanced by way of audio rendering. The first |
| + // parameter is the current time, and the second parameter is the time that |
| + // the clock must not exceed. |
| typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; |
| // Initialize a AudioRenderer with the given AudioDecoder, executing the |
| @@ -34,19 +55,44 @@ class MEDIA_EXPORT AudioRenderer : public Filter { |
| const base::Closure& underflow_cb, |
| const TimeCB& time_cb) = 0; |
| - // Returns true if this filter has received and processed an end-of-stream |
| - // buffer. |
| + // Start audio decoding and rendering at the current playback rate, executing |
| + // |callback| when playback is underway. |
| + virtual void Play(const base::Closure& callback) = 0; |
| + |
| + // Temporarily suspend decoding and rendering audio, executing |callback| when |
| + // playback has been suspended. |
| + virtual void Pause(const base::Closure& callback) = 0; |
| + |
| + // Discard any audio data, executing |callback| when completed. |
| + virtual void Flush(const base::Closure& callback) = 0; |
| + |
| + // Start prerolling audio data for samples starting at |time|, executing |
| + // |callback| when completed. |
| + // |
| + // Only valid to call after a successful Initialize() or Flush(). |
| + virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback) = 0; |
|
scherkus (not reviewing)
2012/07/10 03:58:22
think it's time to finally call this Preroll()? :)
scherkus (not reviewing)
2012/07/17 03:43:00
making it a TODO
|
| + |
| + // Stop all operations in preparation for being deleted, executing |callback| |
| + // when complete. |
| + virtual void Stop(const base::Closure& callback) = 0; |
| + |
| + // Updates the current playback rate. |
| + virtual void SetPlaybackRate(float playback_rate) = 0; |
| + |
| + // Returns true if all audio data has been played back by the audio device. |
| virtual bool HasEnded() = 0; |
| // Sets the output volume. |
| virtual void SetVolume(float volume) = 0; |
| // Resumes playback after underflow occurs. |
| + // |
| // |buffer_more_audio| is set to true if you want to increase the size of the |
| // decoded audio buffer. |
| virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
| protected: |
| + friend class base::RefCountedThreadSafe<AudioRenderer>; |
| virtual ~AudioRenderer() {} |
| }; |