Index: chrome/renderer/media/chrome_key_systems.cc |
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc |
index 90e6325de2c55a7a9a1cae0d45cfa898a904f048..3c7f5148dc6ee47ad7f7d3f8faf2b154c1d5bbc5 100644 |
--- a/chrome/renderer/media/chrome_key_systems.cc |
+++ b/chrome/renderer/media/chrome_key_systems.cc |
@@ -7,7 +7,6 @@ |
#include <string> |
#include <vector> |
-#include "base/logging.h" |
#include "base/strings/string16.h" |
#include "base/strings/string_split.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -23,10 +22,6 @@ |
#include "base/version.h" |
#endif |
-#if defined(OS_ANDROID) |
-#include "chrome/common/encrypted_media_messages_android.h" |
-#endif |
- |
using content::KeySystemInfo; |
using content::SupportedCodecs; |
@@ -99,18 +94,8 @@ static void AddExternalClearKey( |
info.key_system = kExternalClearKeyCrashKeySystem; |
concrete_key_systems->push_back(info); |
} |
-#endif // defined(ENABLE_PEPPER_CDMS) |
- |
#if defined(WIDEVINE_CDM_AVAILABLE) |
-enum WidevineCdmType { |
- WIDEVINE, |
- WIDEVINE_HR, |
-#if defined(OS_ANDROID) |
- WIDEVINE_HR_NON_COMPOSITING, |
-#endif |
-}; |
- |
#if !defined(OS_ANDROID) |
static bool IsWidevineHrSupported() { |
// TODO(jrummell): Need to call CheckPlatformState() but it is |
@@ -119,49 +104,6 @@ static bool IsWidevineHrSupported() { |
} |
#endif |
-// Return |name|'s parent key system. |
-static std::string GetDirectParentName(std::string name) { |
- int last_period = name.find_last_of('.'); |
- DCHECK_GT(last_period, 0); |
- return name.substr(0, last_period); |
-} |
- |
-static void AddWidevineWithCodecs( |
- WidevineCdmType widevine_cdm_type, |
- SupportedCodecs supported_codecs, |
- std::vector<KeySystemInfo>* concrete_key_systems) { |
- KeySystemInfo info(kWidevineKeySystem); |
- |
- switch (widevine_cdm_type) { |
- case WIDEVINE: |
- // For standard Widevine, add parent name. |
- info.parent_key_system = GetDirectParentName(kWidevineKeySystem); |
- break; |
- case WIDEVINE_HR: |
- info.key_system.append(".hr"); |
- break; |
-#if defined(OS_ANDROID) |
- case WIDEVINE_HR_NON_COMPOSITING: |
- info.key_system.append(".hrnoncompositing"); |
- break; |
-#endif |
- default: |
- NOTREACHED(); |
- } |
- |
- // TODO(xhwang): A container or an initDataType may be supported even though |
- // there are no codecs supported in that container. Fix this when we support |
- // initDataType. |
- info.supported_codecs = supported_codecs; |
- |
-#if defined(ENABLE_PEPPER_CDMS) |
- info.pepper_type = kWidevineCdmPluginMimeType; |
-#endif // defined(ENABLE_PEPPER_CDMS) |
- |
- concrete_key_systems->push_back(info); |
-} |
- |
-#if defined(ENABLE_PEPPER_CDMS) |
// When the adapter is registered, a name-value pair is inserted in |
// additional_param_* that lists the supported codecs. The name is "codecs" and |
// the value is a comma-delimited list of codecs. |
@@ -195,6 +137,7 @@ void GetSupportedCodecs( |
static void AddPepperBasedWidevine( |
std::vector<KeySystemInfo>* concrete_key_systems) { |
+ static const char kKeySystemSuffixHr[] = ".hr"; |
#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
Version glibc_version(gnu_get_libc_version()); |
DCHECK(glibc_version.IsValid()); |
@@ -228,52 +171,30 @@ static void AddPepperBasedWidevine( |
#endif // defined(USE_PROPRIETARY_CODECS) |
} |
- AddWidevineWithCodecs(WIDEVINE, supported_codecs, concrete_key_systems); |
- |
- if (IsWidevineHrSupported()) |
- AddWidevineWithCodecs(WIDEVINE_HR, supported_codecs, concrete_key_systems); |
-} |
-#elif defined(OS_ANDROID) |
-static void AddAndroidWidevine( |
- std::vector<KeySystemInfo>* concrete_key_systems) { |
- SupportedKeySystemRequest request; |
- SupportedKeySystemResponse response; |
- |
- request.key_system = kWidevineKeySystem; |
- request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL; |
- content::RenderThread::Get()->Send( |
- new ChromeViewHostMsg_GetSupportedKeySystems(request, &response)); |
- DCHECK(response.compositing_codecs & content::EME_CODEC_ALL) |
- << "unrecognized codec"; |
- DCHECK(response.non_compositing_codecs & content::EME_CODEC_ALL) |
- << "unrecognized codec"; |
- if (response.compositing_codecs != content::EME_CODEC_NONE) { |
- AddWidevineWithCodecs( |
- WIDEVINE, |
- static_cast<SupportedCodecs>(response.compositing_codecs), |
- concrete_key_systems); |
- } |
- |
- if (response.non_compositing_codecs != content::EME_CODEC_NONE) { |
- AddWidevineWithCodecs( |
- WIDEVINE_HR_NON_COMPOSITING, |
- static_cast<SupportedCodecs>(response.non_compositing_codecs), |
- concrete_key_systems); |
+ concrete_key_systems->push_back(KeySystemInfo::Build( |
+ kWidevineKeySystem, |
+ true, // has_parent |
+ NULL, // suffix |
+ kWidevineCdmPluginMimeType, |
+ supported_codecs)); |
+ |
+ if (IsWidevineHrSupported()) { |
+ concrete_key_systems->push_back(KeySystemInfo::Build( |
+ kWidevineKeySystem, |
+ false, // has_parent |
+ kKeySystemSuffixHr, // suffix |
+ kWidevineCdmPluginMimeType, |
+ supported_codecs)); |
} |
} |
-#endif // defined(ENABLE_PEPPER_CDMS) |
#endif // defined(WIDEVINE_CDM_AVAILABLE) |
+#endif // defined(ENABLE_PEPPER_CDMS) |
void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) { |
#if defined(ENABLE_PEPPER_CDMS) |
AddExternalClearKey(key_systems_info); |
-#endif |
- |
#if defined(WIDEVINE_CDM_AVAILABLE) |
-#if defined(ENABLE_PEPPER_CDMS) |
AddPepperBasedWidevine(key_systems_info); |
-#elif defined(OS_ANDROID) |
- AddAndroidWidevine(key_systems_info); |
#endif |
Tom Sepez
2014/04/28 18:21:52
nit: // defined ... while you're at it, since you'
|
#endif |
} |