Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Unified Diff: media/base/audio_renderer.h

Issue 10753021: Move AudioRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: docs Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/composite_filter.cc » ('j') | media/base/pipeline.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
};
« no previous file with comments | « no previous file | media/base/composite_filter.cc » ('j') | media/base/pipeline.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698