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 // Filters are connected in a strongly typed manner, with downstream filters | 5 // Filters are connected in a strongly typed manner, with downstream filters |
6 // always reading data from upstream filters. Upstream filters have no clue | 6 // always reading data from upstream filters. Upstream filters have no clue |
7 // who is actually reading from them, and return the results via callbacks. | 7 // who is actually reading from them, and return the results via callbacks. |
8 // | 8 // |
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer | 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer |
10 // DataSource <- Demuxer < | 10 // DataSource <- Demuxer < |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its | 152 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its |
153 // filters, waiting for each state transition to complete before starting the | 153 // filters, waiting for each state transition to complete before starting the |
154 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for | 154 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for |
155 // the duration. Default implementation does nothing; derived decoders may | 155 // the duration. Default implementation does nothing; derived decoders may |
156 // override as needed. http://crbug.com/110228 tracks removing this. | 156 // override as needed. http://crbug.com/110228 tracks removing this. |
157 virtual void PrepareForShutdownHack(); | 157 virtual void PrepareForShutdownHack(); |
158 | 158 |
159 protected: | 159 protected: |
160 VideoDecoder(); | 160 VideoDecoder(); |
161 virtual ~VideoDecoder(); | 161 virtual ~VideoDecoder(); |
| 162 |
| 163 private: |
| 164 // These functions will be removed later. Declare here to make sure they are |
| 165 // not called from VideoDecoder interface anymore. |
| 166 // TODO(xhwang): Remove them when VideoDecoder is not a Filter any more. |
| 167 // See bug: crbug.com/108340 |
| 168 virtual void Play(const base::Closure& callback) OVERRIDE; |
| 169 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 170 virtual void Seek(base::TimeDelta time, |
| 171 const PipelineStatusCB& callback) OVERRIDE; |
162 }; | 172 }; |
163 | 173 |
164 | |
165 class MEDIA_EXPORT VideoRenderer : public Filter { | 174 class MEDIA_EXPORT VideoRenderer : public Filter { |
166 public: | 175 public: |
167 // Used to update the pipeline's clock time. The parameter is the time that | 176 // Used to update the pipeline's clock time. The parameter is the time that |
168 // the clock should not exceed. | 177 // the clock should not exceed. |
169 typedef base::Callback<void(base::TimeDelta)> TimeCB; | 178 typedef base::Callback<void(base::TimeDelta)> TimeCB; |
170 | 179 |
171 // Initialize a VideoRenderer with the given VideoDecoder, executing the | 180 // Initialize a VideoRenderer with the given VideoDecoder, executing the |
172 // callback upon completion. | 181 // callback upon completion. |
173 virtual void Initialize(VideoDecoder* decoder, | 182 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder, |
174 const PipelineStatusCB& status_cb, | 183 const PipelineStatusCB& status_cb, |
175 const StatisticsCB& statistics_cb, | 184 const StatisticsCB& statistics_cb, |
176 const TimeCB& time_cb) = 0; | 185 const TimeCB& time_cb) = 0; |
177 | 186 |
178 // Returns true if this filter has received and processed an end-of-stream | 187 // Returns true if this filter has received and processed an end-of-stream |
179 // buffer. | 188 // buffer. |
180 virtual bool HasEnded() = 0; | 189 virtual bool HasEnded() = 0; |
181 }; | 190 }; |
182 | 191 |
183 | |
184 class MEDIA_EXPORT AudioRenderer : public Filter { | 192 class MEDIA_EXPORT AudioRenderer : public Filter { |
185 public: | 193 public: |
186 // Used to update the pipeline's clock time. The first parameter is the | 194 // Used to update the pipeline's clock time. The first parameter is the |
187 // current time, and the second parameter is the time that the clock must not | 195 // current time, and the second parameter is the time that the clock must not |
188 // exceed. | 196 // exceed. |
189 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; | 197 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; |
190 | 198 |
191 // Initialize a AudioRenderer with the given AudioDecoder, executing the | 199 // Initialize a AudioRenderer with the given AudioDecoder, executing the |
192 // |init_cb| upon completion. |underflow_cb| is called when the | 200 // |init_cb| upon completion. |underflow_cb| is called when the |
193 // renderer runs out of data to pass to the audio card during playback. | 201 // renderer runs out of data to pass to the audio card during playback. |
(...skipping 14 matching lines...) Expand all Loading... |
208 | 216 |
209 // Resumes playback after underflow occurs. | 217 // Resumes playback after underflow occurs. |
210 // |buffer_more_audio| is set to true if you want to increase the size of the | 218 // |buffer_more_audio| is set to true if you want to increase the size of the |
211 // decoded audio buffer. | 219 // decoded audio buffer. |
212 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; | 220 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
213 }; | 221 }; |
214 | 222 |
215 } // namespace media | 223 } // namespace media |
216 | 224 |
217 #endif // MEDIA_BASE_FILTERS_H_ | 225 #endif // MEDIA_BASE_FILTERS_H_ |
OLD | NEW |