OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implementation of Pipeline & PipelineStatusNotification (an async-to-sync | 5 // Implementation of Pipeline & PipelineStatusNotification (an async-to-sync |
6 // callback adapter). | 6 // callback adapter). |
7 | 7 |
8 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ | 8 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
9 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 9 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 class MediaLog; | 30 class MediaLog; |
31 | 31 |
32 // Adapter for using asynchronous Pipeline methods in code that wants to run | 32 // Adapter for using asynchronous Pipeline methods in code that wants to run |
33 // synchronously. To use, construct an instance of this class and pass the | 33 // synchronously. To use, construct an instance of this class and pass the |
34 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for | 34 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for |
35 // the callback to get fired and call status() to see what the callback's | 35 // the callback to get fired and call status() to see what the callback's |
36 // argument was. This object is for one-time use; call |Callback()| exactly | 36 // argument was. This object is for one-time use; call |Callback()| exactly |
37 // once. | 37 // once. |
38 class PipelineStatusNotification { | 38 class MEDIA_EXPORT PipelineStatusNotification { |
39 public: | 39 public: |
40 PipelineStatusNotification(); | 40 PipelineStatusNotification(); |
41 ~PipelineStatusNotification(); | 41 ~PipelineStatusNotification(); |
42 | 42 |
43 // See class-level comment for usage. | 43 // See class-level comment for usage. |
44 PipelineStatusCB Callback(); | 44 PipelineStatusCB Callback(); |
45 void Wait(); | 45 void Wait(); |
46 PipelineStatus status(); | 46 PipelineStatus status(); |
47 | 47 |
48 private: | 48 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Initialization is a series of state transitions from "Created" through each | 86 // Initialization is a series of state transitions from "Created" through each |
87 // filter initialization state. When all filter initialization states have | 87 // filter initialization state. When all filter initialization states have |
88 // completed, we are implicitly in a "Paused" state. At that point we simulate | 88 // completed, we are implicitly in a "Paused" state. At that point we simulate |
89 // a Seek() to the beginning of the media to give filters a chance to preroll. | 89 // a Seek() to the beginning of the media to give filters a chance to preroll. |
90 // From then on the normal Seek() transitions are carried out and we start | 90 // From then on the normal Seek() transitions are carried out and we start |
91 // playing the media. | 91 // playing the media. |
92 // | 92 // |
93 // If any error ever happens, this object will transition to the "Error" state | 93 // If any error ever happens, this object will transition to the "Error" state |
94 // from any state. If Stop() is ever called, this object will transition to | 94 // from any state. If Stop() is ever called, this object will transition to |
95 // "Stopped" state. | 95 // "Stopped" state. |
96 class PipelineImpl : public Pipeline, public FilterHost { | 96 class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost { |
97 public: | 97 public: |
98 explicit PipelineImpl(MessageLoop* message_loop, MediaLog* media_log); | 98 explicit PipelineImpl(MessageLoop* message_loop, MediaLog* media_log); |
99 | 99 |
100 // Pipeline implementation. | 100 // Pipeline implementation. |
101 virtual void Init(const PipelineStatusCB& ended_callback, | 101 virtual void Init(const PipelineStatusCB& ended_callback, |
102 const PipelineStatusCB& error_callback, | 102 const PipelineStatusCB& error_callback, |
103 const PipelineStatusCB& network_callback); | 103 const PipelineStatusCB& network_callback); |
104 virtual bool Start(FilterCollection* filter_collection, | 104 virtual bool Start(FilterCollection* filter_collection, |
105 const std::string& uri, | 105 const std::string& uri, |
106 const PipelineStatusCB& start_callback); | 106 const PipelineStatusCB& start_callback); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 PipelineStatistics statistics_; | 462 PipelineStatistics statistics_; |
463 | 463 |
464 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); | 464 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); |
465 | 465 |
466 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 466 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
467 }; | 467 }; |
468 | 468 |
469 } // namespace media | 469 } // namespace media |
470 | 470 |
471 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 471 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
OLD | NEW |