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 "media/base/audio_renderer.h" | 13 #include "media/base/audio_renderer.h" |
| 14 #include "media/base/callback_util.h" |
14 #include "media/base/demuxer.h" | 15 #include "media/base/demuxer.h" |
15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
16 #include "media/base/pipeline_status.h" | 17 #include "media/base/pipeline_status.h" |
17 #include "media/base/ranges.h" | 18 #include "media/base/ranges.h" |
18 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
19 | 20 |
20 class MessageLoop; | 21 class MessageLoop; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class MessageLoopProxy; | 24 class MessageLoopProxy; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 304 |
304 // Callback executed when the natural size of the video has changed. | 305 // Callback executed when the natural size of the video has changed. |
305 void OnNaturalVideoSizeChanged(const gfx::Size& size); | 306 void OnNaturalVideoSizeChanged(const gfx::Size& size); |
306 | 307 |
307 // Callback executed when either of the renderers have ended. | 308 // Callback executed when either of the renderers have ended. |
308 void OnRendererEnded(); | 309 void OnRendererEnded(); |
309 | 310 |
310 // Callbacks executed by filters upon completing initialization. | 311 // Callbacks executed by filters upon completing initialization. |
311 void OnFilterInitialize(PipelineStatus status); | 312 void OnFilterInitialize(PipelineStatus status); |
312 | 313 |
313 // Callback executed by filters upon completing Play(), Pause(), or Stop(). | 314 // Callback executed by filters upon completing Play(), Pause(), Flush(), |
314 void OnFilterStateTransition(); | 315 // Seek() or Stop(). |
315 | 316 void OnFilterStateTransition(PipelineStatus status); |
316 // Callback executed by filters upon completing Seek(). | |
317 void OnFilterStateTransitionWithStatus(PipelineStatus status); | |
318 | 317 |
319 // Callback executed by filters when completing teardown operations. | 318 // Callback executed by filters when completing teardown operations. |
320 void OnTeardownStateTransition(); | 319 void OnTeardownStateTransition(PipelineStatus status); |
321 | 320 |
322 // Callback executed by filters to update statistics. | 321 // Callback executed by filters to update statistics. |
323 void OnUpdateStatistics(const PipelineStatistics& stats); | 322 void OnUpdateStatistics(const PipelineStatistics& stats); |
324 | 323 |
325 // Callback executed by audio renderer when it has been disabled. | 324 // Callback executed by audio renderer when it has been disabled. |
326 void OnAudioDisabled(); | 325 void OnAudioDisabled(); |
327 | 326 |
328 // Callback executed by audio renderer to update clock time. | 327 // Callback executed by audio renderer to update clock time. |
329 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); | 328 void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); |
330 | 329 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // 2. when pipeline has been initialized, we will first transit to pausing | 407 // 2. when pipeline has been initialized, we will first transit to pausing |
409 // => flushing => stopping => stopped state. | 408 // => flushing => stopping => stopped state. |
410 // This will remove the race condition during stop between filters. | 409 // This will remove the race condition during stop between filters. |
411 void TearDownPipeline(); | 410 void TearDownPipeline(); |
412 | 411 |
413 // Compute the time corresponding to a byte offset. | 412 // Compute the time corresponding to a byte offset. |
414 base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const; | 413 base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const; |
415 | 414 |
416 // Initiates an asynchronous Pause/Seek/Play/Stop() call sequence executing | 415 // Initiates an asynchronous Pause/Seek/Play/Stop() call sequence executing |
417 // |done_cb| when completed. | 416 // |done_cb| when completed. |
418 void DoPause(const base::Closure& done_cb); | 417 void DoPause(const PipelineStatusCB& done_cb); |
419 void DoFlush(const base::Closure& done_cb); | 418 void DoFlush(const PipelineStatusCB& done_cb); |
420 void DoPlay(const base::Closure& done_cb); | 419 void DoPlay(const PipelineStatusCB& done_cb); |
421 void DoStop(const base::Closure& done_cb); | 420 void DoStop(const PipelineStatusCB& done_cb); |
422 | 421 |
423 // Initiates an asynchronous Seek() and preroll call sequence executing | 422 // Initiates an asynchronous Seek() and preroll call sequence executing |
424 // |done_cb| with the final status when completed. If |skip_demuxer_seek| is | 423 // |done_cb| with the final status when completed. If |skip_demuxer_seek| is |
425 // true then only renderers will attempt to preroll. | 424 // true then only renderers will attempt to preroll. |
426 // | 425 // |
427 // TODO(scherkus): Prerolling should be separate from seeking so we can report | 426 // TODO(scherkus): Prerolling should be separate from seeking so we can report |
428 // finer grained ready states (HAVE_CURRENT_DATA vs. HAVE_FUTURE_DATA) | 427 // finer grained ready states (HAVE_CURRENT_DATA vs. HAVE_FUTURE_DATA) |
429 // indepentent from seeking. | 428 // indepentent from seeking. |
430 void DoSeek(base::TimeDelta seek_timestamp, bool skip_demuxer_seek, | 429 void DoSeek(base::TimeDelta seek_timestamp, bool skip_demuxer_seek, |
431 const PipelineStatusCB& done_cb); | 430 const PipelineStatusCB& done_cb); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // initialization. | 555 // initialization. |
557 struct PipelineInitState; | 556 struct PipelineInitState; |
558 scoped_ptr<PipelineInitState> pipeline_init_state_; | 557 scoped_ptr<PipelineInitState> pipeline_init_state_; |
559 | 558 |
560 // Statistics. | 559 // Statistics. |
561 PipelineStatistics statistics_; | 560 PipelineStatistics statistics_; |
562 // Time of pipeline creation; is non-zero only until the pipeline first | 561 // Time of pipeline creation; is non-zero only until the pipeline first |
563 // reaches "kStarted", at which point it is used & zeroed out. | 562 // reaches "kStarted", at which point it is used & zeroed out. |
564 base::Time creation_time_; | 563 base::Time creation_time_; |
565 | 564 |
| 565 scoped_ptr<CallbackSeries> pending_callbacks_; |
| 566 |
566 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 567 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
567 }; | 568 }; |
568 | 569 |
569 } // namespace media | 570 } // namespace media |
570 | 571 |
571 #endif // MEDIA_BASE_PIPELINE_H_ | 572 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |