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

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
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 19 matching lines...) Expand all
30 const StatisticsCB& statistics_cb) OVERRIDE; 30 const StatisticsCB& statistics_cb) OVERRIDE;
31 virtual void Read(const ReadCB& read_cb) OVERRIDE; 31 virtual void Read(const ReadCB& read_cb) OVERRIDE;
32 virtual void Reset(const base::Closure& closure) OVERRIDE; 32 virtual void Reset(const base::Closure& closure) OVERRIDE;
33 virtual void Stop(const base::Closure& closure) OVERRIDE; 33 virtual void Stop(const base::Closure& closure) OVERRIDE;
34 virtual const gfx::Size& natural_size() OVERRIDE; 34 virtual const gfx::Size& natural_size() OVERRIDE;
35 35
36 // Must be called prior to initialization if decrypted buffers will be 36 // Must be called prior to initialization if decrypted buffers will be
37 // encountered. 37 // encountered.
38 void set_decryptor(AesDecryptor* decryptor); 38 void set_decryptor(AesDecryptor* decryptor);
39 39
40 // Callback called from within FFmpeg to allocate a buffer based on
41 // the dimensions of |codec_context_|. See AVCodecContext.get_buffer
42 // documentation inside FFmpeg.
43 int GetVideoBuffer(AVFrame *frame);
scherkus (not reviewing) 2012/06/14 02:21:33 pointer w/ type
44
40 protected: 45 protected:
41 virtual ~FFmpegVideoDecoder(); 46 virtual ~FFmpegVideoDecoder();
42 47
43 private: 48 private:
44 enum DecoderState { 49 enum DecoderState {
45 kUninitialized, 50 kUninitialized,
46 kNormal, 51 kNormal,
47 kFlushCodec, 52 kFlushCodec,
48 kDecodeFinished, 53 kDecodeFinished,
49 }; 54 };
(...skipping 13 matching lines...) Expand all
63 // Delivers the frame to |read_cb_| and resets the callback. 68 // Delivers the frame to |read_cb_| and resets the callback.
64 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); 69 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);
65 70
66 // Releases resources associated with |codec_context_| and |av_frame_| 71 // Releases resources associated with |codec_context_| and |av_frame_|
67 // and resets them to NULL. 72 // and resets them to NULL.
68 void ReleaseFFmpegResources(); 73 void ReleaseFFmpegResources();
69 74
70 // Reset decoder and call |reset_cb_|. 75 // Reset decoder and call |reset_cb_|.
71 void DoReset(); 76 void DoReset();
72 77
73 // Allocates a video frame based on the current format and dimensions based on
74 // the current state of |codec_context_|.
75 scoped_refptr<VideoFrame> AllocateVideoFrame();
76
77 // This is !is_null() iff Initialize() hasn't been called. 78 // This is !is_null() iff Initialize() hasn't been called.
78 base::Callback<MessageLoop*()> message_loop_factory_cb_; 79 base::Callback<MessageLoop*()> message_loop_factory_cb_;
79 80
80 MessageLoop* message_loop_; 81 MessageLoop* message_loop_;
81 82
82 DecoderState state_; 83 DecoderState state_;
83 84
84 StatisticsCB statistics_cb_; 85 StatisticsCB statistics_cb_;
85 86
86 ReadCB read_cb_; 87 ReadCB read_cb_;
(...skipping 15 matching lines...) Expand all
102 scoped_refptr<DemuxerStream> demuxer_stream_; 103 scoped_refptr<DemuxerStream> demuxer_stream_;
103 104
104 AesDecryptor* decryptor_; 105 AesDecryptor* decryptor_;
105 106
106 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 107 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
107 }; 108 };
108 109
109 } // namespace media 110 } // namespace media
110 111
111 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 112 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698