Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1051)

Side by Side Diff: media/video/ffmpeg_video_decode_engine.h

Issue 8417019: Simplify VideoDecodeEngine interface by making everything synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for CaptureVideoDecoder Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/media.gyp ('k') | media/video/ffmpeg_video_decode_engine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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(const 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 // Allocates a video frame based on the current format and dimensions based on
36 void ReadInput(); 30 // the current state of |codec_context_|.
37 void TryToFinishPendingFlush(); 31 scoped_refptr<VideoFrame> AllocateVideoFrame();
38 32
33 // FFmpeg structures owned by this object.
39 AVCodecContext* codec_context_; 34 AVCodecContext* codec_context_;
40 scoped_ptr_malloc<AVFrame, ScopedPtrAVFree> av_frame_; 35 AVFrame* av_frame_;
41 VideoDecodeEngine::EventHandler* event_handler_;
42 36
43 // Frame rate of the video. 37 // Frame rate of the video.
44 int frame_rate_numerator_; 38 int frame_rate_numerator_;
45 int frame_rate_denominator_; 39 int frame_rate_denominator_;
46 40
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); 41 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecodeEngine);
67 }; 42 };
68 43
69 } // namespace media 44 } // namespace media
70 45
71 #endif // MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_ 46 #endif // MEDIA_VIDEO_FFMPEG_VIDEO_DECODE_ENGINE_H_
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | media/video/ffmpeg_video_decode_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698