| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/media/chrome_key_systems.h" | 5 #include "chrome/renderer/media/chrome_key_systems.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return is_registered; | 59 return is_registered; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // External Clear Key (used for testing). | 62 // External Clear Key (used for testing). |
| 63 static void AddExternalClearKey( | 63 static void AddExternalClearKey( |
| 64 std::vector<KeySystemInfo>* concrete_key_systems) { | 64 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 65 static const char kExternalClearKeyKeySystem[] = | 65 static const char kExternalClearKeyKeySystem[] = |
| 66 "org.chromium.externalclearkey"; | 66 "org.chromium.externalclearkey"; |
| 67 static const char kExternalClearKeyDecryptOnlyKeySystem[] = | 67 static const char kExternalClearKeyDecryptOnlyKeySystem[] = |
| 68 "org.chromium.externalclearkey.decryptonly"; | 68 "org.chromium.externalclearkey.decryptonly"; |
| 69 static const char kExternalClearKeyFileIOTestKeySystem[] = |
| 70 "org.chromium.externalclearkey.fileiotest"; |
| 69 static const char kExternalClearKeyInitializeFailKeySystem[] = | 71 static const char kExternalClearKeyInitializeFailKeySystem[] = |
| 70 "org.chromium.externalclearkey.initializefail"; | 72 "org.chromium.externalclearkey.initializefail"; |
| 71 static const char kExternalClearKeyPepperType[] = | 73 static const char kExternalClearKeyPepperType[] = |
| 72 "application/x-ppapi-clearkey-cdm"; | 74 "application/x-ppapi-clearkey-cdm"; |
| 73 | 75 |
| 74 std::vector<base::string16> additional_param_names; | 76 std::vector<base::string16> additional_param_names; |
| 75 std::vector<base::string16> additional_param_values; | 77 std::vector<base::string16> additional_param_values; |
| 76 if (!IsPepperCdmRegistered(kExternalClearKeyPepperType, | 78 if (!IsPepperCdmRegistered(kExternalClearKeyPepperType, |
| 77 &additional_param_names, | 79 &additional_param_names, |
| 78 &additional_param_values)) { | 80 &additional_param_values)) { |
| 79 return; | 81 return; |
| 80 } | 82 } |
| 81 | 83 |
| 82 KeySystemInfo info(kExternalClearKeyKeySystem); | 84 KeySystemInfo info(kExternalClearKeyKeySystem); |
| 83 | 85 |
| 84 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); | 86 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); |
| 85 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); | 87 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); |
| 86 #if defined(USE_PROPRIETARY_CODECS) | 88 #if defined(USE_PROPRIETARY_CODECS) |
| 87 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); | 89 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); |
| 88 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); | 90 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); |
| 89 #endif // defined(USE_PROPRIETARY_CODECS) | 91 #endif // defined(USE_PROPRIETARY_CODECS) |
| 90 info.pepper_type = kExternalClearKeyPepperType; | 92 info.pepper_type = kExternalClearKeyPepperType; |
| 91 | 93 |
| 92 concrete_key_systems->push_back(info); | 94 concrete_key_systems->push_back(info); |
| 93 | 95 |
| 96 // Add support of decrypt-only mode in ClearKeyCdm. |
| 97 info.key_system = kExternalClearKeyDecryptOnlyKeySystem; |
| 98 concrete_key_systems->push_back(info); |
| 99 |
| 100 // A key system that triggers FileIO test in ClearKeyCdm. |
| 101 info.key_system = kExternalClearKeyFileIOTestKeySystem; |
| 102 concrete_key_systems->push_back(info); |
| 103 |
| 94 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually | 104 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually |
| 95 // will be refused by ClearKeyCdm. This is to test the CDM initialization | 105 // will be refused by ClearKeyCdm. This is to test the CDM initialization |
| 96 // failure case. | 106 // failure case. |
| 97 info.key_system = kExternalClearKeyInitializeFailKeySystem; | 107 info.key_system = kExternalClearKeyInitializeFailKeySystem; |
| 98 concrete_key_systems->push_back(info); | 108 concrete_key_systems->push_back(info); |
| 99 | |
| 100 // Add support of decrypt-only mode in ClearKeyCdm. | |
| 101 info.key_system = kExternalClearKeyDecryptOnlyKeySystem; | |
| 102 concrete_key_systems->push_back(info); | |
| 103 } | 109 } |
| 104 #endif // defined(ENABLE_PEPPER_CDMS) | 110 #endif // defined(ENABLE_PEPPER_CDMS) |
| 105 | 111 |
| 106 | 112 |
| 107 #if defined(WIDEVINE_CDM_AVAILABLE) | 113 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 108 enum WidevineCdmType { | 114 enum WidevineCdmType { |
| 109 WIDEVINE, | 115 WIDEVINE, |
| 110 WIDEVINE_HR, | 116 WIDEVINE_HR, |
| 111 #if defined(OS_ANDROID) | 117 #if defined(OS_ANDROID) |
| 112 WIDEVINE_HR_NON_COMPOSITING, | 118 WIDEVINE_HR_NON_COMPOSITING, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 #endif | 319 #endif |
| 314 | 320 |
| 315 #if defined(WIDEVINE_CDM_AVAILABLE) | 321 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 316 #if defined(ENABLE_PEPPER_CDMS) | 322 #if defined(ENABLE_PEPPER_CDMS) |
| 317 AddPepperBasedWidevine(key_systems_info); | 323 AddPepperBasedWidevine(key_systems_info); |
| 318 #elif defined(OS_ANDROID) | 324 #elif defined(OS_ANDROID) |
| 319 AddAndroidWidevine(key_systems_info); | 325 AddAndroidWidevine(key_systems_info); |
| 320 #endif | 326 #endif |
| 321 #endif | 327 #endif |
| 322 } | 328 } |
| OLD | NEW |