From 3573622da943ccb017e1dd93791a7efad5a3bcc8 Mon Sep 17 00:00:00 2001 From: sandersd Date: Tue, 30 Sep 2014 16:55:09 -0700 Subject: Implement Chromium side of MediaKeys.isTypeSupported(). BUG=405731 Review URL: https://codereview.chromium.org/557723003 Cr-Commit-Position: refs/heads/master@{#297550} --- components/cdm/common/cdm_messages_android.h | 2 +- components/cdm/renderer/DEPS | 1 + components/cdm/renderer/android_key_systems.cc | 10 ++++++++++ components/cdm/renderer/widevine_key_systems.cc | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) (limited to 'components/cdm') diff --git a/components/cdm/common/cdm_messages_android.h b/components/cdm/common/cdm_messages_android.h index f78674d..8e0ad1c 100644 --- a/components/cdm/common/cdm_messages_android.h +++ b/components/cdm/common/cdm_messages_android.h @@ -7,7 +7,7 @@ #include -#include "content/public/common/eme_codec.h" +#include "content/public/common/eme_constants.h" #include "ipc/ipc_message_macros.h" #define IPC_MESSAGE_START EncryptedMediaMsgStart diff --git a/components/cdm/renderer/DEPS b/components/cdm/renderer/DEPS index 725e151..dbd28cf 100644 --- a/components/cdm/renderer/DEPS +++ b/components/cdm/renderer/DEPS @@ -1,3 +1,4 @@ include_rules = [ + "+content/public/common", "+content/public/renderer", ] diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc index 99bc2bb..c6adc80 100644 --- a/components/cdm/renderer/android_key_systems.cc +++ b/components/cdm/renderer/android_key_systems.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "components/cdm/common/cdm_messages_android.h" #include "components/cdm/renderer/widevine_key_systems.h" +#include "content/public/common/eme_constants.h" #include "content/public/renderer/render_thread.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -65,6 +66,15 @@ void AddAndroidPlatformKeySystems( if (response.compositing_codecs != content::EME_CODEC_NONE) { KeySystemInfo info(*it); info.supported_codecs = response.compositing_codecs; + // Here we assume that support for a container implies support for the + // associated initialization data type. KeySystems handles validating + // |init_data_type| x |container| pairings. + if (response.compositing_codecs & content::EME_CODEC_WEBM_ALL) + info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_WEBM; +#if defined(USE_PROPRIETARY_CODECS) + if (response.compositing_codecs & content::EME_CODEC_MP4_ALL) + info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; +#endif // defined(USE_PROPRIETARY_CODECS) concrete_key_systems->push_back(info); } } diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc index 2a41322..d08b6ad 100644 --- a/components/cdm/renderer/widevine_key_systems.cc +++ b/components/cdm/renderer/widevine_key_systems.cc @@ -8,6 +8,7 @@ #include #include "base/logging.h" +#include "content/public/common/eme_constants.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -49,6 +50,16 @@ void AddWidevineWithCodecs(WidevineCdmType widevine_cdm_type, // initDataType. info.supported_codecs = supported_codecs; + // Here we assume that support for a container imples support for the + // associated initialization data type. KeySystems handles validating + // |init_data_type| x |container| pairings. + if (supported_codecs & content::EME_CODEC_WEBM_ALL) + info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_WEBM; +#if defined(USE_PROPRIETARY_CODECS) + if (supported_codecs & content::EME_CODEC_MP4_ALL) + info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; +#endif // defined(USE_PROPRIETARY_CODECS) + #if defined(ENABLE_PEPPER_CDMS) info.pepper_type = kWidevineCdmPluginMimeType; #endif // defined(ENABLE_PEPPER_CDMS) -- cgit v1.1