Index: media/base/pipeline.h |
diff --git a/media/base/pipeline.h b/media/base/pipeline.h |
index db326c2928353f2aa9d6080ad650e4ecd56f22fb..a6eb99e141eb0c64127031f7eb9790cd59d56f63 100644 |
--- a/media/base/pipeline.h |
+++ b/media/base/pipeline.h |
@@ -10,6 +10,7 @@ |
#include "media/base/buffering_state.h" |
#include "media/base/cdm_context.h" |
#include "media/base/media_export.h" |
+#include "media/base/pipeline_metadata.h" |
#include "media/base/pipeline_status.h" |
#include "media/base/ranges.h" |
#include "media/base/text_track.h" |
@@ -22,54 +23,59 @@ class Demuxer; |
class Renderer; |
class VideoFrame; |
-// Metadata describing a pipeline once it has been initialized. |
-struct PipelineMetadata { |
- PipelineMetadata() |
- : has_audio(false), has_video(false), video_rotation(VIDEO_ROTATION_0) {} |
+class MEDIA_EXPORT Pipeline { |
+ public: |
+ class Client { |
+ public: |
+ virtual ~Client() {} |
- bool has_audio; |
- bool has_video; |
- gfx::Size natural_size; |
- VideoRotation video_rotation; |
- base::Time timeline_offset; |
-}; |
+ // Executed whenever an error occurs but hasn't been reported already |
+ // through another callback. |
+ virtual void OnError(PipelineStatus status) {} |
-typedef base::Callback<void(PipelineMetadata)> PipelineMetadataCB; |
+ // Executed whenever the media reaches the end. |
+ virtual void OnEnded() {} |
-class MEDIA_EXPORT Pipeline { |
- public: |
- // Used to paint VideoFrame. |
- typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB; |
+ // Executed when the content duration, container video size, start time, |
+ // and whether the content has audio and/or video in supported formats are |
+ // known. |
+ virtual void OnMetadata(PipelineMetadata metadata) {} |
+ |
+ // Executed whenever there are changes in the buffering state of the |
+ // pipeline. |
+ virtual void OnBufferingStateChange(BufferingState state) {} |
+ |
+ // Executed whenever the presentation duration changes. |
+ virtual void OnDurationChange() {} |
+ |
+ // Executed whenever a text track is added. |
+ virtual void OnAddTextTrack(const TextTrackConfig& config, |
+ const AddTextTrackDoneCB& done_cb) {} |
+ |
+ // Executed whenever the key needed to decrypt the stream is not available. |
+ virtual void OnWaitingForDecryptionKey() {} |
+ }; |
+ |
+ virtual ~Pipeline() {} |
// Build a pipeline to using the given |demuxer| and |renderer| to construct |
// a filter chain, executing |seek_cb| when the initial seek has completed. |
// |
- // The following permanent callbacks will be executed as follows up until |
- // Stop() has completed: |
- // |ended_cb| will be executed whenever the media reaches the end. |
- // |error_cb| will be executed whenever an error occurs but hasn't been |
- // reported already through another callback. |
- // |metadata_cb| will be executed when the content duration, container video |
- // size, start time, and whether the content has audio and/or |
- // video in supported formats are known. |
- // |buffering_state_cb| will be executed whenever there are changes in the |
- // overall buffering state of the pipeline. |
- // |duration_change_cb| optional callback that will be executed whenever the |
- // presentation duration changes. |
- // |add_text_track_cb| will be executed whenever a text track is added. |
- // |waiting_for_decryption_key_cb| will be executed whenever the key needed |
- // to decrypt the stream is not available. |
+ // The following permanent callbacks will be executed on PipelineClient up |
+ // until Stop() has completed: |
+ // OnError |
+ // OnEnded |
+ // OnMetadata |
+ // OnBufferingStateChange |
+ // OnDurationChange |
+ // OnAddTextTrack |
+ // OnWaitingForDecryptionKey |
+ // |
// It is an error to call this method after the pipeline has already started. |
virtual void Start(Demuxer* demuxer, |
scoped_ptr<Renderer> renderer, |
- const base::Closure& ended_cb, |
- const PipelineStatusCB& error_cb, |
- const PipelineStatusCB& seek_cb, |
- const PipelineMetadataCB& metadata_cb, |
- const BufferingStateCB& buffering_state_cb, |
- const base::Closure& duration_change_cb, |
- const AddTextTrackCB& add_text_track_cb, |
- const base::Closure& waiting_for_decryption_key_cb) = 0; |
+ Client* client, |
+ const PipelineStatusCB& seek_cb) = 0; |
xhwang
2016/04/25 22:49:45
Can you add a TODO about splitting |seek_cb|? You
|
// Asynchronously stops the pipeline, executing |stop_cb| when the pipeline |
// teardown has completed. |