| OLD | NEW |
| 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_ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class FilterCollection; | 45 class FilterCollection; |
| 46 | 46 |
| 47 class MEDIA_EXPORT Pipeline : public base::RefCountedThreadSafe<Pipeline> { | 47 class MEDIA_EXPORT Pipeline : public base::RefCountedThreadSafe<Pipeline> { |
| 48 public: | 48 public: |
| 49 // Callback that executes when a network event occurrs. | 49 // Callback that executes when a network event occurrs. |
| 50 // The parameter specifies the type of event that is being signaled. | 50 // The parameter specifies the type of event that is being signaled. |
| 51 typedef base::Callback<void(NetworkEvent)> NetworkEventCB; | 51 typedef base::Callback<void(NetworkEvent)> NetworkEventCB; |
| 52 | 52 |
| 53 // Initializes pipeline. Pipeline takes ownership of all callbacks passed | 53 // Initializes pipeline. |
| 54 // into this method. | |
| 55 // |ended_callback| will be executed when the media reaches the end. | 54 // |ended_callback| will be executed when the media reaches the end. |
| 56 // |error_callback_| will be executed upon an error in the pipeline. | 55 // |error_callback_| will be executed upon an error in the pipeline. |
| 57 // |network_callback_| will be executed when there's a network event. | 56 // |network_callback_| will be executed when there's a network event. |
| 58 virtual void Init(const PipelineStatusCB& ended_callback, | 57 virtual void Init(const PipelineStatusCB& ended_callback, |
| 59 const PipelineStatusCB& error_callback, | 58 const PipelineStatusCB& error_callback, |
| 60 const NetworkEventCB& network_callback) = 0; | 59 const NetworkEventCB& network_callback) = 0; |
| 61 | 60 |
| 62 // Build a pipeline to render the given URL using the given filter collection | 61 // Build a pipeline to render the given URL using the given filter collection |
| 63 // to construct a filter chain. Returns true if successful, false otherwise | 62 // to construct a filter chain. Returns true if successful, false otherwise |
| 64 // (i.e., pipeline already started). Note that a return value of true | 63 // (i.e., pipeline already started). Note that a return value of true |
| 65 // only indicates that the initialization process has started successfully. | 64 // only indicates that the initialization process has started successfully. |
| 66 // Pipeline initialization is an inherently asynchronous process. Clients can | 65 // Pipeline initialization is an inherently asynchronous process. Clients can |
| 67 // either poll the IsInitialized() method (discouraged) or use the | 66 // either poll the IsInitialized() method (discouraged) or use the |
| 68 // |start_callback| as described below. | 67 // |start_callback| as described below. |
| 69 // | 68 // |
| 70 // This method is asynchronous and can execute a callback when completed. | 69 // This method is asynchronous and can execute a callback when completed. |
| 71 // If the caller provides a |start_callback|, it will be called when the | 70 // If the caller provides a |start_callback|, it will be called when the |
| 72 // pipeline initialization completes. | 71 // pipeline initialization completes. |
| 73 virtual bool Start(FilterCollection* filter_collection, | 72 virtual bool Start(scoped_ptr<FilterCollection> filter_collection, |
| 74 const std::string& url, | 73 const std::string& url, |
| 75 const PipelineStatusCB& start_callback) = 0; | 74 const PipelineStatusCB& start_callback) = 0; |
| 76 | 75 |
| 77 // Asynchronously stops the pipeline and resets it to an uninitialized state. | 76 // Asynchronously stops the pipeline and resets it to an uninitialized state. |
| 78 // If provided, |stop_callback| will be executed when the pipeline has been | 77 // If provided, |stop_callback| will be executed when the pipeline has been |
| 79 // completely torn down and reset to an uninitialized state. It is acceptable | 78 // completely torn down and reset to an uninitialized state. It is acceptable |
| 80 // to call Start() again once the callback has finished executing. | 79 // to call Start() again once the callback has finished executing. |
| 81 // | 80 // |
| 82 // Stop() must be called before destroying the pipeline. Clients can | 81 // Stop() must be called before destroying the pipeline. Clients can |
| 83 // determine whether Stop() must be called by checking IsRunning(). | 82 // determine whether Stop() must be called by checking IsRunning(). |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 173 |
| 175 protected: | 174 protected: |
| 176 // Only allow ourselves to be deleted by reference counting. | 175 // Only allow ourselves to be deleted by reference counting. |
| 177 friend class base::RefCountedThreadSafe<Pipeline>; | 176 friend class base::RefCountedThreadSafe<Pipeline>; |
| 178 virtual ~Pipeline() {} | 177 virtual ~Pipeline() {} |
| 179 }; | 178 }; |
| 180 | 179 |
| 181 } // namespace media | 180 } // namespace media |
| 182 | 181 |
| 183 #endif // MEDIA_BASE_PIPELINE_H_ | 182 #endif // MEDIA_BASE_PIPELINE_H_ |
| OLD | NEW |