Chromium Code Reviews| 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 #ifndef MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ | 5 #ifndef MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ |
| 6 #define MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ | 6 #define MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include "base/compiler_specific.h" |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "media/ffmpeg/ffmpeg_common.h" | |
| 12 #include "media/video/video_decode_engine.h" | 9 #include "media/video/video_decode_engine.h" |
| 13 | 10 |
| 14 // FFmpeg types. | |
| 15 struct AVCodecContext; | 11 struct AVCodecContext; |
| 16 struct AVFrame; | 12 struct AVFrame; |
| 17 | 13 |
| 18 namespace media { | 14 namespace media { |
| 19 | 15 |
| 20 class MEDIA_EXPORT FFmpegVideoDecodeEngine : public VideoDecodeEngine { | 16 class MEDIA_EXPORT FFmpegVideoDecodeEngine : public VideoDecodeEngine { |
| 21 public: | 17 public: |
| 22 FFmpegVideoDecodeEngine(); | 18 FFmpegVideoDecodeEngine(); |
| 23 virtual ~FFmpegVideoDecodeEngine(); | 19 virtual ~FFmpegVideoDecodeEngine(); |
| 24 | 20 |
| 25 // Implementation of the VideoDecodeEngine Interface. | 21 // VideoDecodeEngine implementation. |
| 26 virtual void Initialize(VideoDecodeEngine::EventHandler* event_handler, | 22 virtual bool Initialize(const VideoDecoderConfig& config) OVERRIDE; |
| 27 const VideoDecoderConfig& config); | 23 virtual void Uninitialize() OVERRIDE; |
| 28 virtual void ConsumeVideoSample(scoped_refptr<Buffer> buffer); | 24 virtual bool Decode(scoped_refptr<Buffer> buffer, |
| 29 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame); | 25 scoped_refptr<VideoFrame>* video_frame) OVERRIDE; |
| 30 virtual void Uninitialize(); | 26 virtual void Flush() OVERRIDE; |
| 31 virtual void Flush(); | |
| 32 virtual void Seek(); | |
| 33 | 27 |
| 34 private: | 28 private: |
| 35 void DecodeFrame(scoped_refptr<Buffer> buffer); | 29 // Reallocates the video frame if format or dimensions differ. |
|
Ami GONE FROM CHROMIUM
2011/11/01 22:17:40
I think "differ" here refers to a mismatch between
scherkus (not reviewing)
2011/11/03 04:55:59
since we're no longer attempting to do buffer recy
| |
| 36 void ReadInput(); | 30 void ReallocateVideoFrameIfNecessary(scoped_refptr<VideoFrame>* video_frame); |
| 37 void TryToFinishPendingFlush(); | |
| 38 | 31 |
| 39 AVCodecContext* codec_context_; | 32 AVCodecContext* codec_context_; |
|
Ami GONE FROM CHROMIUM
2011/11/01 22:17:40
Add ownership comments?
scherkus (not reviewing)
2011/11/03 04:55:59
Done.
| |
| 40 scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame_; | 33 AVFrame* av_frame_; |
| 41 VideoDecodeEngine::EventHandler* event_handler_; | |
| 42 | 34 |
| 43 // Frame rate of the video. | 35 // Frame rate of the video. |
| 44 int frame_rate_numerator_; | 36 int frame_rate_numerator_; |
| 45 int frame_rate_denominator_; | 37 int frame_rate_denominator_; |
| 46 | 38 |
| 47 // Indicate how many buffers are pending on input port of this filter: | |
| 48 // Increment when engine receive one input packet from demuxer; | |
| 49 // Decrement when engine send one input packet to demuxer; | |
| 50 int pending_input_buffers_; | |
| 51 | |
| 52 // Indicate how many buffers are pending on output port of this filter: | |
| 53 // Increment when engine receive one output frame from renderer; | |
| 54 // Decrement when engine send one output frame to renderer; | |
| 55 int pending_output_buffers_; | |
| 56 | |
| 57 // Whether end of stream had been reached at output side. | |
| 58 bool output_eos_reached_; | |
| 59 | |
| 60 // Used when direct rendering is disabled to hold available output buffers. | |
| 61 std::deque<scoped_refptr<VideoFrame> > frame_queue_available_; | |
| 62 | |
| 63 // Whether flush operation is pending. | |
| 64 bool flush_pending_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecodeEngine); | 39 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecodeEngine); |
| 67 }; | 40 }; |
| 68 | 41 |
| 69 } // namespace media | 42 } // namespace media |
| 70 | 43 |
| 71 #endif // MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ | 44 #endif // MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ |
| OLD | NEW |