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

Unified Diff: webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h

Issue 10899021: Add CDM video decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address more comments. Created 8 years, 2 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
Index: webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4c07a23ea5adb1666e992d28b75a81e7234a459
--- /dev/null
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
@@ -0,0 +1,60 @@
+// 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 WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_
+#define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "webkit/media/crypto/ppapi/content_decryption_module.h"
+
+struct AVCodecContext;
+struct AVFrame;
+
+namespace webkit_media {
+
+static const uint32_t kBufferAlignment = 32;
xhwang 2012/10/17 18:43:00 Move this to ffmpeg_cdm_video_frame.cc ?
Tom Finegan 2012/10/17 19:55:44 Done.
+static const uint32_t kBufferPadBytes = kBufferAlignment - 1;
xhwang 2012/10/17 18:43:00 Where is this used?
Tom Finegan 2012/10/17 19:55:44 From media, done.
+static const int kDecodeThreads = 1;
xhwang 2012/10/17 18:43:00 move this to ffmpeg_cdm_video_decoder.cc file?
Tom Finegan 2012/10/17 19:55:44 Done.
Tom Finegan 2012/10/17 19:55:44 Done.
+
+class FFmpegCdmVideoDecoder {
+ public:
+ FFmpegCdmVideoDecoder(cdm::Allocator* allocator);
+ ~FFmpegCdmVideoDecoder();
+ bool Initialize(const cdm::VideoDecoderConfig& config);
+ void Deinitialize();
+ void Reset();
+
+ // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and
+ // returns |cdm::kSuccess| when an output frame is available. Returns
+ // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output
+ // frame. Returns |cdm::kDecodeError| when decoding fails.
+ cdm::Status DecodeFrame(const uint8_t* compressed_frame,
+ int32_t compressed_frame_size,
+ int64_t timestamp,
+ cdm::VideoFrame* decoded_frame);
+
+ // 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);
+
+ private:
+ void ReleaseFFmpegResources();
+
+ // FFmpeg structures owned by this object.
+ AVCodecContext* codec_context_;
+ AVFrame* av_frame_;
+
+ bool is_initialized_;
+
+ cdm::Allocator* const allocator_;
+ cdm::VideoDecoderConfig config_;
+
+ DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder);
+};
+
+} // namespace webkit_media
+
+#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_

Powered by Google App Engine
This is Rietveld 408576698