Chromium Code Reviews| Index: media/filters/ffmpeg_video_decoder.h |
| diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h |
| index ef4797704580b72a0309981e15819db94602c36d..5b40699e1edde089956e7a55fbad331c1f13b75e 100644 |
| --- a/media/filters/ffmpeg_video_decoder.h |
| +++ b/media/filters/ffmpeg_video_decoder.h |
| @@ -7,9 +7,9 @@ |
| #include <deque> |
| +#include "base/memory/scoped_ptr.h" |
| #include "media/base/filters.h" |
| #include "media/base/pts_stream.h" |
| -#include "media/video/video_decode_engine.h" |
| #include "ui/gfx/size.h" |
| class MessageLoop; |
| @@ -18,9 +18,7 @@ namespace media { |
| class VideoDecodeEngine; |
| -class MEDIA_EXPORT FFmpegVideoDecoder |
| - : public VideoDecoder, |
| - public VideoDecodeEngine::EventHandler { |
| +class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
| public: |
| explicit FFmpegVideoDecoder(MessageLoop* message_loop); |
| virtual ~FFmpegVideoDecoder(); |
| @@ -35,62 +33,42 @@ class MEDIA_EXPORT FFmpegVideoDecoder |
| virtual void Initialize(DemuxerStream* demuxer_stream, |
| const base::Closure& callback, |
| const StatisticsCallback& stats_callback) OVERRIDE; |
| - virtual void ProduceVideoFrame( |
| - scoped_refptr<VideoFrame> video_frame) OVERRIDE; |
| + virtual void Read(const ReadCB& callback) OVERRIDE; |
| virtual gfx::Size natural_size() OVERRIDE; |
| private: |
| - // VideoDecodeEngine::EventHandler interface. |
| - virtual void OnInitializeComplete(bool success) OVERRIDE; |
| - virtual void OnUninitializeComplete() OVERRIDE; |
| - virtual void OnFlushComplete() OVERRIDE; |
| - virtual void OnSeekComplete() OVERRIDE; |
| - virtual void OnError() OVERRIDE; |
| - virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer) OVERRIDE; |
| - virtual void ConsumeVideoFrame( |
| - scoped_refptr<VideoFrame> frame, |
| - const PipelineStatistics& statistics) OVERRIDE; |
| - |
| enum DecoderState { |
| - kUnInitialized, |
| - kInitializing, |
| + kUninitialized, |
| kNormal, |
| kFlushCodec, |
| kDecodeFinished, |
| - kPausing, |
| - kFlushing, |
| - kStopped |
| }; |
| - void OnFlushComplete(const base::Closure& callback); |
| - void OnSeekComplete(const base::Closure& callback); |
| + // Carries out the reading operation scheduled by Read(). |
| + void DoRead(const ReadCB& callback); |
| - // TODO(scherkus): There are two of these to keep read completions |
| - // asynchronous and media_unittests passing. Remove. |
| - void OnReadComplete(const scoped_refptr<Buffer>& buffer); |
| - void OnReadCompleteTask(const scoped_refptr<Buffer>& buffer); |
| + // Reads from the demuxer stream with corresponding callback method. |
| + void ReadFromDemuxerStream(); |
| + void DecodeBuffer(const scoped_refptr<Buffer>& buffer); |
| - // Flush the output buffers that we had held in Paused state. |
| - void FlushBuffers(); |
| + // Carries out the decoding operation scheduled by DecodeBuffer(). |
| + // |
| + // TODO(scherkus): mandate that DemuxerStream::Read() execute asynchronously |
|
acolwell GONE FROM CHROMIUM
2011/11/03 20:00:43
Will making Read() async really remove the need fo
scherkus (not reviewing)
2011/11/03 20:34:38
This TODO has been replaced w/ the TODO inside the
|
| + // so that a forced-task-repost isn't necessary. |
| + void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer); |
| - // Injection point for unittest to provide a mock engine. Takes ownership of |
| - // the provided engine. |
| - virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine); |
| + // Delivers the frame to |read_cb_| and resets the callback. |
| + void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); |
| MessageLoop* message_loop_; |
| - PtsStream pts_stream_; // Stream of presentation timestamps. |
| + PtsStream pts_stream_; |
| DecoderState state_; |
| scoped_ptr<VideoDecodeEngine> decode_engine_; |
| - base::Closure initialize_callback_; |
| - base::Closure uninitialize_callback_; |
| - base::Closure flush_callback_; |
| - FilterStatusCB seek_cb_; |
| StatisticsCallback statistics_callback_; |
| - // Hold video frames when flush happens. |
| - std::deque<scoped_refptr<VideoFrame> > frame_queue_flushed_; |
| + ReadCB read_cb_; |
| // TODO(scherkus): I think this should be calculated by VideoRenderers based |
| // on information provided by VideoDecoders (i.e., aspect ratio). |