| 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 // 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // | 218 // |
| 219 // A NULL frame represents a decoding error. | 219 // A NULL frame represents a decoding error. |
| 220 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ConsumeVideoFrameCB; | 220 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ConsumeVideoFrameCB; |
| 221 void set_consume_video_frame_callback(const ConsumeVideoFrameCB& callback) { | 221 void set_consume_video_frame_callback(const ConsumeVideoFrameCB& callback) { |
| 222 consume_video_frame_callback_ = callback; | 222 consume_video_frame_callback_ = callback; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Indicate whether decoder provides its own output buffers | 225 // Indicate whether decoder provides its own output buffers |
| 226 virtual bool ProvidesBuffer() = 0; | 226 virtual bool ProvidesBuffer() = 0; |
| 227 | 227 |
| 228 // Returns the media format produced by this decoder. | 228 // Returns the width and height of decoded video in pixels. |
| 229 virtual const MediaFormat& media_format() = 0; | 229 // |
| 230 // Clients should NOT rely on these values to remain constant. Instead, use |
| 231 // the width/height from decoded video frames themselves. |
| 232 // |
| 233 // TODO(scherkus): why not rely on prerolling and decoding a single frame to |
| 234 // get dimensions? |
| 235 virtual int width() = 0; |
| 236 virtual int height() = 0; |
| 230 | 237 |
| 231 protected: | 238 protected: |
| 232 // Executes the permanent callback to pass off decoded video. | 239 // Executes the permanent callback to pass off decoded video. |
| 233 // | 240 // |
| 234 // TODO(scherkus): name this ConsumeVideoFrame() once we fix the TODO in | 241 // TODO(scherkus): name this ConsumeVideoFrame() once we fix the TODO in |
| 235 // VideoDecodeEngine::EventHandler to remove ConsumeVideoFrame() from there. | 242 // VideoDecodeEngine::EventHandler to remove ConsumeVideoFrame() from there. |
| 236 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { | 243 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { |
| 237 consume_video_frame_callback_.Run(frame); | 244 consume_video_frame_callback_.Run(frame); |
| 238 } | 245 } |
| 239 | 246 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // buffer. | 310 // buffer. |
| 304 virtual bool HasEnded() = 0; | 311 virtual bool HasEnded() = 0; |
| 305 | 312 |
| 306 // Sets the output volume. | 313 // Sets the output volume. |
| 307 virtual void SetVolume(float volume) = 0; | 314 virtual void SetVolume(float volume) = 0; |
| 308 }; | 315 }; |
| 309 | 316 |
| 310 } // namespace media | 317 } // namespace media |
| 311 | 318 |
| 312 #endif // MEDIA_BASE_FILTERS_H_ | 319 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |