summaryrefslogtreecommitdiffstats
path: root/media/base/pipeline.h
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 01:01:52 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 01:01:52 +0000
commitb9490b9c31dccdec1ae72f24f13c91349ff96410 (patch)
treeabee0338b4f54f664a60d5ba598df2e02e1104f6 /media/base/pipeline.h
parent9a7b22e6fb1d115a694616fd5a12bfe6e491664b (diff)
downloadchromium_src-b9490b9c31dccdec1ae72f24f13c91349ff96410.zip
chromium_src-b9490b9c31dccdec1ae72f24f13c91349ff96410.tar.gz
chromium_src-b9490b9c31dccdec1ae72f24f13c91349ff96410.tar.bz2
Implemented Pipeline seek callbacks and a big refactor of PipelineImplTest.
Now that I'm wiser writing tests, I'm trying to get rid of InitializationHelper and rely on simplier test fixtures classes. I also introduced MockFilterFactory which is capable of creating all the mock filters and is able to return instantiated instances of filters to permit testing for expectations (refer to PipelineImplTest.Seek for an example). Review URL: http://codereview.chromium.org/115094 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/pipeline.h')
-rw-r--r--media/base/pipeline.h45
1 files changed, 27 insertions, 18 deletions
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index 3b18b81..0120863 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -116,6 +116,11 @@ class PipelineStatus {
virtual ~PipelineStatus() {}
};
+// Client-provided callbacks for various pipeline operations.
+//
+// TODO(scherkus): consider returning a PipelineError instead of a bool, or
+// perhaps a client callback interface.
+typedef Callback1<bool>::Type PipelineCallback;
class Pipeline : public PipelineStatus {
public:
@@ -123,28 +128,28 @@ class Pipeline : public PipelineStatus {
// construct a filter chain. Returns true if successful, false otherwise
// (i.e., pipeline already started). Note that a return value of true
// only indicates that the initialization process has started successfully.
- // Pipeline initializaion is an inherently asynchronous process. Clients
- // should not call SetPlaybackRate, Seek, or SetVolume until initialization
- // is complete. Clients can either poll the IsInitialized() method (which is
- // discouraged) or use the init_complete_callback as described below.
+ // Pipeline initialization is an inherently asynchronous process. Clients
+ // should not call SetPlaybackRate(), Seek(), or SetVolume() until
+ // initialization is complete. Clients can either poll the IsInitialized()
+ // method (which is discouraged) or use the |start_callback| as described
+ // below.
//
// This method is asynchronous and can execute a callback when completed.
- // If the caller provides an init_complete_callback, it will be
- // called when the pipeline initiailization completes. If successful, the
- // callback's bool parameter will be true. If the callback is called with
- // false, then the client can use the GetError method to obtain more
- // information about the reason initialization failed. The prototype for
- // the client callback is:
+ // If the caller provides a |start_callback|, it will be called when the
+ // pipeline initialization completes. If successful, the callback's bool
+ // parameter will be true. If the callback is called with false, then the
+ // client can use the GetError() method to obtain more information about the
+ // reason initialization failed. The prototype for the client callback is:
// void Client::PipelineInitComplete(bool init_was_successful);
//
// Note that clients must not call the Stop method from within the
- // init_complete_callback. Other methods, including SetPlaybackRate,
- // Seek, and SetVolume may be called. The client will be called on a
- // thread owned by the pipeline class, not on the thread that originally
- // called the Start method.
+ // |start_callback|. Other methods, including SetPlaybackRate(), Seek(), and
+ // SetVolume() may be called. The client will be called on a thread owned by
+ // the pipeline class, not on the thread that originally called the Start()
+ // method.
virtual bool Start(FilterFactory* filter_factory,
const std::string& uri,
- Callback1<bool>::Type* init_complete_callback) = 0;
+ PipelineCallback* start_callback) = 0;
// Stops the pipeline and resets to an uninitialized state. This method
// will block the calling thread until the pipeline has been completely
@@ -158,15 +163,19 @@ class Pipeline : public PipelineStatus {
// Attempt to adjust the playback rate. Setting a playback rate of 0.0f pauses
// all rendering of the media. A rate of 1.0f indicates a normal playback
// rate. Values for the playback rate must be greater than or equal to 0.0f.
- // TODO(ralphl) What about maximum rate? Does HTML5 specify a max?
+ // TODO(ralphl): What about maximum rate? Does HTML5 specify a max?
//
// This method must be called only after initialization has completed.
virtual void SetPlaybackRate(float playback_rate) = 0;
- // Attempt to seek to the position in microseconds.
+ // Attempt to seek to the position specified by time. |seek_callback| will be
+ // executed when the all filters in the pipeline have processed the seek.
+ // The callback will return true if the seek was carried out, false otherwise
+ // (i.e., streaming media).
//
// This method must be called only after initialization has completed.
- virtual void Seek(base::TimeDelta time) = 0;
+ virtual void Seek(base::TimeDelta time,
+ PipelineCallback* seek_callback) = 0;
// Attempt to set the volume of the audio renderer. Valid values for volume
// range from 0.0f (muted) to 1.0f (full volume). This value affects all