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

Side by Side Diff: media/filters/ffmpeg_video_decoder.h

Issue 331863004: Revert 276344 "Add callback in VideoDecoder and AudioDecoder to ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2049/src/
Patch Set: Created 6 years, 6 months 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/filters/ffmpeg_audio_decoder_unittest.cc ('k') | media/filters/ffmpeg_video_decoder.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILTERS_FFMPEG_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 20 matching lines...) Expand all
31 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 31 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
32 virtual ~FFmpegVideoDecoder(); 32 virtual ~FFmpegVideoDecoder();
33 33
34 // Allow decoding of individual NALU. Entire frames are required by default. 34 // Allow decoding of individual NALU. Entire frames are required by default.
35 // Disables low-latency mode. Must be called before Initialize(). 35 // Disables low-latency mode. Must be called before Initialize().
36 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; } 36 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; }
37 37
38 // VideoDecoder implementation. 38 // VideoDecoder implementation.
39 virtual void Initialize(const VideoDecoderConfig& config, 39 virtual void Initialize(const VideoDecoderConfig& config,
40 bool low_delay, 40 bool low_delay,
41 const PipelineStatusCB& status_cb, 41 const PipelineStatusCB& status_cb) OVERRIDE;
42 const OutputCB& output_cb) OVERRIDE;
43 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 42 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
44 const DecodeCB& decode_cb) OVERRIDE; 43 const DecodeCB& decode_cb) OVERRIDE;
45 virtual void Reset(const base::Closure& closure) OVERRIDE; 44 virtual void Reset(const base::Closure& closure) OVERRIDE;
46 virtual void Stop() OVERRIDE; 45 virtual void Stop() OVERRIDE;
47 46
48 // Callback called from within FFmpeg to allocate a buffer based on 47 // Callback called from within FFmpeg to allocate a buffer based on
49 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2 48 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2
50 // documentation inside FFmpeg. 49 // documentation inside FFmpeg.
51 int GetVideoBuffer(struct AVCodecContext* codec_context, 50 int GetVideoBuffer(struct AVCodecContext* codec_context,
52 AVFrame* frame, 51 AVFrame* frame,
53 int flags); 52 int flags);
54 53
55 private: 54 private:
56 enum DecoderState { 55 enum DecoderState {
57 kUninitialized, 56 kUninitialized,
58 kNormal, 57 kNormal,
58 kFlushCodec,
59 kDecodeFinished, 59 kDecodeFinished,
60 kError 60 kError
61 }; 61 };
62 62
63 // Handles decoding an unencrypted encoded buffer. 63 // Handles decoding an unencrypted encoded buffer.
64 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer);
64 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer, 65 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer,
65 bool* produced_frame); 66 scoped_refptr<VideoFrame>* video_frame);
66 67
67 // Handles (re-)initializing the decoder with a (new) config. 68 // Handles (re-)initializing the decoder with a (new) config.
68 // Returns true if initialization was successful. 69 // Returns true if initialization was successful.
69 bool ConfigureDecoder(bool low_delay); 70 bool ConfigureDecoder(bool low_delay);
70 71
71 // Releases resources associated with |codec_context_| and |av_frame_| 72 // Releases resources associated with |codec_context_| and |av_frame_|
72 // and resets them to NULL. 73 // and resets them to NULL.
73 void ReleaseFFmpegResources(); 74 void ReleaseFFmpegResources();
74 75
75 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
76 77
77 DecoderState state_; 78 DecoderState state_;
78 79
79 OutputCB output_cb_; 80 // TODO(xhwang): Merge DecodeBuffer() into Decode() and remove this.
81 DecodeCB decode_cb_;
80 82
81 // FFmpeg structures owned by this object. 83 // FFmpeg structures owned by this object.
82 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 84 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
83 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 85 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
84 86
85 VideoDecoderConfig config_; 87 VideoDecoderConfig config_;
86 88
87 VideoFramePool frame_pool_; 89 VideoFramePool frame_pool_;
88 90
89 bool decode_nalus_; 91 bool decode_nalus_;
90 92
91 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 93 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
92 }; 94 };
93 95
94 } // namespace media 96 } // namespace media
95 97
96 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 98 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder_unittest.cc ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698