| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 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. | 104 // It's safe to call this callback from any thread. |
| 105 // |duration_change_cb| optional callback that will be executed whenever the | 105 // |duration_change_cb| optional callback that will be executed whenever the |
| 106 // presentation duration changes. | 106 // presentation duration changes. |
| 107 // |add_text_track_cb| will be executed whenever a text track is added. | 107 // |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 |
| 109 // to decrypt the stream is not available. |
| 108 // It is an error to call this method after the pipeline has already started. | 110 // It is an error to call this method after the pipeline has already started. |
| 109 void Start(Demuxer* demuxer, | 111 void Start(Demuxer* demuxer, |
| 110 scoped_ptr<Renderer> renderer, | 112 scoped_ptr<Renderer> renderer, |
| 111 const base::Closure& ended_cb, | 113 const base::Closure& ended_cb, |
| 112 const PipelineStatusCB& error_cb, | 114 const PipelineStatusCB& error_cb, |
| 113 const PipelineStatusCB& seek_cb, | 115 const PipelineStatusCB& seek_cb, |
| 114 const PipelineMetadataCB& metadata_cb, | 116 const PipelineMetadataCB& metadata_cb, |
| 115 const BufferingStateCB& buffering_state_cb, | 117 const BufferingStateCB& buffering_state_cb, |
| 116 const PaintCB& paint_cb, | 118 const PaintCB& paint_cb, |
| 117 const base::Closure& duration_change_cb, | 119 const base::Closure& duration_change_cb, |
| 118 const AddTextTrackCB& add_text_track_cb); | 120 const AddTextTrackCB& add_text_track_cb, |
| 121 const base::Closure& waiting_for_decryption_key_cb); |
| 119 | 122 |
| 120 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline | 123 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline |
| 121 // teardown has completed. | 124 // teardown has completed. |
| 122 // | 125 // |
| 123 // Stop() must complete before destroying the pipeline. It it permissible to | 126 // Stop() must complete before destroying the pipeline. It it permissible to |
| 124 // call Stop() at any point during the lifetime of the pipeline. | 127 // call Stop() at any point during the lifetime of the pipeline. |
| 125 // | 128 // |
| 126 // It is safe to delete the pipeline during the execution of |stop_cb|. | 129 // It is safe to delete the pipeline during the execution of |stop_cb|. |
| 127 void Stop(const base::Closure& stop_cb); | 130 void Stop(const base::Closure& stop_cb); |
| 128 | 131 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 base::Closure stop_cb_; | 356 base::Closure stop_cb_; |
| 354 | 357 |
| 355 // Permanent callbacks passed in via Start(). | 358 // Permanent callbacks passed in via Start(). |
| 356 base::Closure ended_cb_; | 359 base::Closure ended_cb_; |
| 357 PipelineStatusCB error_cb_; | 360 PipelineStatusCB error_cb_; |
| 358 PipelineMetadataCB metadata_cb_; | 361 PipelineMetadataCB metadata_cb_; |
| 359 BufferingStateCB buffering_state_cb_; | 362 BufferingStateCB buffering_state_cb_; |
| 360 PaintCB paint_cb_; | 363 PaintCB paint_cb_; |
| 361 base::Closure duration_change_cb_; | 364 base::Closure duration_change_cb_; |
| 362 AddTextTrackCB add_text_track_cb_; | 365 AddTextTrackCB add_text_track_cb_; |
| 366 base::Closure waiting_for_decryption_key_cb_; |
| 363 | 367 |
| 364 // Holds the initialized demuxer. Used for seeking. Owned by client. | 368 // Holds the initialized demuxer. Used for seeking. Owned by client. |
| 365 Demuxer* demuxer_; | 369 Demuxer* demuxer_; |
| 366 | 370 |
| 367 // Holds the initialized renderers. Used for setting the volume, | 371 // Holds the initialized renderers. Used for setting the volume, |
| 368 // playback rate, and determining when playback has finished. | 372 // playback rate, and determining when playback has finished. |
| 369 scoped_ptr<Renderer> renderer_; | 373 scoped_ptr<Renderer> renderer_; |
| 370 scoped_ptr<TextRenderer> text_renderer_; | 374 scoped_ptr<TextRenderer> text_renderer_; |
| 371 | 375 |
| 372 PipelineStatistics statistics_; | 376 PipelineStatistics statistics_; |
| 373 | 377 |
| 374 scoped_ptr<SerialRunner> pending_callbacks_; | 378 scoped_ptr<SerialRunner> pending_callbacks_; |
| 375 | 379 |
| 376 // CdmContext to be used to decrypt (and decode) encrypted stream in this | 380 // CdmContext to be used to decrypt (and decode) encrypted stream in this |
| 377 // pipeline. Non-null only when SetCdm() is called and the pipeline has not | 381 // pipeline. Non-null only when SetCdm() is called and the pipeline has not |
| 378 // been started. Then during Start(), this value will be set on |renderer_|. | 382 // been started. Then during Start(), this value will be set on |renderer_|. |
| 379 CdmContext* pending_cdm_context_; | 383 CdmContext* pending_cdm_context_; |
| 380 | 384 |
| 381 base::ThreadChecker thread_checker_; | 385 base::ThreadChecker thread_checker_; |
| 382 | 386 |
| 383 // NOTE: Weak pointers must be invalidated before all other member variables. | 387 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 384 base::WeakPtrFactory<Pipeline> weak_factory_; | 388 base::WeakPtrFactory<Pipeline> weak_factory_; |
| 385 | 389 |
| 386 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 390 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
| 387 }; | 391 }; |
| 388 | 392 |
| 389 } // namespace media | 393 } // namespace media |
| 390 | 394 |
| 391 #endif // MEDIA_BASE_PIPELINE_H_ | 395 #endif // MEDIA_BASE_PIPELINE_H_ |
| OLD | NEW |