summaryrefslogtreecommitdiffstats
path: root/media/base/pipeline_impl.h
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 23:52:05 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 23:52:05 +0000
commit576537844b224ca246713c57e039d19d0dfefbf7 (patch)
treeb9cdb7a157abaa212fa87cfbd18ed05c0f6f71e2 /media/base/pipeline_impl.h
parent1cf1f99e52b39e01115eeef712c139dfa63df00e (diff)
downloadchromium_src-576537844b224ca246713c57e039d19d0dfefbf7.zip
chromium_src-576537844b224ca246713c57e039d19d0dfefbf7.tar.gz
chromium_src-576537844b224ca246713c57e039d19d0dfefbf7.tar.bz2
Implemented end-of-stream callback for media::PipelineImpl.
A new method HasEnded() was added to renderer interfaces. Renderers return true when they have both received and rendered an end-of-stream buffer. For audio this translates to sending the very last buffer to the hardware. For video this translates to displaying a black frame after the very last frame has been displayed. Renderers can notify the pipeline that the value of HasEnded() has changed to true via FilterHost::NotifyEnded(). Instead of tracking which renderers have called NotifyEnded(), the pipeline uses the notification to poll every renderer. The ended callback will only be executed once every renderer returns true for HasEnded(). This has a nice benefit of being able to ignore extra NotifyEnded() calls if we already determine the pipeline has ended. With the changes to WebMediaPlayerImpl, we should now properly support both the ended event and looping. BUG=16768,17970,18433,18846 TEST=media_unittests, media layout tests, ended event, timeupdate should stop firing, looping should work, seeking after video ends Review URL: http://codereview.chromium.org/164403 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/pipeline_impl.h')
-rw-r--r--media/base/pipeline_impl.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index 4332cba..383969d 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -41,7 +41,9 @@ namespace media {
// | |
// V Seek() |
// [ Started ] --------> [ Pausing (for each filter) ] -'
-//
+// | |
+// | NotifyEnded() Seek() |
+// `-------------> [ Ended ] ---------------------'
//
// SetError()
// [ Any State ] -------------> [ Error ]
@@ -84,8 +86,12 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual bool IsStreaming() const;
virtual PipelineError GetError() const;
+ // Sets a permanent callback owned by the pipeline that will be executed when
+ // the media reaches the end.
+ virtual void SetPipelineEndedCallback(PipelineCallback* ended_callback);
+
// |error_callback_| will be executed upon an error in the pipeline. If
- // |error_callback_| is NULL, it is ignored. The pipeline takes ownernship
+ // |error_callback_| is NULL, it is ignored. The pipeline takes ownership
// of |error_callback|.
virtual void SetPipelineErrorCallback(PipelineCallback* error_callback);
@@ -103,6 +109,7 @@ class PipelineImpl : public Pipeline, public FilterHost {
kSeeking,
kStarting,
kStarted,
+ kEnded,
kStopped,
kError,
};
@@ -136,6 +143,7 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual void SetBufferedBytes(int64 buffered_bytes);
virtual void SetVideoSize(size_t width, size_t height);
virtual void SetStreaming(bool streamed);
+ virtual void NotifyEnded();
virtual void BroadcastMessage(FilterMessage message);
// Method called during initialization to insert a mime type into the
@@ -181,6 +189,9 @@ class PipelineImpl : public Pipeline, public FilterHost {
// Carries out notifying filters that we are seeking to a new timestamp.
void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback);
+ // Carries out handling a notification from a filter that it has ended.
+ void NotifyEndedTask();
+
// Carries out message broadcasting on the message loop.
void BroadcastMessageTask(FilterMessage message);
@@ -332,6 +343,7 @@ class PipelineImpl : public Pipeline, public FilterHost {
// Callbacks for various pipeline operations.
scoped_ptr<PipelineCallback> seek_callback_;
scoped_ptr<PipelineCallback> stop_callback_;
+ scoped_ptr<PipelineCallback> ended_callback_;
scoped_ptr<PipelineCallback> error_callback_;
// Vector of our filters and map maintaining the relationship between the