diff options
Diffstat (limited to 'media/video/ffmpeg_video_decode_engine.h')
-rw-r--r-- | media/video/ffmpeg_video_decode_engine.h | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/media/video/ffmpeg_video_decode_engine.h b/media/video/ffmpeg_video_decode_engine.h index 3ac7411..072507a 100644 --- a/media/video/ffmpeg_video_decode_engine.h +++ b/media/video/ffmpeg_video_decode_engine.h @@ -5,13 +5,9 @@ #ifndef MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ #define MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ -#include <deque> - -#include "base/memory/scoped_ptr.h" -#include "media/ffmpeg/ffmpeg_common.h" +#include "base/compiler_specific.h" #include "media/video/video_decode_engine.h" -// FFmpeg types. struct AVCodecContext; struct AVFrame; @@ -22,47 +18,26 @@ class MEDIA_EXPORT FFmpegVideoDecodeEngine : public VideoDecodeEngine { FFmpegVideoDecodeEngine(); virtual ~FFmpegVideoDecodeEngine(); - // Implementation of the VideoDecodeEngine Interface. - virtual void Initialize(VideoDecodeEngine::EventHandler* event_handler, - const VideoDecoderConfig& config); - virtual void ConsumeVideoSample(scoped_refptr<Buffer> buffer); - virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame); - virtual void Uninitialize(); - virtual void Flush(); - virtual void Seek(); + // VideoDecodeEngine implementation. + virtual bool Initialize(const VideoDecoderConfig& config) OVERRIDE; + virtual void Uninitialize() OVERRIDE; + virtual bool Decode(const scoped_refptr<Buffer>& buffer, + scoped_refptr<VideoFrame>* video_frame) OVERRIDE; + virtual void Flush() OVERRIDE; private: - void DecodeFrame(scoped_refptr<Buffer> buffer); - void ReadInput(); - void TryToFinishPendingFlush(); + // Allocates a video frame based on the current format and dimensions based on + // the current state of |codec_context_|. + scoped_refptr<VideoFrame> AllocateVideoFrame(); + // FFmpeg structures owned by this object. AVCodecContext* codec_context_; - scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame_; - VideoDecodeEngine::EventHandler* event_handler_; + AVFrame* av_frame_; // Frame rate of the video. int frame_rate_numerator_; int frame_rate_denominator_; - // Indicate how many buffers are pending on input port of this filter: - // Increment when engine receive one input packet from demuxer; - // Decrement when engine send one input packet to demuxer; - int pending_input_buffers_; - - // Indicate how many buffers are pending on output port of this filter: - // Increment when engine receive one output frame from renderer; - // Decrement when engine send one output frame to renderer; - int pending_output_buffers_; - - // Whether end of stream had been reached at output side. - bool output_eos_reached_; - - // Used when direct rendering is disabled to hold available output buffers. - std::deque<scoped_refptr<VideoFrame> > frame_queue_available_; - - // Whether flush operation is pending. - bool flush_pending_; - DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecodeEngine); }; |