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

Unified Diff: media/filters/vpx_video_decoder.h

Issue 11468018: Add libvpx wrapper to media to support VP9 video decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add work around for lack of VP9 in ffmpeg. Created 8 years 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
Index: media/filters/vpx_video_decoder.h
diff --git a/media/filters/vpx_video_decoder.h b/media/filters/vpx_video_decoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..77578fdc90f7e6c82de90090cadff43857e1a886
--- /dev/null
+++ b/media/filters/vpx_video_decoder.h
@@ -0,0 +1,86 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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 vpx_codec_ctx;
+struct vpx_image;
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace media {
+
+class MEDIA_EXPORT VpxVideoDecoder : public VideoDecoder {
+ public:
+ explicit VpxVideoDecoder(
+ const scoped_refptr<base::MessageLoopProxy>& message_loop);
+
+ // VideoDecoder implementation.
+ virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
+ const PipelineStatusCB& status_cb,
+ const StatisticsCB& statistics_cb) OVERRIDE;
+ virtual void Read(const ReadCB& read_cb) OVERRIDE;
+ virtual void Reset(const base::Closure& closure) OVERRIDE;
+ virtual void Stop(const base::Closure& closure) OVERRIDE;
+
+ protected:
+ virtual ~VpxVideoDecoder();
+
+ private:
+ enum DecoderState {
+ kUninitialized,
+ kNormal,
+ kFlushCodec,
+ kDecodeFinished
+ };
+
+ // Handles (re-)initializing the decoder with a (new) config.
+ // Returns true when initialization was successful.
+ bool ConfigureDecoder();
+
+ void CloseDecoder();
+ void ReadFromDemuxerStream();
+
+ // 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);
+
+ // 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_;
+
+ // Pointer to the demuxer stream that will feed us compressed buffers.
+ scoped_refptr<DemuxerStream> demuxer_stream_;
+
+ vpx_codec_ctx* vpx_codec_;
+
+ DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_

Powered by Google App Engine
This is Rietveld 408576698