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 16 matching lines...) Expand all Loading... |
27 video_frames_decoded(0), | 27 video_frames_decoded(0), |
28 video_frames_dropped(0) { | 28 video_frames_dropped(0) { |
29 } | 29 } |
30 | 30 |
31 uint32 audio_bytes_decoded; // Should be uint64? | 31 uint32 audio_bytes_decoded; // Should be uint64? |
32 uint32 video_bytes_decoded; // Should be uint64? | 32 uint32 video_bytes_decoded; // Should be uint64? |
33 uint32 video_frames_decoded; | 33 uint32 video_frames_decoded; |
34 uint32 video_frames_dropped; | 34 uint32 video_frames_dropped; |
35 }; | 35 }; |
36 | 36 |
| 37 enum NetworkEvent { |
| 38 DOWNLOAD_CONTINUED, |
| 39 DOWNLOAD_PAUSED, |
| 40 CAN_PLAY_THROUGH |
| 41 }; |
| 42 |
37 class FilterCollection; | 43 class FilterCollection; |
38 | 44 |
39 class MEDIA_EXPORT Pipeline : public base::RefCountedThreadSafe<Pipeline> { | 45 class MEDIA_EXPORT Pipeline : public base::RefCountedThreadSafe<Pipeline> { |
40 public: | 46 public: |
41 // Callback that executes when a network event occurrs. | 47 // Callback that executes when a network event occurrs. |
42 // The parameter represents the state of network activity: true if the network | 48 // The parameter specifies the type of event that is being signaled. |
43 // is downloading data, false if it is not. If the callback never runs, it is | 49 typedef base::Callback<void(NetworkEvent)> NetworkEventCB; |
44 // assumed the network is not downloading data. | |
45 typedef base::Callback<void(bool)> NetworkEventCB; | |
46 | 50 |
47 // Initializes pipeline. Pipeline takes ownership of all callbacks passed | 51 // Initializes pipeline. Pipeline takes ownership of all callbacks passed |
48 // into this method. | 52 // into this method. |
49 // |ended_callback| will be executed when the media reaches the end. | 53 // |ended_callback| will be executed when the media reaches the end. |
50 // |error_callback_| will be executed upon an error in the pipeline. | 54 // |error_callback_| will be executed upon an error in the pipeline. |
51 // |network_callback_| will be executed when there's a network event. | 55 // |network_callback_| will be executed when there's a network event. |
52 virtual void Init(const PipelineStatusCB& ended_callback, | 56 virtual void Init(const PipelineStatusCB& ended_callback, |
53 const PipelineStatusCB& error_callback, | 57 const PipelineStatusCB& error_callback, |
54 const NetworkEventCB& network_callback) = 0; | 58 const NetworkEventCB& network_callback) = 0; |
55 | 59 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 172 |
169 protected: | 173 protected: |
170 // Only allow ourselves to be deleted by reference counting. | 174 // Only allow ourselves to be deleted by reference counting. |
171 friend class base::RefCountedThreadSafe<Pipeline>; | 175 friend class base::RefCountedThreadSafe<Pipeline>; |
172 virtual ~Pipeline() {} | 176 virtual ~Pipeline() {} |
173 }; | 177 }; |
174 | 178 |
175 } // namespace media | 179 } // namespace media |
176 | 180 |
177 #endif // MEDIA_BASE_PIPELINE_H_ | 181 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |