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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 class AudioDecoder; | 29 class AudioDecoder; |
30 class AudioRenderer; | 30 class AudioRenderer; |
31 class Clock; | 31 class Clock; |
32 class Filter; | 32 class Filter; |
33 class FilterCollection; | 33 class FilterCollection; |
34 class MediaLog; | 34 class MediaLog; |
35 class VideoDecoder; | 35 class VideoDecoder; |
36 class VideoRenderer; | 36 class VideoRenderer; |
37 | 37 |
38 // TODO(scherkus): this should be moved alongside host interface defintions. | |
39 struct PipelineStatistics { | |
40 PipelineStatistics() | |
41 : audio_bytes_decoded(0), | |
42 video_bytes_decoded(0), | |
43 video_frames_decoded(0), | |
44 video_frames_dropped(0) { | |
45 } | |
46 | |
47 uint32 audio_bytes_decoded; // Should be uint64? | |
48 uint32 video_bytes_decoded; // Should be uint64? | |
49 uint32 video_frames_decoded; | |
50 uint32 video_frames_dropped; | |
51 }; | |
52 | |
53 enum NetworkEvent { | 38 enum NetworkEvent { |
54 DOWNLOAD_CONTINUED, | 39 DOWNLOAD_CONTINUED, |
55 DOWNLOAD_PAUSED, | 40 DOWNLOAD_PAUSED, |
56 CAN_PLAY_THROUGH | 41 CAN_PLAY_THROUGH |
57 }; | 42 }; |
58 | 43 |
59 // Callback that executes when a network event occurs. | 44 // Callback that executes when a network event occurs. |
60 // The parameter specifies the type of event that is being signalled. | 45 // The parameter specifies the type of event that is being signalled. |
61 typedef base::Callback<void(NetworkEvent)> NetworkEventCB; | 46 typedef base::Callback<void(NetworkEvent)> NetworkEventCB; |
62 | 47 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // start the clock. | 549 // start the clock. |
565 bool waiting_for_clock_update_; | 550 bool waiting_for_clock_update_; |
566 | 551 |
567 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that | 552 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that |
568 // the pipeline is operating correctly. Any other value indicates that the | 553 // the pipeline is operating correctly. Any other value indicates that the |
569 // pipeline is stopped or is stopping. Clients can call the Stop() method to | 554 // pipeline is stopped or is stopping. Clients can call the Stop() method to |
570 // reset the pipeline state, and restore this to PIPELINE_OK. | 555 // reset the pipeline state, and restore this to PIPELINE_OK. |
571 PipelineStatus status_; | 556 PipelineStatus status_; |
572 | 557 |
573 // Whether the media contains rendered audio and video streams. | 558 // Whether the media contains rendered audio and video streams. |
| 559 // TODO(fischman,scherkus): replace these with checks for |
| 560 // {audio,video}_decoder_ once extraction of {Audio,Video}Decoder from the |
| 561 // Filter heirarchy is done. |
574 bool has_audio_; | 562 bool has_audio_; |
575 bool has_video_; | 563 bool has_video_; |
576 | 564 |
577 // The following data members are only accessed by tasks posted to | 565 // The following data members are only accessed by tasks posted to |
578 // |message_loop_|. | 566 // |message_loop_|. |
579 | 567 |
580 // Member that tracks the current state. | 568 // Member that tracks the current state. |
581 State state_; | 569 State state_; |
582 | 570 |
583 // For kSeeking we need to remember where we're seeking between filter | 571 // For kSeeking we need to remember where we're seeking between filter |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 // Renderer references used for setting the volume and determining | 609 // Renderer references used for setting the volume and determining |
622 // when playback has finished. | 610 // when playback has finished. |
623 scoped_refptr<AudioRenderer> audio_renderer_; | 611 scoped_refptr<AudioRenderer> audio_renderer_; |
624 scoped_refptr<VideoRenderer> video_renderer_; | 612 scoped_refptr<VideoRenderer> video_renderer_; |
625 | 613 |
626 // Demuxer reference used for setting the preload value. | 614 // Demuxer reference used for setting the preload value. |
627 scoped_refptr<Demuxer> demuxer_; | 615 scoped_refptr<Demuxer> demuxer_; |
628 | 616 |
629 // Helper class that stores filter references during pipeline | 617 // Helper class that stores filter references during pipeline |
630 // initialization. | 618 // initialization. |
631 class PipelineInitState; | 619 struct PipelineInitState; |
632 scoped_ptr<PipelineInitState> pipeline_init_state_; | 620 scoped_ptr<PipelineInitState> pipeline_init_state_; |
633 | 621 |
634 // Statistics. | 622 // Statistics. |
635 PipelineStatistics statistics_; | 623 PipelineStatistics statistics_; |
636 // Time of pipeline creation; is non-zero only until the pipeline first | 624 // Time of pipeline creation; is non-zero only until the pipeline first |
637 // reaches "kStarted", at which point it is used & zeroed out. | 625 // reaches "kStarted", at which point it is used & zeroed out. |
638 base::Time creation_time_; | 626 base::Time creation_time_; |
639 | 627 |
640 // Approximates the rate at which the media is being downloaded. | 628 // Approximates the rate at which the media is being downloaded. |
641 DownloadRateMonitor download_rate_monitor_; | 629 DownloadRateMonitor download_rate_monitor_; |
642 | 630 |
643 // True if the pipeline is actively downloading bytes, false otherwise. | 631 // True if the pipeline is actively downloading bytes, false otherwise. |
644 bool is_downloading_data_; | 632 bool is_downloading_data_; |
645 | 633 |
646 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 634 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
647 }; | 635 }; |
648 | 636 |
649 } // namespace media | 637 } // namespace media |
650 | 638 |
651 #endif // MEDIA_BASE_PIPELINE_H_ | 639 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |