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 15 matching lines...) Expand all Loading... |
26 #include "media/base/pipeline.h" | 26 #include "media/base/pipeline.h" |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 // Adapter for using asynchronous Pipeline methods in code that wants to run | 30 // Adapter for using asynchronous Pipeline methods in code that wants to run |
31 // synchronously. To use, construct an instance of this class and pass the | 31 // synchronously. To use, construct an instance of this class and pass the |
32 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for | 32 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for |
33 // the callback to get fired and call status() to see what the callback's | 33 // the callback to get fired and call status() to see what the callback's |
34 // argument was. This object is for one-time use; call |Callback()| exactly | 34 // argument was. This object is for one-time use; call |Callback()| exactly |
35 // once. | 35 // once. |
36 class MEDIA_EXPORT PipelineStatusNotification { | 36 class PipelineStatusNotification { |
37 public: | 37 public: |
38 PipelineStatusNotification(); | 38 PipelineStatusNotification(); |
39 ~PipelineStatusNotification(); | 39 ~PipelineStatusNotification(); |
40 | 40 |
41 // See class-level comment for usage. | 41 // See class-level comment for usage. |
42 media::PipelineStatusCallback* Callback(); | 42 media::PipelineStatusCallback* Callback(); |
43 void Notify(media::PipelineStatus status); | 43 void Notify(media::PipelineStatus status); |
44 void Wait(); | 44 void Wait(); |
45 media::PipelineStatus status(); | 45 media::PipelineStatus status(); |
46 | 46 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Initialization is a series of state transitions from "Created" through each | 84 // Initialization is a series of state transitions from "Created" through each |
85 // filter initialization state. When all filter initialization states have | 85 // filter initialization state. When all filter initialization states have |
86 // completed, we are implicitly in a "Paused" state. At that point we simulate | 86 // completed, we are implicitly in a "Paused" state. At that point we simulate |
87 // a Seek() to the beginning of the media to give filters a chance to preroll. | 87 // a Seek() to the beginning of the media to give filters a chance to preroll. |
88 // From then on the normal Seek() transitions are carried out and we start | 88 // From then on the normal Seek() transitions are carried out and we start |
89 // playing the media. | 89 // playing the media. |
90 // | 90 // |
91 // If any error ever happens, this object will transition to the "Error" state | 91 // If any error ever happens, this object will transition to the "Error" state |
92 // from any state. If Stop() is ever called, this object will transition to | 92 // from any state. If Stop() is ever called, this object will transition to |
93 // "Stopped" state. | 93 // "Stopped" state. |
94 class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost { | 94 class PipelineImpl : public Pipeline, public FilterHost { |
95 public: | 95 public: |
96 explicit PipelineImpl(MessageLoop* message_loop); | 96 explicit PipelineImpl(MessageLoop* message_loop); |
97 | 97 |
98 // Pipeline implementation. | 98 // Pipeline implementation. |
99 virtual void Init(PipelineStatusCallback* ended_callback, | 99 virtual void Init(PipelineStatusCallback* ended_callback, |
100 PipelineStatusCallback* error_callback, | 100 PipelineStatusCallback* error_callback, |
101 PipelineStatusCallback* network_callback); | 101 PipelineStatusCallback* network_callback); |
102 virtual bool Start(FilterCollection* filter_collection, | 102 virtual bool Start(FilterCollection* filter_collection, |
103 const std::string& uri, | 103 const std::string& uri, |
104 PipelineStatusCallback* start_callback); | 104 PipelineStatusCallback* start_callback); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 PipelineStatistics statistics_; | 455 PipelineStatistics statistics_; |
456 | 456 |
457 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); | 457 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); |
458 | 458 |
459 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 459 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
460 }; | 460 }; |
461 | 461 |
462 } // namespace media | 462 } // namespace media |
463 | 463 |
464 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 464 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
OLD | NEW |