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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/synchronization/condition_variable.h" | 11 #include "base/synchronization/condition_variable.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/base/audio_renderer.h" | 14 #include "media/base/audio_renderer.h" |
| 15 #include "media/base/decryptor.h" |
15 #include "media/base/demuxer.h" | 16 #include "media/base/demuxer.h" |
16 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
17 #include "media/base/pipeline_status.h" | 18 #include "media/base/pipeline_status.h" |
18 #include "media/base/ranges.h" | 19 #include "media/base/ranges.h" |
19 #include "media/base/serial_runner.h" | 20 #include "media/base/serial_runner.h" |
20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
21 | 22 |
22 class MessageLoop; | 23 class MessageLoop; |
23 | 24 |
24 namespace base { | 25 namespace base { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // result in a crash. | 123 // result in a crash. |
123 // | 124 // |
124 // The following permanent callbacks will be executed as follows up until | 125 // The following permanent callbacks will be executed as follows up until |
125 // Stop() has completed: | 126 // Stop() has completed: |
126 // |ended_cb| will be executed whenever the media reaches the end. | 127 // |ended_cb| will be executed whenever the media reaches the end. |
127 // |error_cb| will be executed whenever an error occurs but hasn't | 128 // |error_cb| will be executed whenever an error occurs but hasn't |
128 // been reported already through another callback. | 129 // been reported already through another callback. |
129 // |buffering_state_cb| Optional callback that will be executed whenever the | 130 // |buffering_state_cb| Optional callback that will be executed whenever the |
130 // pipeline's buffering state changes. | 131 // pipeline's buffering state changes. |
131 // It is an error to call this method after the pipeline has already started. | 132 // It is an error to call this method after the pipeline has already started. |
132 void Start(scoped_ptr<FilterCollection> filter_collection, | 133 void Start( |
133 const PipelineStatusCB& ended_cb, | 134 scoped_ptr<FilterCollection> filter_collection, |
134 const PipelineStatusCB& error_cb, | 135 const PipelineStatusCB& ended_cb, |
135 const PipelineStatusCB& seek_cb, | 136 const PipelineStatusCB& error_cb, |
136 const BufferingStateCB& buffering_state_cb); | 137 const PipelineStatusCB& seek_cb, |
| 138 const BufferingStateCB& buffering_state_cb, |
| 139 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); |
137 | 140 |
138 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline | 141 // Asynchronously stops the pipeline, executing |stop_cb| when the pipeline |
139 // teardown has completed. | 142 // teardown has completed. |
140 // | 143 // |
141 // Stop() must complete before destroying the pipeline. It it permissible to | 144 // Stop() must complete before destroying the pipeline. It it permissible to |
142 // call Stop() at any point during the lifetime of the pipeline. | 145 // call Stop() at any point during the lifetime of the pipeline. |
143 void Stop(const base::Closure& stop_cb); | 146 void Stop(const base::Closure& stop_cb); |
144 | 147 |
145 // Attempt to seek to the position specified by time. |seek_cb| will be | 148 // Attempt to seek to the position specified by time. |seek_cb| will be |
146 // executed when the all filters in the pipeline have processed the seek. | 149 // executed when the all filters in the pipeline have processed the seek. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 284 |
282 // Callback executed by audio renderer to update clock time. | 285 // Callback executed by audio renderer to update clock time. |
283 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); | 286 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); |
284 | 287 |
285 // Callback executed by video renderer to update clock time. | 288 // Callback executed by video renderer to update clock time. |
286 void OnVideoTimeUpdate(base::TimeDelta max_time); | 289 void OnVideoTimeUpdate(base::TimeDelta max_time); |
287 | 290 |
288 // The following "task" methods correspond to the public methods, but these | 291 // The following "task" methods correspond to the public methods, but these |
289 // methods are run as the result of posting a task to the PipelineInternal's | 292 // methods are run as the result of posting a task to the PipelineInternal's |
290 // message loop. | 293 // message loop. |
291 void StartTask(scoped_ptr<FilterCollection> filter_collection, | 294 void StartTask( |
292 const PipelineStatusCB& ended_cb, | 295 scoped_ptr<FilterCollection> filter_collection, |
293 const PipelineStatusCB& error_cb, | 296 const PipelineStatusCB& ended_cb, |
294 const PipelineStatusCB& seek_cb, | 297 const PipelineStatusCB& error_cb, |
295 const BufferingStateCB& buffering_state_cb); | 298 const PipelineStatusCB& seek_cb, |
| 299 const BufferingStateCB& buffering_state_cb, |
| 300 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); |
296 | 301 |
297 // Stops and destroys all filters, placing the pipeline in the kStopped state. | 302 // Stops and destroys all filters, placing the pipeline in the kStopped state. |
298 void StopTask(const base::Closure& stop_cb); | 303 void StopTask(const base::Closure& stop_cb); |
299 | 304 |
300 // Carries out stopping and destroying all filters, placing the pipeline in | 305 // Carries out stopping and destroying all filters, placing the pipeline in |
301 // the kStopped state. | 306 // the kStopped state. |
302 void ErrorChangedTask(PipelineStatus error); | 307 void ErrorChangedTask(PipelineStatus error); |
303 | 308 |
304 // Carries out notifying filters that the playback rate has changed. | 309 // Carries out notifying filters that the playback rate has changed. |
305 void PlaybackRateChangedTask(float playback_rate); | 310 void PlaybackRateChangedTask(float playback_rate); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Temporary callback used for Start() and Seek(). | 446 // Temporary callback used for Start() and Seek(). |
442 PipelineStatusCB seek_cb_; | 447 PipelineStatusCB seek_cb_; |
443 | 448 |
444 // Temporary callback used for Stop(). | 449 // Temporary callback used for Stop(). |
445 base::Closure stop_cb_; | 450 base::Closure stop_cb_; |
446 | 451 |
447 // Permanent callbacks passed in via Start(). | 452 // Permanent callbacks passed in via Start(). |
448 PipelineStatusCB ended_cb_; | 453 PipelineStatusCB ended_cb_; |
449 PipelineStatusCB error_cb_; | 454 PipelineStatusCB error_cb_; |
450 BufferingStateCB buffering_state_cb_; | 455 BufferingStateCB buffering_state_cb_; |
| 456 RequestDecryptorNotificationCB request_decryptor_notification_cb_; |
451 | 457 |
452 // Renderer references used for setting the volume, playback rate, and | 458 // Renderer references used for setting the volume, playback rate, and |
453 // determining when playback has finished. | 459 // determining when playback has finished. |
454 scoped_refptr<AudioRenderer> audio_renderer_; | 460 scoped_refptr<AudioRenderer> audio_renderer_; |
455 scoped_refptr<VideoRenderer> video_renderer_; | 461 scoped_refptr<VideoRenderer> video_renderer_; |
456 | 462 |
457 // Demuxer reference used for setting the preload value. | 463 // Demuxer reference used for setting the preload value. |
458 scoped_refptr<Demuxer> demuxer_; | 464 scoped_refptr<Demuxer> demuxer_; |
459 | 465 |
460 PipelineStatistics statistics_; | 466 PipelineStatistics statistics_; |
461 | 467 |
462 // Time of pipeline creation; is non-zero only until the pipeline first | 468 // Time of pipeline creation; is non-zero only until the pipeline first |
463 // reaches "kStarted", at which point it is used & zeroed out. | 469 // reaches "kStarted", at which point it is used & zeroed out. |
464 base::Time creation_time_; | 470 base::Time creation_time_; |
465 | 471 |
466 scoped_ptr<SerialRunner> pending_callbacks_; | 472 scoped_ptr<SerialRunner> pending_callbacks_; |
467 | 473 |
468 base::ThreadChecker thread_checker_; | 474 base::ThreadChecker thread_checker_; |
469 | 475 |
470 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 476 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
471 }; | 477 }; |
472 | 478 |
473 } // namespace media | 479 } // namespace media |
474 | 480 |
475 #endif // MEDIA_BASE_PIPELINE_H_ | 481 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |