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

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

Issue 7484054: Migrate Pipeline & PipelineImpl to PipelineStatusCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CR nits Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « media/base/mock_filters.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 collection containing the filters they want the pipeline to 6 // provide a filter collection 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_
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h"
15 #include "media/base/filters.h" 14 #include "media/base/filters.h"
16 #include "media/base/pipeline_status.h" 15 #include "media/base/pipeline_status.h"
17 16
18 namespace base { 17 namespace base {
19 class TimeDelta; 18 class TimeDelta;
20 } 19 }
21 20
22 namespace media { 21 namespace media {
23 22
24 extern const char kRawMediaScheme[]; 23 extern const char kRawMediaScheme[];
(...skipping 14 matching lines...) Expand all
39 38
40 class FilterCollection; 39 class FilterCollection;
41 40
42 class Pipeline : public base::RefCountedThreadSafe<Pipeline> { 41 class Pipeline : public base::RefCountedThreadSafe<Pipeline> {
43 public: 42 public:
44 // Initializes pipeline. Pipeline takes ownership of all callbacks passed 43 // Initializes pipeline. Pipeline takes ownership of all callbacks passed
45 // into this method. 44 // into this method.
46 // |ended_callback| will be executed when the media reaches the end. 45 // |ended_callback| will be executed when the media reaches the end.
47 // |error_callback_| will be executed upon an error in the pipeline. 46 // |error_callback_| will be executed upon an error in the pipeline.
48 // |network_callback_| will be executed when there's a network event. 47 // |network_callback_| will be executed when there's a network event.
49 virtual void Init(PipelineStatusCallback* ended_callback, 48 virtual void Init(const PipelineStatusCB& ended_callback,
50 PipelineStatusCallback* error_callback, 49 const PipelineStatusCB& error_callback,
51 PipelineStatusCallback* network_callback) = 0; 50 const PipelineStatusCB& network_callback) = 0;
52 51
53 // Build a pipeline to render the given URL using the given filter collection 52 // Build a pipeline to render the given URL using the given filter collection
54 // to construct a filter chain. Returns true if successful, false otherwise 53 // to construct a filter chain. Returns true if successful, false otherwise
55 // (i.e., pipeline already started). Note that a return value of true 54 // (i.e., pipeline already started). Note that a return value of true
56 // only indicates that the initialization process has started successfully. 55 // only indicates that the initialization process has started successfully.
57 // Pipeline initialization is an inherently asynchronous process. Clients can 56 // Pipeline initialization is an inherently asynchronous process. Clients can
58 // either poll the IsInitialized() method (discouraged) or use the 57 // either poll the IsInitialized() method (discouraged) or use the
59 // |start_callback| as described below. 58 // |start_callback| as described below.
60 // 59 //
61 // This method is asynchronous and can execute a callback when completed. 60 // This method is asynchronous and can execute a callback when completed.
62 // If the caller provides a |start_callback|, it will be called when the 61 // If the caller provides a |start_callback|, it will be called when the
63 // pipeline initialization completes. 62 // pipeline initialization completes.
64 virtual bool Start(FilterCollection* filter_collection, 63 virtual bool Start(FilterCollection* filter_collection,
65 const std::string& url, 64 const std::string& url,
66 PipelineStatusCallback* start_callback) = 0; 65 const PipelineStatusCB& start_callback) = 0;
67 66
68 // Asynchronously stops the pipeline and resets it to an uninitialized state. 67 // Asynchronously stops the pipeline and resets it to an uninitialized state.
69 // If provided, |stop_callback| will be executed when the pipeline has been 68 // If provided, |stop_callback| will be executed when the pipeline has been
70 // completely torn down and reset to an uninitialized state. It is acceptable 69 // completely torn down and reset to an uninitialized state. It is acceptable
71 // to call Start() again once the callback has finished executing. 70 // to call Start() again once the callback has finished executing.
72 // 71 //
73 // Stop() must be called before destroying the pipeline. Clients can 72 // Stop() must be called before destroying the pipeline. Clients can
74 // determine whether Stop() must be called by checking IsRunning(). 73 // determine whether Stop() must be called by checking IsRunning().
75 // 74 //
76 // TODO(scherkus): ideally clients would destroy the pipeline after calling 75 // TODO(scherkus): ideally clients would destroy the pipeline after calling
77 // Stop() and create a new pipeline as needed. 76 // Stop() and create a new pipeline as needed.
78 virtual void Stop(PipelineStatusCallback* stop_callback) = 0; 77 virtual void Stop(const PipelineStatusCB& stop_callback) = 0;
79 78
80 // Attempt to seek to the position specified by time. |seek_callback| will be 79 // Attempt to seek to the position specified by time. |seek_callback| will be
81 // executed when the all filters in the pipeline have processed the seek. 80 // executed when the all filters in the pipeline have processed the seek.
82 // 81 //
83 // Clients are expected to call GetCurrentTime() to check whether the seek 82 // Clients are expected to call GetCurrentTime() to check whether the seek
84 // succeeded. 83 // succeeded.
85 virtual void Seek(base::TimeDelta time, 84 virtual void Seek(base::TimeDelta time,
86 PipelineStatusCallback* seek_callback) = 0; 85 const PipelineStatusCB& seek_callback) = 0;
87 86
88 // Returns true if the pipeline has been started via Start(). If IsRunning() 87 // Returns true if the pipeline has been started via Start(). If IsRunning()
89 // returns true, it is expected that Stop() will be called before destroying 88 // returns true, it is expected that Stop() will be called before destroying
90 // the pipeline. 89 // the pipeline.
91 virtual bool IsRunning() const = 0; 90 virtual bool IsRunning() const = 0;
92 91
93 // Returns true if the pipeline has been started and fully initialized to a 92 // Returns true if the pipeline has been started and fully initialized to a
94 // point where playback controls will be respected. Note that it is possible 93 // point where playback controls will be respected. Note that it is possible
95 // for a pipeline to be started but not initialized (i.e., an error occurred). 94 // for a pipeline to be started but not initialized (i.e., an error occurred).
96 virtual bool IsInitialized() const = 0; 95 virtual bool IsInitialized() const = 0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 166
168 protected: 167 protected:
169 // Only allow ourselves to be deleted by reference counting. 168 // Only allow ourselves to be deleted by reference counting.
170 friend class base::RefCountedThreadSafe<Pipeline>; 169 friend class base::RefCountedThreadSafe<Pipeline>;
171 virtual ~Pipeline() {} 170 virtual ~Pipeline() {}
172 }; 171 };
173 172
174 } // namespace media 173 } // namespace media
175 174
176 #endif // MEDIA_BASE_PIPELINE_H_ 175 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW
« no previous file with comments | « media/base/mock_filters.cc ('k') | media/base/pipeline_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698