| Index: media/base/pipeline.h
|
| diff --git a/media/base/pipeline.h b/media/base/pipeline.h
|
| index 9b0ebdf3f45da672935e6d18b5ee7a481bb59cda..4b78eb7ece1d7436052b06b208d4a79333946f86 100644
|
| --- a/media/base/pipeline.h
|
| +++ b/media/base/pipeline.h
|
| @@ -34,6 +34,17 @@ class TextRenderer;
|
| class TextTrackConfig;
|
| class VideoRenderer;
|
|
|
| +// Metadata describing a pipeline once it has been initialized.
|
| +struct PipelineMetadata {
|
| + PipelineMetadata() : has_audio(false), has_video(false) {}
|
| +
|
| + bool has_audio;
|
| + bool has_video;
|
| + gfx::Size natural_size;
|
| +};
|
| +
|
| +typedef base::Callback<void(PipelineMetadata)> PipelineMetadataCB;
|
| +
|
| // Pipeline runs the media pipeline. Filters are created and called on the
|
| // task runner injected into this object. Pipeline works like a state
|
| // machine to perform asynchronous initialization, pausing, seeking and playing.
|
| @@ -67,21 +78,6 @@ class VideoRenderer;
|
| // "Stopped" state.
|
| class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| public:
|
| - // Buffering states the pipeline transitions between during playback.
|
| - // kHaveMetadata:
|
| - // Indicates that the following things are known:
|
| - // content duration, container video size, start time, and whether the
|
| - // content has audio and/or video in supported formats.
|
| - // kPrerollCompleted:
|
| - // All renderers have buffered enough data to satisfy preroll and are ready
|
| - // to start playback.
|
| - enum BufferingState {
|
| - kHaveMetadata,
|
| - kPrerollCompleted,
|
| - };
|
| -
|
| - typedef base::Callback<void(BufferingState)> BufferingStateCB;
|
| -
|
| // Constructs a media pipeline that will execute on |task_runner|.
|
| Pipeline(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
|
| MediaLog* media_log);
|
| @@ -97,18 +93,23 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // 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.
|
| - // |buffering_state_cb| Optional callback that will be executed whenever the
|
| - // pipeline's buffering state changes.
|
| - // |duration_change_cb| Optional callback that will be executed whenever the
|
| + // |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.
|
| + // |preroll_completed_cb| will be executed when all renderers have buffered
|
| + // enough data to satisfy preroll and are ready to
|
| + // start playback.
|
| + // |duration_change_cb| optional callback that will be executed whenever the
|
| // presentation duration changes.
|
| // It is an error to call this method after the pipeline has already started.
|
| void Start(scoped_ptr<FilterCollection> filter_collection,
|
| const base::Closure& ended_cb,
|
| const PipelineStatusCB& error_cb,
|
| const PipelineStatusCB& seek_cb,
|
| - const BufferingStateCB& buffering_state_cb,
|
| + const PipelineMetadataCB& metadata_cb,
|
| + const base::Closure& preroll_completed_cb,
|
| const base::Closure& duration_change_cb);
|
|
|
| // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline
|
| @@ -134,12 +135,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // the pipeline.
|
| bool IsRunning() const;
|
|
|
| - // Returns true if the media has audio.
|
| - bool HasAudio() const;
|
| -
|
| - // Returns true if the media has video.
|
| - bool HasVideo() const;
|
| -
|
| // Gets the current playback rate of the pipeline. When the pipeline is
|
| // started, the playback rate will be 0.0f. A rate of 1.0f indicates
|
| // that the pipeline is rendering the media at the standard rate. Valid
|
| @@ -178,10 +173,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // determined or can not be determined, this value is 0.
|
| int64 GetTotalBytes() const;
|
|
|
| - // Get the video's initial natural size as reported by the container. Note
|
| - // that the natural size can change during playback.
|
| - gfx::Size GetInitialNaturalSize() const;
|
| -
|
| // Return true if loading progress has been made since the last time this
|
| // method was called.
|
| bool DidLoadingProgress() const;
|
| @@ -262,12 +253,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // The following "task" methods correspond to the public methods, but these
|
| // methods are run as the result of posting a task to the Pipeline's
|
| // task runner.
|
| - void StartTask(scoped_ptr<FilterCollection> filter_collection,
|
| - const base::Closure& ended_cb,
|
| - const PipelineStatusCB& error_cb,
|
| - const PipelineStatusCB& seek_cb,
|
| - const BufferingStateCB& buffering_state_cb,
|
| - const base::Closure& duration_change_cb);
|
| + void StartTask();
|
|
|
| // Stops and destroys all filters, placing the pipeline in the kStopped state.
|
| void StopTask(const base::Closure& stop_cb);
|
| @@ -370,9 +356,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // Total size of the media. Set by filters.
|
| int64 total_bytes_;
|
|
|
| - // The initial natural size of the video as reported by the container.
|
| - gfx::Size initial_natural_size_;
|
| -
|
| // Current volume level (from 0.0f to 1.0f). This value is set immediately
|
| // via SetVolume() and a task is dispatched on the task runner to notify the
|
| // filters.
|
| @@ -402,13 +385,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // reset the pipeline state, and restore this to PIPELINE_OK.
|
| PipelineStatus status_;
|
|
|
| - // Whether the media contains rendered audio or video streams.
|
| - // TODO(fischman,scherkus): replace these with checks for
|
| - // {audio,video}_decoder_ once extraction of {Audio,Video}Decoder from the
|
| - // Filter heirarchy is done.
|
| - bool has_audio_;
|
| - bool has_video_;
|
| -
|
| // The following data members are only accessed by tasks posted to
|
| // |task_runner_|.
|
|
|
| @@ -432,7 +408,8 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| // Permanent callbacks passed in via Start().
|
| base::Closure ended_cb_;
|
| PipelineStatusCB error_cb_;
|
| - BufferingStateCB buffering_state_cb_;
|
| + PipelineMetadataCB metadata_cb_;
|
| + base::Closure preroll_completed_cb_;
|
| base::Closure duration_change_cb_;
|
|
|
| // Contains the demuxer and renderers to use when initializing.
|
|
|