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

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

Issue 10451051: Provide a Chrome-owned buffer to FFmpeg for video decoding, instead of (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('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 <deque> 8 #include <deque>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 20 matching lines...) Expand all
31 const StatisticsCB& statistics_cb) OVERRIDE; 31 const StatisticsCB& statistics_cb) OVERRIDE;
32 virtual void Read(const ReadCB& read_cb) OVERRIDE; 32 virtual void Read(const ReadCB& read_cb) OVERRIDE;
33 virtual void Reset(const base::Closure& closure) OVERRIDE; 33 virtual void Reset(const base::Closure& closure) OVERRIDE;
34 virtual void Stop(const base::Closure& closure) OVERRIDE; 34 virtual void Stop(const base::Closure& closure) OVERRIDE;
35 virtual const gfx::Size& natural_size() OVERRIDE; 35 virtual const gfx::Size& natural_size() OVERRIDE;
36 36
37 // Must be called prior to initialization if decrypted buffers will be 37 // Must be called prior to initialization if decrypted buffers will be
38 // encountered. 38 // encountered.
39 void set_decryptor(AesDecryptor* decryptor); 39 void set_decryptor(AesDecryptor* decryptor);
40 40
41 // Callback called from within FFmpeg to allocate a buffer based on
42 // the dimensions of |codec_context|. See AVCodecContext.get_buffer
43 // documentation inside FFmpeg.
44 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame);
45
41 protected: 46 protected:
42 virtual ~FFmpegVideoDecoder(); 47 virtual ~FFmpegVideoDecoder();
43 48
44 private: 49 private:
45 enum DecoderState { 50 enum DecoderState {
46 kUninitialized, 51 kUninitialized,
47 kNormal, 52 kNormal,
48 kFlushCodec, 53 kFlushCodec,
49 kDecodeFinished, 54 kDecodeFinished,
50 }; 55 };
(...skipping 13 matching lines...) Expand all
64 // Delivers the frame to |read_cb_| and resets the callback. 69 // Delivers the frame to |read_cb_| and resets the callback.
65 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); 70 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);
66 71
67 // Releases resources associated with |codec_context_| and |av_frame_| 72 // Releases resources associated with |codec_context_| and |av_frame_|
68 // and resets them to NULL. 73 // and resets them to NULL.
69 void ReleaseFFmpegResources(); 74 void ReleaseFFmpegResources();
70 75
71 // Reset decoder and call |reset_cb_|. 76 // Reset decoder and call |reset_cb_|.
72 void DoReset(); 77 void DoReset();
73 78
74 // Allocates a video frame based on the current format and dimensions based on
75 // the current state of |codec_context_|.
76 scoped_refptr<VideoFrame> AllocateVideoFrame();
77
78 // This is !is_null() iff Initialize() hasn't been called. 79 // This is !is_null() iff Initialize() hasn't been called.
79 base::Callback<MessageLoop*()> message_loop_factory_cb_; 80 base::Callback<MessageLoop*()> message_loop_factory_cb_;
80 81
81 MessageLoop* message_loop_; 82 MessageLoop* message_loop_;
82 83
83 DecoderState state_; 84 DecoderState state_;
84 85
85 StatisticsCB statistics_cb_; 86 StatisticsCB statistics_cb_;
86 87
87 ReadCB read_cb_; 88 ReadCB read_cb_;
(...skipping 15 matching lines...) Expand all
103 scoped_refptr<DemuxerStream> demuxer_stream_; 104 scoped_refptr<DemuxerStream> demuxer_stream_;
104 105
105 AesDecryptor* decryptor_; 106 AesDecryptor* decryptor_;
106 107
107 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 108 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
108 }; 109 };
109 110
110 } // namespace media 111 } // namespace media
111 112
112 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 113 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698