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

Unified Diff: trunk/src/media/base/pipeline.h

Issue 210743002: Revert 259154 "Remove HasAudio(), HasVideo(), GetInitialNaturalS..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | « trunk/src/content/renderer/media/webmediaplayer_impl.cc ('k') | trunk/src/media/base/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/media/base/pipeline.h
===================================================================
--- trunk/src/media/base/pipeline.h (revision 259158)
+++ trunk/src/media/base/pipeline.h (working copy)
@@ -34,17 +34,6 @@
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.
@@ -78,6 +67,21 @@
// "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);
@@ -93,23 +97,18 @@
// 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.
- // |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
+ // |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
// 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 PipelineMetadataCB& metadata_cb,
- const base::Closure& preroll_completed_cb,
+ const BufferingStateCB& buffering_state_cb,
const base::Closure& duration_change_cb);
// Asynchronously stops the pipeline, executing |stop_cb| when the pipeline
@@ -135,6 +134,12 @@
// 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
@@ -173,6 +178,10 @@
// 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;
@@ -253,7 +262,12 @@
// 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();
+ 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);
// Stops and destroys all filters, placing the pipeline in the kStopped state.
void StopTask(const base::Closure& stop_cb);
@@ -356,6 +370,9 @@
// 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.
@@ -385,6 +402,13 @@
// 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_|.
@@ -408,8 +432,7 @@
// Permanent callbacks passed in via Start().
base::Closure ended_cb_;
PipelineStatusCB error_cb_;
- PipelineMetadataCB metadata_cb_;
- base::Closure preroll_completed_cb_;
+ BufferingStateCB buffering_state_cb_;
base::Closure duration_change_cb_;
// Contains the demuxer and renderers to use when initializing.
« no previous file with comments | « trunk/src/content/renderer/media/webmediaplayer_impl.cc ('k') | trunk/src/media/base/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698