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

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

Issue 11316045: Add a libvpx video decoder to ClearKeyCdm and move the fake video decoder to its own class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up, and deal with some of the preprocessor evil in ClearKeyCdm. Created 8 years, 1 month 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/libvpx_cdm_video_decoder.h
diff --git a/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..2dc628d9719ea5b3e9bac0bc79a9ca311b5ce6b5
--- /dev/null
+++ b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h
@@ -0,0 +1,54 @@
+// 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_LIBVPX_CDM_VIDEO_DECODER_H_
+#define WEBKIT_MEDIA_CRYPTO_PPAPI_LIBVPX_CDM_VIDEO_DECODER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "webkit/media/crypto/ppapi/cdm_video_decoder.h"
+#include "webkit/media/crypto/ppapi/content_decryption_module.h"
+
+typedef struct vpx_codec_ctx vpx_codec_ctx_t;
ddorwin 2012/11/17 02:56:22 Why? There should at least be a comment.
Tom Finegan 2012/11/17 04:35:06 Switched weird looking duplicate typedefs to norma
+typedef struct vpx_image vpx_image_t;
+
+namespace webkit_media {
+
+class LibvpxCdmVideoDecoder : public CdmVideoDecoder {
+ public:
+ explicit LibvpxCdmVideoDecoder(cdm::Allocator* allocator);
+ virtual ~LibvpxCdmVideoDecoder();
+
+ // CdmVideoDecoder implementation.
+ virtual bool Initialize(const cdm::VideoDecoderConfig& config) OVERRIDE;
+ virtual void Deinitialize() OVERRIDE;
+ virtual void Reset() OVERRIDE;
+ virtual cdm::Status DecodeFrame(const uint8_t* compressed_frame,
+ int32_t compressed_frame_size,
+ int64_t timestamp,
+ cdm::VideoFrame* decoded_frame) OVERRIDE;
+
+ // Returns true when |format| and |data_size| specify a supported video
+ // output configuration.
+ static bool IsValidOutputConfig(cdm::VideoFormat format,
+ const cdm::Size& data_size);
+
+ private:
+ // Allocates storage, then copies video frame stored in |vpx_image_| to
+ // |cdm_video_frame|. Returns true when allocation and copy succeed.
+ bool CopyVpxImageTo(cdm::VideoFrame* cdm_video_frame);
+
+ bool is_initialized_;
+
+ cdm::Allocator* const allocator_;
+
+ vpx_codec_ctx_t* vpx_codec_;
+ vpx_image_t* vpx_image_;
+
+ DISALLOW_COPY_AND_ASSIGN(LibvpxCdmVideoDecoder);
+};
+
+} // namespace webkit_media
+
+#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_LIBVPX_CDM_VIDEO_DECODER_H_

Powered by Google App Engine
This is Rietveld 408576698