OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_PIPELINE_H_ | 5 #ifndef MEDIA_BASE_PIPELINE_H_ |
6 #define MEDIA_BASE_PIPELINE_H_ | 6 #define MEDIA_BASE_PIPELINE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // The following permanent callbacks will be executed as follows up until | 93 // The following permanent callbacks will be executed as follows up until |
94 // Stop() has completed: | 94 // Stop() has completed: |
95 // |ended_cb| will be executed whenever the media reaches the end. | 95 // |ended_cb| will be executed whenever the media reaches the end. |
96 // |error_cb| will be executed whenever an error occurs but hasn't been | 96 // |error_cb| will be executed whenever an error occurs but hasn't been |
97 // reported already through another callback. | 97 // reported already through another callback. |
98 // |metadata_cb| will be executed when the content duration, container video | 98 // |metadata_cb| will be executed when the content duration, container video |
99 // size, start time, and whether the content has audio and/or | 99 // size, start time, and whether the content has audio and/or |
100 // video in supported formats are known. | 100 // video in supported formats are known. |
101 // |buffering_state_cb| will be executed whenever there are changes in the | 101 // |buffering_state_cb| will be executed whenever there are changes in the |
102 // overall buffering state of the pipeline. | 102 // overall buffering state of the pipeline. |
103 // |paint_cb| will be executed whenever there is a VideoFrame to be painted. | |
104 // It's safe to call this callback from any thread. | |
105 // |duration_change_cb| optional callback that will be executed whenever the | 103 // |duration_change_cb| optional callback that will be executed whenever the |
106 // presentation duration changes. | 104 // presentation duration changes. |
107 // |add_text_track_cb| will be executed whenever a text track is added. | 105 // |add_text_track_cb| will be executed whenever a text track is added. |
108 // |waiting_for_decryption_key_cb| will be executed whenever the key needed | 106 // |waiting_for_decryption_key_cb| will be executed whenever the key needed |
109 // to decrypt the stream is not available. | 107 // to decrypt the stream is not available. |
110 // It is an error to call this method after the pipeline has already started. | 108 // It is an error to call this method after the pipeline has already started. |
111 void Start(Demuxer* demuxer, | 109 void Start(Demuxer* demuxer, |
112 scoped_ptr<Renderer> renderer, | 110 scoped_ptr<Renderer> renderer, |
113 const base::Closure& ended_cb, | 111 const base::Closure& ended_cb, |
114 const PipelineStatusCB& error_cb, | 112 const PipelineStatusCB& error_cb, |
115 const PipelineStatusCB& seek_cb, | 113 const PipelineStatusCB& seek_cb, |
116 const PipelineMetadataCB& metadata_cb, | 114 const PipelineMetadataCB& metadata_cb, |
117 const BufferingStateCB& buffering_state_cb, | 115 const BufferingStateCB& buffering_state_cb, |
118 const PaintCB& paint_cb, | |
119 const base::Closure& duration_change_cb, | 116 const base::Closure& duration_change_cb, |
120 const AddTextTrackCB& add_text_track_cb, | 117 const AddTextTrackCB& add_text_track_cb, |
121 const base::Closure& waiting_for_decryption_key_cb); | 118 const base::Closure& waiting_for_decryption_key_cb); |
122 | 119 |
123 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline | 120 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline |
124 // teardown has completed. | 121 // teardown has completed. |
125 // | 122 // |
126 // Stop() must complete before destroying the pipeline. It it permissible to | 123 // Stop() must complete before destroying the pipeline. It it permissible to |
127 // call Stop() at any point during the lifetime of the pipeline. | 124 // call Stop() at any point during the lifetime of the pipeline. |
128 // | 125 // |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 PipelineStatusCB seek_cb_; | 350 PipelineStatusCB seek_cb_; |
354 | 351 |
355 // Temporary callback used for Stop(). | 352 // Temporary callback used for Stop(). |
356 base::Closure stop_cb_; | 353 base::Closure stop_cb_; |
357 | 354 |
358 // Permanent callbacks passed in via Start(). | 355 // Permanent callbacks passed in via Start(). |
359 base::Closure ended_cb_; | 356 base::Closure ended_cb_; |
360 PipelineStatusCB error_cb_; | 357 PipelineStatusCB error_cb_; |
361 PipelineMetadataCB metadata_cb_; | 358 PipelineMetadataCB metadata_cb_; |
362 BufferingStateCB buffering_state_cb_; | 359 BufferingStateCB buffering_state_cb_; |
363 PaintCB paint_cb_; | |
364 base::Closure duration_change_cb_; | 360 base::Closure duration_change_cb_; |
365 AddTextTrackCB add_text_track_cb_; | 361 AddTextTrackCB add_text_track_cb_; |
366 base::Closure waiting_for_decryption_key_cb_; | 362 base::Closure waiting_for_decryption_key_cb_; |
367 | 363 |
368 // Holds the initialized demuxer. Used for seeking. Owned by client. | 364 // Holds the initialized demuxer. Used for seeking. Owned by client. |
369 Demuxer* demuxer_; | 365 Demuxer* demuxer_; |
370 | 366 |
371 // Holds the initialized renderers. Used for setting the volume, | 367 // Holds the initialized renderers. Used for setting the volume, |
372 // playback rate, and determining when playback has finished. | 368 // playback rate, and determining when playback has finished. |
373 scoped_ptr<Renderer> renderer_; | 369 scoped_ptr<Renderer> renderer_; |
(...skipping 12 matching lines...) Expand all Loading... |
386 | 382 |
387 // NOTE: Weak pointers must be invalidated before all other member variables. | 383 // NOTE: Weak pointers must be invalidated before all other member variables. |
388 base::WeakPtrFactory<Pipeline> weak_factory_; | 384 base::WeakPtrFactory<Pipeline> weak_factory_; |
389 | 385 |
390 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 386 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
391 }; | 387 }; |
392 | 388 |
393 } // namespace media | 389 } // namespace media |
394 | 390 |
395 #endif // MEDIA_BASE_PIPELINE_H_ | 391 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |