| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 additional_param_values)); | 57 additional_param_values)); |
| 58 | 58 |
| 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[] = |
| 68 "org.chromium.externalclearkey.decryptonly"; |
| 69 static const char kExternalClearKeyInitializeFailKeySystem[] = |
| 70 "org.chromium.externalclearkey.initializefail"; |
| 67 static const char kExternalClearKeyPepperType[] = | 71 static const char kExternalClearKeyPepperType[] = |
| 68 "application/x-ppapi-clearkey-cdm"; | 72 "application/x-ppapi-clearkey-cdm"; |
| 69 | 73 |
| 70 std::vector<base::string16> additional_param_names; | 74 std::vector<base::string16> additional_param_names; |
| 71 std::vector<base::string16> additional_param_values; | 75 std::vector<base::string16> additional_param_values; |
| 72 if (!IsPepperCdmRegistered(kExternalClearKeyPepperType, | 76 if (!IsPepperCdmRegistered(kExternalClearKeyPepperType, |
| 73 &additional_param_names, | 77 &additional_param_names, |
| 74 &additional_param_values)) { | 78 &additional_param_values)) { |
| 75 return; | 79 return; |
| 76 } | 80 } |
| 77 | 81 |
| 78 KeySystemInfo info(kExternalClearKeyKeySystem); | 82 KeySystemInfo info(kExternalClearKeyKeySystem); |
| 79 | 83 |
| 80 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); | 84 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); |
| 81 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); | 85 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); |
| 82 #if defined(USE_PROPRIETARY_CODECS) | 86 #if defined(USE_PROPRIETARY_CODECS) |
| 83 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); | 87 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); |
| 84 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); | 88 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); |
| 85 #endif // defined(USE_PROPRIETARY_CODECS) | 89 #endif // defined(USE_PROPRIETARY_CODECS) |
| 86 info.pepper_type = kExternalClearKeyPepperType; | 90 info.pepper_type = kExternalClearKeyPepperType; |
| 87 | 91 |
| 88 concrete_key_systems->push_back(info); | 92 concrete_key_systems->push_back(info); |
| 89 | 93 |
| 90 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually | 94 // A key system that Chrome thinks is supported by ClearKeyCdm, but actually |
| 91 // will be refused by ClearKeyCdm. This is to test the CDM initialization | 95 // will be refused by ClearKeyCdm. This is to test the CDM initialization |
| 92 // failure case. | 96 // failure case. |
| 93 info.key_system += ".initializefail"; | 97 info.key_system = kExternalClearKeyInitializeFailKeySystem; |
| 98 concrete_key_systems->push_back(info); |
| 99 |
| 100 // Add support of decrypt-only mode in ClearKeyCdm. |
| 101 info.key_system = kExternalClearKeyDecryptOnlyKeySystem; |
| 94 concrete_key_systems->push_back(info); | 102 concrete_key_systems->push_back(info); |
| 95 } | 103 } |
| 96 #endif // defined(ENABLE_PEPPER_CDMS) | 104 #endif // defined(ENABLE_PEPPER_CDMS) |
| 97 | 105 |
| 98 | 106 |
| 99 #if defined(WIDEVINE_CDM_AVAILABLE) | 107 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 100 enum WidevineCdmType { | 108 enum WidevineCdmType { |
| 101 WIDEVINE, | 109 WIDEVINE, |
| 102 WIDEVINE_HR, | 110 WIDEVINE_HR, |
| 103 #if defined(OS_ANDROID) | 111 #if defined(OS_ANDROID) |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 #endif | 313 #endif |
| 306 | 314 |
| 307 #if defined(WIDEVINE_CDM_AVAILABLE) | 315 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 308 #if defined(ENABLE_PEPPER_CDMS) | 316 #if defined(ENABLE_PEPPER_CDMS) |
| 309 AddPepperBasedWidevine(key_systems_info); | 317 AddPepperBasedWidevine(key_systems_info); |
| 310 #elif defined(OS_ANDROID) | 318 #elif defined(OS_ANDROID) |
| 311 AddAndroidWidevine(key_systems_info); | 319 AddAndroidWidevine(key_systems_info); |
| 312 #endif | 320 #endif |
| 313 #endif | 321 #endif |
| 314 } | 322 } |
| OLD | NEW |