OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FILTERS_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_FILTERS_RENDERER_IMPL_H_ |
6 #define MEDIA_FILTERS_RENDERER_IMPL_H_ | 6 #define MEDIA_FILTERS_RENDERER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // GetMediaTime() runs on the render main thread because it's part of JS sync | 37 // GetMediaTime() runs on the render main thread because it's part of JS sync |
38 // API. | 38 // API. |
39 RendererImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 39 RendererImpl(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
40 scoped_ptr<AudioRenderer> audio_renderer, | 40 scoped_ptr<AudioRenderer> audio_renderer, |
41 scoped_ptr<VideoRenderer> video_renderer); | 41 scoped_ptr<VideoRenderer> video_renderer); |
42 | 42 |
43 ~RendererImpl() final; | 43 ~RendererImpl() final; |
44 | 44 |
45 // Renderer implementation. | 45 // Renderer implementation. |
46 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, | 46 void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
47 const base::Closure& init_cb, | 47 const PipelineStatusCB& init_cb, |
48 const StatisticsCB& statistics_cb, | 48 const StatisticsCB& statistics_cb, |
49 const BufferingStateCB& buffering_state_cb, | 49 const BufferingStateCB& buffering_state_cb, |
50 const PaintCB& paint_cb, | 50 const PaintCB& paint_cb, |
51 const base::Closure& ended_cb, | 51 const base::Closure& ended_cb, |
52 const PipelineStatusCB& error_cb) final; | 52 const PipelineStatusCB& error_cb) final; |
53 void SetCdm(CdmContext* cdm_context, | 53 void SetCdm(CdmContext* cdm_context, |
54 const CdmAttachedCB& cdm_attached_cb) final; | 54 const CdmAttachedCB& cdm_attached_cb) final; |
55 void Flush(const base::Closure& flush_cb) final; | 55 void Flush(const base::Closure& flush_cb) final; |
56 void StartPlayingFrom(base::TimeDelta time) final; | 56 void StartPlayingFrom(base::TimeDelta time) final; |
57 void SetPlaybackRate(float playback_rate) final; | 57 void SetPlaybackRate(float playback_rate) final; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Callbacks executed when a renderer has ended. | 114 // Callbacks executed when a renderer has ended. |
115 void OnAudioRendererEnded(); | 115 void OnAudioRendererEnded(); |
116 void OnVideoRendererEnded(); | 116 void OnVideoRendererEnded(); |
117 bool PlaybackHasEnded() const; | 117 bool PlaybackHasEnded() const; |
118 void RunEndedCallbackIfNeeded(); | 118 void RunEndedCallbackIfNeeded(); |
119 | 119 |
120 // Callback executed when a runtime error happens. | 120 // Callback executed when a runtime error happens. |
121 void OnError(PipelineStatus error); | 121 void OnError(PipelineStatus error); |
122 | 122 |
123 void FireAllPendingCallbacks(); | |
124 | |
125 State state_; | 123 State state_; |
126 | 124 |
127 // Task runner used to execute pipeline tasks. | 125 // Task runner used to execute pipeline tasks. |
128 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
129 | 127 |
130 DemuxerStreamProvider* demuxer_stream_provider_; | 128 DemuxerStreamProvider* demuxer_stream_provider_; |
131 | 129 |
132 // Permanent callbacks to notify various renderer states/stats. | 130 // Permanent callbacks to notify various renderer states/stats. |
133 StatisticsCB statistics_cb_; | 131 StatisticsCB statistics_cb_; |
134 base::Closure ended_cb_; | 132 base::Closure ended_cb_; |
135 PipelineStatusCB error_cb_; | 133 PipelineStatusCB error_cb_; |
136 BufferingStateCB buffering_state_cb_; | 134 BufferingStateCB buffering_state_cb_; |
137 PaintCB paint_cb_; | 135 PaintCB paint_cb_; |
138 | 136 |
139 // Temporary callback used for Initialize() and Flush(). | 137 // Temporary callback used for Initialize() and Flush(). |
140 base::Closure init_cb_; | 138 PipelineStatusCB init_cb_; |
141 base::Closure flush_cb_; | 139 base::Closure flush_cb_; |
142 | 140 |
143 scoped_ptr<AudioRenderer> audio_renderer_; | 141 scoped_ptr<AudioRenderer> audio_renderer_; |
144 scoped_ptr<VideoRenderer> video_renderer_; | 142 scoped_ptr<VideoRenderer> video_renderer_; |
145 | 143 |
146 // Renderer-provided time source used to control playback. | 144 // Renderer-provided time source used to control playback. |
147 TimeSource* time_source_; | 145 TimeSource* time_source_; |
148 scoped_ptr<WallClockTimeSource> wall_clock_time_source_; | 146 scoped_ptr<WallClockTimeSource> wall_clock_time_source_; |
149 bool time_ticking_; | 147 bool time_ticking_; |
150 | 148 |
(...skipping 22 matching lines...) Expand all Loading... |
173 | 171 |
174 base::WeakPtr<RendererImpl> weak_this_; | 172 base::WeakPtr<RendererImpl> weak_this_; |
175 base::WeakPtrFactory<RendererImpl> weak_factory_; | 173 base::WeakPtrFactory<RendererImpl> weak_factory_; |
176 | 174 |
177 DISALLOW_COPY_AND_ASSIGN(RendererImpl); | 175 DISALLOW_COPY_AND_ASSIGN(RendererImpl); |
178 }; | 176 }; |
179 | 177 |
180 } // namespace media | 178 } // namespace media |
181 | 179 |
182 #endif // MEDIA_FILTERS_RENDERER_IMPL_H_ | 180 #endif // MEDIA_FILTERS_RENDERER_IMPL_H_ |
OLD | NEW |