| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "base/callback.h" | 29 #include "base/callback.h" |
| 30 #include "base/callback_old.h" | 30 #include "base/callback_old.h" |
| 31 #include "base/memory/ref_counted.h" | 31 #include "base/memory/ref_counted.h" |
| 32 #include "base/memory/scoped_ptr.h" | 32 #include "base/memory/scoped_ptr.h" |
| 33 #include "base/time.h" | 33 #include "base/time.h" |
| 34 #include "media/base/audio_decoder_config.h" | 34 #include "media/base/audio_decoder_config.h" |
| 35 #include "media/base/media_export.h" | 35 #include "media/base/media_export.h" |
| 36 #include "media/base/pipeline_status.h" | 36 #include "media/base/pipeline_status.h" |
| 37 #include "media/base/video_frame.h" | 37 #include "media/base/video_frame.h" |
| 38 #include "ui/gfx/size.h" |
| 38 | 39 |
| 39 namespace media { | 40 namespace media { |
| 40 | 41 |
| 41 class Buffer; | 42 class Buffer; |
| 42 class Decoder; | 43 class Decoder; |
| 43 class DemuxerStream; | 44 class DemuxerStream; |
| 44 class Filter; | 45 class Filter; |
| 45 class FilterHost; | 46 class FilterHost; |
| 46 | 47 |
| 47 struct PipelineStatistics; | 48 struct PipelineStatistics; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; | 174 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; |
| 174 | 175 |
| 175 // Installs a permanent callback for passing decoded video output. | 176 // Installs a permanent callback for passing decoded video output. |
| 176 // | 177 // |
| 177 // A NULL frame represents a decoding error. | 178 // A NULL frame represents a decoding error. |
| 178 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ConsumeVideoFrameCB; | 179 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ConsumeVideoFrameCB; |
| 179 void set_consume_video_frame_callback(const ConsumeVideoFrameCB& callback) { | 180 void set_consume_video_frame_callback(const ConsumeVideoFrameCB& callback) { |
| 180 consume_video_frame_callback_ = callback; | 181 consume_video_frame_callback_ = callback; |
| 181 } | 182 } |
| 182 | 183 |
| 183 // Returns the width and height of decoded video in pixels. | 184 // Returns the natural width and height of decoded video in pixels. |
| 184 // | 185 // |
| 185 // Clients should NOT rely on these values to remain constant. Instead, use | 186 // Clients should NOT rely on these values to remain constant. Instead, use |
| 186 // the width/height from decoded video frames themselves. | 187 // the width/height from decoded video frames themselves. |
| 187 // | 188 // |
| 188 // TODO(scherkus): why not rely on prerolling and decoding a single frame to | 189 // TODO(scherkus): why not rely on prerolling and decoding a single frame to |
| 189 // get dimensions? | 190 // get dimensions? |
| 190 virtual int width() = 0; | 191 virtual gfx::Size natural_size() = 0; |
| 191 virtual int height() = 0; | |
| 192 | 192 |
| 193 protected: | 193 protected: |
| 194 // Executes the permanent callback to pass off decoded video. | 194 // Executes the permanent callback to pass off decoded video. |
| 195 // | 195 // |
| 196 // TODO(scherkus): name this ConsumeVideoFrame() once we fix the TODO in | 196 // TODO(scherkus): name this ConsumeVideoFrame() once we fix the TODO in |
| 197 // VideoDecodeEngine::EventHandler to remove ConsumeVideoFrame() from there. | 197 // VideoDecodeEngine::EventHandler to remove ConsumeVideoFrame() from there. |
| 198 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { | 198 void VideoFrameReady(scoped_refptr<VideoFrame> frame) { |
| 199 consume_video_frame_callback_.Run(frame); | 199 consume_video_frame_callback_.Run(frame); |
| 200 } | 200 } |
| 201 | 201 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // buffer. | 265 // buffer. |
| 266 virtual bool HasEnded() = 0; | 266 virtual bool HasEnded() = 0; |
| 267 | 267 |
| 268 // Sets the output volume. | 268 // Sets the output volume. |
| 269 virtual void SetVolume(float volume) = 0; | 269 virtual void SetVolume(float volume) = 0; |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 } // namespace media | 272 } // namespace media |
| 273 | 273 |
| 274 #endif // MEDIA_BASE_FILTERS_H_ | 274 #endif // MEDIA_BASE_FILTERS_H_ |
| OLD | NEW |