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

Side by Side Diff: media/base/pipeline.h

Issue 155396: Revert "Implemented injected message loops for PipelineImpl." (Closed)
Patch Set: Created 11 years, 5 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 unified diff | Download patch
« no previous file with comments | « media/base/filter_host_impl.cc ('k') | media/base/pipeline_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The pipeline is the public API clients use for playing back media. Clients 5 // The pipeline is the public API clients use for playing back media. Clients
6 // provide a filter factory containing the filters they want the pipeline to 6 // provide a filter factory containing the filters they want the pipeline to
7 // use to render media. 7 // use to render media.
8 8
9 #ifndef MEDIA_BASE_PIPELINE_H_ 9 #ifndef MEDIA_BASE_PIPELINE_H_
10 #define MEDIA_BASE_PIPELINE_H_ 10 #define MEDIA_BASE_PIPELINE_H_
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // TODO(scherkus): consider returning a PipelineError instead of a bool, or 49 // TODO(scherkus): consider returning a PipelineError instead of a bool, or
50 // perhaps a client callback interface. 50 // perhaps a client callback interface.
51 typedef Callback1<bool>::Type PipelineCallback; 51 typedef Callback1<bool>::Type PipelineCallback;
52 52
53 class Pipeline { 53 class Pipeline {
54 public: 54 public:
55 // Build a pipeline to render the given URL using the given filter factory to 55 // Build a pipeline to render the given URL using the given filter factory to
56 // construct a filter chain. Returns true if successful, false otherwise 56 // construct a filter chain. Returns true if successful, false otherwise
57 // (i.e., pipeline already started). Note that a return value of true 57 // (i.e., pipeline already started). Note that a return value of true
58 // only indicates that the initialization process has started successfully. 58 // only indicates that the initialization process has started successfully.
59 // Pipeline initialization is an inherently asynchronous process. Clients can 59 // Pipeline initialization is an inherently asynchronous process. Clients
60 // either poll the IsInitialized() method (discouraged) or use the 60 // should not call SetPlaybackRate(), Seek(), or SetVolume() until
61 // |start_callback| as described below. 61 // initialization is complete. Clients can either poll the IsInitialized()
62 // method (which is discouraged) or use the |start_callback| as described
63 // below.
62 // 64 //
63 // This method is asynchronous and can execute a callback when completed. 65 // This method is asynchronous and can execute a callback when completed.
64 // If the caller provides a |start_callback|, it will be called when the 66 // If the caller provides a |start_callback|, it will be called when the
65 // pipeline initialization completes. If successful, the callback's bool 67 // pipeline initialization completes. If successful, the callback's bool
66 // parameter will be true. If the callback is called with false, then the 68 // parameter will be true. If the callback is called with false, then the
67 // client can use GetError() to obtain more information about the reason 69 // client can use the GetError() method to obtain more information about the
68 // initialization failed. 70 // reason initialization failed. The prototype for the client callback is:
71 // void Client::PipelineInitComplete(bool init_was_successful);
72 //
73 // Note that clients must not call the Stop method from within the
74 // |start_callback|. Other methods, including SetPlaybackRate(), Seek(), and
75 // SetVolume() may be called. The client will be called on a thread owned by
76 // the pipeline class, not on the thread that originally called the Start()
77 // method.
69 virtual bool Start(FilterFactory* filter_factory, 78 virtual bool Start(FilterFactory* filter_factory,
70 const std::string& url, 79 const std::string& url,
71 PipelineCallback* start_callback) = 0; 80 PipelineCallback* start_callback) = 0;
72 81
73 // Asynchronously stops the pipeline and resets it to an uninitialized state. 82 // Stops the pipeline and resets to an uninitialized state. This method
74 // If provided, |stop_callback| will be executed when the pipeline has been 83 // will block the calling thread until the pipeline has been completely
75 // completely torn down and reset to an uninitialized state. It is acceptable 84 // torn down and reset to an uninitialized state. After calling Stop(), it
76 // to call Start() again once the callback has finished executing. 85 // is acceptable to call Start() again since Stop() leaves the pipeline
86 // in a state identical to a newly created pipeline.
77 // 87 //
78 // Stop() must be called before destroying the pipeline. Clients can 88 // Stop() must be called before destroying the pipeline.
79 // determine whether Stop() must be called by checking IsRunning().
80 // 89 //
81 // TODO(scherkus): ideally clients would destroy the pipeline after calling 90 // TODO(scherkus): it shouldn't be acceptable to call Start() again after you
82 // Stop() and create a new pipeline as needed. 91 // Stop() a pipeline -- it should be destroyed and replaced with a new
83 virtual void Stop(PipelineCallback* stop_callback) = 0; 92 // instance.
93 virtual void Stop() = 0;
84 94
85 // Attempt to seek to the position specified by time. |seek_callback| will be 95 // Attempt to seek to the position specified by time. |seek_callback| will be
86 // executed when the all filters in the pipeline have processed the seek. 96 // executed when the all filters in the pipeline have processed the seek.
87 // The callback will return true if the seek was carried out, false otherwise 97 // The callback will return true if the seek was carried out, false otherwise
88 // (i.e., streaming media). 98 // (i.e., streaming media).
89 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback) = 0; 99 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback) = 0;
90 100
91 // Returns true if the pipeline has been started via Start(). If IsRunning() 101 // Returns the current initialization state of the pipeline. Note that this
92 // returns true, it is expected that Stop() will be called before destroying 102 // will be set to true prior to a executing |init_complete_callback| if
93 // the pipeline. 103 // initialization is successful.
94 virtual bool IsRunning() const = 0;
95
96 // Returns true if the pipeline has been started and fully initialized to a
97 // point where playback controls will be respected. Note that it is possible
98 // for a pipeline to be started but not initialized (i.e., an error occurred).
99 virtual bool IsInitialized() const = 0; 104 virtual bool IsInitialized() const = 0;
100 105
101 // If the |major_mime_type| exists in the pipeline and is being rendered, this 106 // If the |major_mime_type| exists in the pipeline and is being rendered, this
102 // method will return true. Types are defined in media/base/media_foramt.h. 107 // method will return true. Types are defined in media/base/media_foramt.h.
103 // For example, to determine if a pipeline contains video: 108 // For example, to determine if a pipeline contains video:
104 // bool has_video = pipeline->IsRendered(mime_type::kMajorTypeVideo); 109 // bool has_video = pipeline->IsRendered(mime_type::kMajorTypeVideo);
105 virtual bool IsRendered(const std::string& major_mime_type) const = 0; 110 virtual bool IsRendered(const std::string& major_mime_type) const = 0;
106 111
107 // Gets the current playback rate of the pipeline. When the pipeline is 112 // Gets the current playback rate of the pipeline. When the pipeline is
108 // started, the playback rate will be 0.0f. A rate of 1.0f indicates 113 // started, the playback rate will be 0.0f. A rate of 1.0f indicates
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // operating correctly, this will return OK. 160 // operating correctly, this will return OK.
156 virtual PipelineError GetError() const = 0; 161 virtual PipelineError GetError() const = 0;
157 162
158 protected: 163 protected:
159 virtual ~Pipeline() {} 164 virtual ~Pipeline() {}
160 }; 165 };
161 166
162 } // namespace media 167 } // namespace media
163 168
164 #endif // MEDIA_BASE_PIPELINE_H_ 169 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW
« no previous file with comments | « media/base/filter_host_impl.cc ('k') | media/base/pipeline_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698