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

Unified Diff: media/filters/vpx_video_decoder.h

Issue 12045060: Add wrapper class to media for support of VP9 video, and add a command line flag to enable the supp… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add EoS DCHECK in VpxVideoDecoder::Decode(). Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/vpx_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/vpx_video_decoder.h
diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/vpx_video_decoder.h
similarity index 59%
copy from media/filters/ffmpeg_video_decoder.h
copy to media/filters/vpx_video_decoder.h
index e26a1943d7aa0859a533f1e45621c73ec1aa9a02..77578fdc90f7e6c82de90090cadff43857e1a886 100644
--- a/media/filters/ffmpeg_video_decoder.h
+++ b/media/filters/vpx_video_decoder.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
-#define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
+#ifndef MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
+#define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "media/base/demuxer_stream.h"
#include "media/base/video_decoder.h"
-struct AVCodecContext;
-struct AVFrame;
+struct vpx_codec_ctx;
+struct vpx_image;
namespace base {
class MessageLoopProxy;
@@ -19,11 +19,9 @@ class MessageLoopProxy;
namespace media {
-class DecoderBuffer;
-
-class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
+class MEDIA_EXPORT VpxVideoDecoder : public VideoDecoder {
public:
- explicit FFmpegVideoDecoder(
+ explicit VpxVideoDecoder(
const scoped_refptr<base::MessageLoopProxy>& message_loop);
// VideoDecoder implementation.
@@ -34,13 +32,8 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
virtual void Reset(const base::Closure& closure) OVERRIDE;
virtual void Stop(const base::Closure& closure) OVERRIDE;
- // Callback called from within FFmpeg to allocate a buffer based on
- // the dimensions of |codec_context|. See AVCodecContext.get_buffer
- // documentation inside FFmpeg.
- int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame);
-
protected:
- virtual ~FFmpegVideoDecoder();
+ virtual ~VpxVideoDecoder();
private:
enum DecoderState {
@@ -50,46 +43,44 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
kDecodeFinished
};
- // Reads from the demuxer stream and corresponding read callback.
+ // Handles (re-)initializing the decoder with a (new) config.
+ // Returns true when initialization was successful.
+ bool ConfigureDecoder();
+
+ void CloseDecoder();
void ReadFromDemuxerStream();
- void BufferReady(DemuxerStream::Status status,
- const scoped_refptr<DecoderBuffer>& buffer);
- // Handles decoding an unencrypted encoded buffer.
+ // Carries out the buffer processing operation scheduled by
+ // DecryptOrDecodeBuffer().
+ void DoDecryptOrDecodeBuffer(DemuxerStream::Status status,
+ const scoped_refptr<DecoderBuffer>& buffer);
+
void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer);
bool Decode(const scoped_refptr<DecoderBuffer>& buffer,
scoped_refptr<VideoFrame>* video_frame);
- // Handles (re-)initializing the decoder with a (new) config.
- // Returns true if initialization was successful.
- bool ConfigureDecoder();
-
- // Releases resources associated with |codec_context_| and |av_frame_|
- // and resets them to NULL.
- void ReleaseFFmpegResources();
-
// Reset decoder and call |reset_cb_|.
void DoReset();
+ void CopyVpxImageTo(const vpx_image* vpx_image,
+ scoped_refptr<VideoFrame>* video_frame);
+
scoped_refptr<base::MessageLoopProxy> message_loop_;
DecoderState state_;
StatisticsCB statistics_cb_;
-
ReadCB read_cb_;
base::Closure reset_cb_;
- // FFmpeg structures owned by this object.
- AVCodecContext* codec_context_;
- AVFrame* av_frame_;
-
// Pointer to the demuxer stream that will feed us compressed buffers.
scoped_refptr<DemuxerStream> demuxer_stream_;
- DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
+ vpx_codec_ctx* vpx_codec_;
+
+ DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder);
};
} // namespace media
-#endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
+#endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/vpx_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698