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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 26 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
27 #include <gnu/libc-version.h> | 27 #include <gnu/libc-version.h> |
28 #include "base/version.h" | 28 #include "base/version.h" |
29 #endif | 29 #endif |
30 | 30 |
31 using content::KeySystemInfo; | 31 using content::KeySystemInfo; |
32 using content::SupportedCodecs; | 32 using content::SupportedCodecs; |
33 | 33 |
34 #if defined(ENABLE_PEPPER_CDMS) | 34 #if defined(ENABLE_PEPPER_CDMS) |
35 static bool IsPepperCdmRegistered( | 35 static bool IsPepperCdmAvailable( |
36 const std::string& pepper_type, | 36 const std::string& pepper_type, |
37 std::vector<base::string16>* additional_param_names, | 37 std::vector<base::string16>* additional_param_names, |
38 std::vector<base::string16>* additional_param_values) { | 38 std::vector<base::string16>* additional_param_values) { |
39 bool is_registered = false; | 39 bool is_available = false; |
40 content::RenderThread::Get()->Send( | 40 content::RenderThread::Get()->Send( |
41 new ChromeViewHostMsg_IsInternalPluginRegisteredForMimeType( | 41 new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType( |
42 pepper_type, | 42 pepper_type, |
43 &is_registered, | 43 &is_available, |
44 additional_param_names, | 44 additional_param_names, |
45 additional_param_values)); | 45 additional_param_values)); |
46 | 46 |
47 return is_registered; | 47 return is_available; |
48 } | 48 } |
49 | 49 |
50 // External Clear Key (used for testing). | 50 // External Clear Key (used for testing). |
51 static void AddExternalClearKey( | 51 static void AddExternalClearKey( |
52 std::vector<KeySystemInfo>* concrete_key_systems) { | 52 std::vector<KeySystemInfo>* concrete_key_systems) { |
53 static const char kExternalClearKeyKeySystem[] = | 53 static const char kExternalClearKeyKeySystem[] = |
54 "org.chromium.externalclearkey"; | 54 "org.chromium.externalclearkey"; |
55 static const char kExternalClearKeyDecryptOnlyKeySystem[] = | 55 static const char kExternalClearKeyDecryptOnlyKeySystem[] = |
56 "org.chromium.externalclearkey.decryptonly"; | 56 "org.chromium.externalclearkey.decryptonly"; |
57 static const char kExternalClearKeyFileIOTestKeySystem[] = | 57 static const char kExternalClearKeyFileIOTestKeySystem[] = |
58 "org.chromium.externalclearkey.fileiotest"; | 58 "org.chromium.externalclearkey.fileiotest"; |
59 static const char kExternalClearKeyInitializeFailKeySystem[] = | 59 static const char kExternalClearKeyInitializeFailKeySystem[] = |
60 "org.chromium.externalclearkey.initializefail"; | 60 "org.chromium.externalclearkey.initializefail"; |
61 static const char kExternalClearKeyCrashKeySystem[] = | 61 static const char kExternalClearKeyCrashKeySystem[] = |
62 "org.chromium.externalclearkey.crash"; | 62 "org.chromium.externalclearkey.crash"; |
63 static const char kExternalClearKeyPepperType[] = | 63 static const char kExternalClearKeyPepperType[] = |
64 "application/x-ppapi-clearkey-cdm"; | 64 "application/x-ppapi-clearkey-cdm"; |
65 | 65 |
66 std::vector<base::string16> additional_param_names; | 66 std::vector<base::string16> additional_param_names; |
67 std::vector<base::string16> additional_param_values; | 67 std::vector<base::string16> additional_param_values; |
68 if (!IsPepperCdmRegistered(kExternalClearKeyPepperType, | 68 if (!IsPepperCdmAvailable(kExternalClearKeyPepperType, |
69 &additional_param_names, | 69 &additional_param_names, |
70 &additional_param_values)) { | 70 &additional_param_values)) { |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 KeySystemInfo info(kExternalClearKeyKeySystem); | 74 KeySystemInfo info(kExternalClearKeyKeySystem); |
75 | 75 |
76 info.supported_codecs = content::EME_CODEC_WEBM_ALL; | 76 info.supported_codecs = content::EME_CODEC_WEBM_ALL; |
77 #if defined(USE_PROPRIETARY_CODECS) | 77 #if defined(USE_PROPRIETARY_CODECS) |
78 info.supported_codecs |= content::EME_CODEC_MP4_ALL; | 78 info.supported_codecs |= content::EME_CODEC_MP4_ALL; |
79 #endif // defined(USE_PROPRIETARY_CODECS) | 79 #endif // defined(USE_PROPRIETARY_CODECS) |
80 | 80 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 std::vector<KeySystemInfo>* concrete_key_systems) { | 134 std::vector<KeySystemInfo>* concrete_key_systems) { |
135 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 135 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
136 Version glibc_version(gnu_get_libc_version()); | 136 Version glibc_version(gnu_get_libc_version()); |
137 DCHECK(glibc_version.IsValid()); | 137 DCHECK(glibc_version.IsValid()); |
138 if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION)) | 138 if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION)) |
139 return; | 139 return; |
140 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 140 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
141 | 141 |
142 std::vector<base::string16> additional_param_names; | 142 std::vector<base::string16> additional_param_names; |
143 std::vector<base::string16> additional_param_values; | 143 std::vector<base::string16> additional_param_values; |
144 if (!IsPepperCdmRegistered(kWidevineCdmPluginMimeType, | 144 if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, |
145 &additional_param_names, | 145 &additional_param_names, |
146 &additional_param_values)) { | 146 &additional_param_values)) { |
147 DVLOG(1) << "Widevine CDM is not currently available."; | 147 DVLOG(1) << "Widevine CDM is not currently available."; |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 std::vector<std::string> codecs; | 151 std::vector<std::string> codecs; |
152 GetSupportedCodecsForPepperCdm(additional_param_names, | 152 GetSupportedCodecsForPepperCdm(additional_param_names, |
153 additional_param_values, | 153 additional_param_values, |
154 &codecs); | 154 &codecs); |
155 | 155 |
156 SupportedCodecs supported_codecs = content::EME_CODEC_NONE; | 156 SupportedCodecs supported_codecs = content::EME_CODEC_NONE; |
(...skipping 25 matching lines...) Expand all Loading... |
182 | 182 |
183 #if defined(WIDEVINE_CDM_AVAILABLE) | 183 #if defined(WIDEVINE_CDM_AVAILABLE) |
184 AddPepperBasedWidevine(key_systems_info); | 184 AddPepperBasedWidevine(key_systems_info); |
185 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 185 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
186 #endif // defined(ENABLE_PEPPER_CDMS) | 186 #endif // defined(ENABLE_PEPPER_CDMS) |
187 | 187 |
188 #if defined(OS_ANDROID) | 188 #if defined(OS_ANDROID) |
189 cdm::AddAndroidWidevine(key_systems_info); | 189 cdm::AddAndroidWidevine(key_systems_info); |
190 #endif // defined(OS_ANDROID) | 190 #endif // defined(OS_ANDROID) |
191 } | 191 } |
OLD | NEW |