OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Indicate whether decoder provides its own output buffers | 263 // Indicate whether decoder provides its own output buffers |
264 virtual bool ProvidesBuffer() = 0; | 264 virtual bool ProvidesBuffer() = 0; |
265 | 265 |
266 protected: | 266 protected: |
267 // A video frame is ready to be consumed. This method invoke | 267 // A video frame is ready to be consumed. This method invoke |
268 // |consume_video_frame_callback_| internally. | 268 // |consume_video_frame_callback_| internally. |
269 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { | 269 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { |
270 consume_video_frame_callback_->Run(frame); | 270 consume_video_frame_callback_->Run(frame); |
271 } | 271 } |
272 | 272 |
| 273 VideoDecoder(); |
| 274 virtual ~VideoDecoder(); |
| 275 |
273 private: | 276 private: |
274 scoped_ptr<ConsumeVideoFrameCallback> consume_video_frame_callback_; | 277 scoped_ptr<ConsumeVideoFrameCallback> consume_video_frame_callback_; |
275 }; | 278 }; |
276 | 279 |
277 | 280 |
278 class AudioDecoder : public MediaFilter { | 281 class AudioDecoder : public MediaFilter { |
279 public: | 282 public: |
280 static FilterType filter_type() { | 283 static FilterType filter_type() { |
281 return FILTER_AUDIO_DECODER; | 284 return FILTER_AUDIO_DECODER; |
282 } | 285 } |
(...skipping 19 matching lines...) Expand all Loading... |
302 } | 305 } |
303 ConsumeAudioSamplesCallback* consume_audio_samples_callback() { | 306 ConsumeAudioSamplesCallback* consume_audio_samples_callback() { |
304 return consume_audio_samples_callback_.get(); | 307 return consume_audio_samples_callback_.get(); |
305 } | 308 } |
306 | 309 |
307 // Renderer provides an output buffer for Decoder to write to. These buffers | 310 // Renderer provides an output buffer for Decoder to write to. These buffers |
308 // will be recycled to renderer by fill_buffer_done_callback_; | 311 // will be recycled to renderer by fill_buffer_done_callback_; |
309 // We could also pass empty pointer here to let decoder provide buffers pool. | 312 // We could also pass empty pointer here to let decoder provide buffers pool. |
310 virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer) = 0; | 313 virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer) = 0; |
311 | 314 |
| 315 protected: |
| 316 AudioDecoder(); |
| 317 ~AudioDecoder(); |
| 318 |
312 private: | 319 private: |
313 scoped_ptr<ConsumeAudioSamplesCallback> consume_audio_samples_callback_; | 320 scoped_ptr<ConsumeAudioSamplesCallback> consume_audio_samples_callback_; |
314 }; | 321 }; |
315 | 322 |
316 | 323 |
317 class VideoRenderer : public MediaFilter { | 324 class VideoRenderer : public MediaFilter { |
318 public: | 325 public: |
319 static FilterType filter_type() { | 326 static FilterType filter_type() { |
320 return FILTER_VIDEO_RENDERER; | 327 return FILTER_VIDEO_RENDERER; |
321 } | 328 } |
(...skipping 30 matching lines...) Expand all Loading... |
352 // buffer. | 359 // buffer. |
353 virtual bool HasEnded() = 0; | 360 virtual bool HasEnded() = 0; |
354 | 361 |
355 // Sets the output volume. | 362 // Sets the output volume. |
356 virtual void SetVolume(float volume) = 0; | 363 virtual void SetVolume(float volume) = 0; |
357 }; | 364 }; |
358 | 365 |
359 } // namespace media | 366 } // namespace media |
360 | 367 |
361 #endif // MEDIA_BASE_FILTERS_H_ | 368 #endif // MEDIA_BASE_FILTERS_H_ |
OLD | NEW |