summaryrefslogtreecommitdiffstats
path: root/media/crypto
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-04 19:02:02 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-04 19:02:02 +0000
commit95f5e3fddc416838a9c5fda8f57ccea058103978 (patch)
treea0482f27fe20e552abd6fa6bc340eb81320be034 /media/crypto
parent06b5cfe707e6e983b29f7338f9638d9a5e9ffc29 (diff)
downloadchromium_src-95f5e3fddc416838a9c5fda8f57ccea058103978.zip
chromium_src-95f5e3fddc416838a9c5fda8f57ccea058103978.tar.gz
chromium_src-95f5e3fddc416838a9c5fda8f57ccea058103978.tar.bz2
Add video decoding methods in Decryptor and add DecryptingVideoDecoder.
In Decryptor interface, video decoding methods are added to support CDMs that support both decryption and video decoding. A new VideoDecoder, DecryptingVideoDecoder, is added to support video decoding by Decryptors in the media pipeline. DecryptingVideoDecoder uses adapter pattern to convert a Decryptor into a VideoDecoder. In AddDefaultDecodersToCollection, add a DecryptingVideoDecoder object into the video decoder list. BUG=141784 TEST=new tests added into media_unittest Review URL: https://chromiumcodereview.appspot.com/10969028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/crypto')
-rw-r--r--media/crypto/aes_decryptor.cc23
-rw-r--r--media/crypto/aes_decryptor.h7
2 files changed, 30 insertions, 0 deletions
diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc
index df17333..5e41ea7 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -14,6 +14,8 @@
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
#include "media/base/decryptor_client.h"
+#include "media/base/video_decoder_config.h"
+#include "media/base/video_frame.h"
namespace media {
@@ -232,6 +234,27 @@ void AesDecryptor::Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
void AesDecryptor::CancelDecrypt() {
}
+void AesDecryptor::InitializeVideoDecoder(const VideoDecoderConfig& config,
+ const DecoderInitCB& init_cb) {
+ // AesDecryptor does not support video decoding. Always return false here.
+ init_cb.Run(false);
+}
+
+void AesDecryptor::DecryptAndDecodeVideo(
+ const scoped_refptr<DecoderBuffer>& encrypted,
+ const VideoDecodeCB& video_decode_cb) {
+ NOTREACHED() << "AesDecryptor does not support video decoding";
+ video_decode_cb.Run(kError, NULL);
+}
+
+void AesDecryptor::CancelDecryptAndDecodeVideo() {
+ NOTREACHED() << "AesDecryptor does not support video decoding";
+}
+
+void AesDecryptor::StopVideoDecoder() {
+ NOTREACHED() << "AesDecryptor does not support video decoding";
+}
+
void AesDecryptor::SetKey(const std::string& key_id,
scoped_ptr<DecryptionKey> decryption_key) {
base::AutoLock auto_lock(key_map_lock_);
diff --git a/media/crypto/aes_decryptor.h b/media/crypto/aes_decryptor.h
index 4ea52a6..2df8613 100644
--- a/media/crypto/aes_decryptor.h
+++ b/media/crypto/aes_decryptor.h
@@ -51,6 +51,13 @@ class MEDIA_EXPORT AesDecryptor : public Decryptor {
virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) OVERRIDE;
virtual void CancelDecrypt() OVERRIDE;
+ virtual void InitializeVideoDecoder(const VideoDecoderConfig& config,
+ const DecoderInitCB& init_cb) OVERRIDE;
+ virtual void DecryptAndDecodeVideo(
+ const scoped_refptr<DecoderBuffer>& encrypted,
+ const VideoDecodeCB& video_decode_cb) OVERRIDE;
+ virtual void CancelDecryptAndDecodeVideo() OVERRIDE;
+ virtual void StopVideoDecoder() OVERRIDE;
private:
// TODO(fgalligan): Remove this and change KeyMap to use crypto::SymmetricKey