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 "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // playing the media. | 72 // playing the media. |
73 // | 73 // |
74 // If any error ever happens, this object will transition to the "Error" state | 74 // If any error ever happens, this object will transition to the "Error" state |
75 // from any state. If Stop() is ever called, this object will transition to | 75 // from any state. If Stop() is ever called, this object will transition to |
76 // "Stopped" state. | 76 // "Stopped" state. |
77 class MEDIA_EXPORT Pipeline : public DemuxerHost { | 77 class MEDIA_EXPORT Pipeline : public DemuxerHost { |
78 public: | 78 public: |
79 // Constructs a media pipeline that will execute on |task_runner|. | 79 // Constructs a media pipeline that will execute on |task_runner|. |
80 Pipeline(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 80 Pipeline(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
81 MediaLog* media_log); | 81 MediaLog* media_log); |
82 virtual ~Pipeline(); | 82 ~Pipeline() override; |
83 | 83 |
84 // Build a pipeline to using the given |demuxer| and |renderer| to construct | 84 // Build a pipeline to using the given |demuxer| and |renderer| to construct |
85 // a filter chain, executing |seek_cb| when the initial seek has completed. | 85 // a filter chain, executing |seek_cb| when the initial seek has completed. |
86 // | 86 // |
87 // The following permanent callbacks will be executed as follows up until | 87 // The following permanent callbacks will be executed as follows up until |
88 // Stop() has completed: | 88 // Stop() has completed: |
89 // |ended_cb| will be executed whenever the media reaches the end. | 89 // |ended_cb| will be executed whenever the media reaches the end. |
90 // |error_cb| will be executed whenever an error occurs but hasn't been | 90 // |error_cb| will be executed whenever an error occurs but hasn't been |
91 // reported already through another callback. | 91 // reported already through another callback. |
92 // |metadata_cb| will be executed when the content duration, container video | 92 // |metadata_cb| will be executed when the content duration, container video |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void SetState(State next_state); | 196 void SetState(State next_state); |
197 | 197 |
198 static const char* GetStateString(State state); | 198 static const char* GetStateString(State state); |
199 State GetNextState() const; | 199 State GetNextState() const; |
200 | 200 |
201 // Helper method that runs & resets |seek_cb_| and resets |seek_timestamp_| | 201 // Helper method that runs & resets |seek_cb_| and resets |seek_timestamp_| |
202 // and |seek_pending_|. | 202 // and |seek_pending_|. |
203 void FinishSeek(); | 203 void FinishSeek(); |
204 | 204 |
205 // DemuxerHost implementaion. | 205 // DemuxerHost implementaion. |
206 virtual void AddBufferedTimeRange(base::TimeDelta start, | 206 void AddBufferedTimeRange(base::TimeDelta start, |
207 base::TimeDelta end) override; | 207 base::TimeDelta end) override; |
208 virtual void SetDuration(base::TimeDelta duration) override; | 208 void SetDuration(base::TimeDelta duration) override; |
209 virtual void OnDemuxerError(PipelineStatus error) override; | 209 void OnDemuxerError(PipelineStatus error) override; |
210 virtual void AddTextStream(DemuxerStream* text_stream, | 210 void AddTextStream(DemuxerStream* text_stream, |
211 const TextTrackConfig& config) override; | 211 const TextTrackConfig& config) override; |
212 virtual void RemoveTextStream(DemuxerStream* text_stream) override; | 212 void RemoveTextStream(DemuxerStream* text_stream) override; |
213 | 213 |
214 // Callback executed when a rendering error happened, initiating the teardown | 214 // Callback executed when a rendering error happened, initiating the teardown |
215 // sequence. | 215 // sequence. |
216 void OnError(PipelineStatus error); | 216 void OnError(PipelineStatus error); |
217 | 217 |
218 // Callback executed by filters to update statistics. | 218 // Callback executed by filters to update statistics. |
219 void OnUpdateStatistics(const PipelineStatistics& stats); | 219 void OnUpdateStatistics(const PipelineStatistics& stats); |
220 | 220 |
221 // The following "task" methods correspond to the public methods, but these | 221 // The following "task" methods correspond to the public methods, but these |
222 // methods are run as the result of posting a task to the Pipeline's | 222 // methods are run as the result of posting a task to the Pipeline's |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 // NOTE: Weak pointers must be invalidated before all other member variables. | 362 // NOTE: Weak pointers must be invalidated before all other member variables. |
363 base::WeakPtrFactory<Pipeline> weak_factory_; | 363 base::WeakPtrFactory<Pipeline> weak_factory_; |
364 | 364 |
365 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 365 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
366 }; | 366 }; |
367 | 367 |
368 } // namespace media | 368 } // namespace media |
369 | 369 |
370 #endif // MEDIA_BASE_PIPELINE_H_ | 370 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |