OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cdm/renderer/widevine_key_systems.h" | 5 #include "components/cdm/renderer/widevine_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" |
11 #include "components/cdm/common/cdm_messages_android.h" | |
12 #include "content/public/renderer/key_system_info.h" | |
13 #include "content/public/renderer/render_thread.h" | |
14 | 11 |
15 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
16 | 13 |
17 #if defined(WIDEVINE_CDM_AVAILABLE) | 14 #if defined(WIDEVINE_CDM_AVAILABLE) |
18 | 15 |
19 using content::KeySystemInfo; | 16 using content::KeySystemInfo; |
20 using content::SupportedCodecs; | 17 using content::SupportedCodecs; |
21 | 18 |
22 namespace cdm { | 19 namespace cdm { |
23 | 20 |
24 // Return |name|'s parent key system. | 21 // Return |name|'s parent key system. |
25 static std::string GetDirectParentName(std::string name) { | 22 static std::string GetDirectParentName(std::string name) { |
(...skipping 26 matching lines...) Expand all Loading... |
52 // initDataType. | 49 // initDataType. |
53 info.supported_codecs = supported_codecs; | 50 info.supported_codecs = supported_codecs; |
54 | 51 |
55 #if defined(ENABLE_PEPPER_CDMS) | 52 #if defined(ENABLE_PEPPER_CDMS) |
56 info.pepper_type = kWidevineCdmPluginMimeType; | 53 info.pepper_type = kWidevineCdmPluginMimeType; |
57 #endif // defined(ENABLE_PEPPER_CDMS) | 54 #endif // defined(ENABLE_PEPPER_CDMS) |
58 | 55 |
59 concrete_key_systems->push_back(info); | 56 concrete_key_systems->push_back(info); |
60 } | 57 } |
61 | 58 |
62 #if defined(OS_ANDROID) | |
63 void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { | |
64 SupportedKeySystemRequest request; | |
65 SupportedKeySystemResponse response; | |
66 | |
67 request.key_system = kWidevineKeySystem; | |
68 request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL; | |
69 content::RenderThread::Get()->Send( | |
70 new ChromeViewHostMsg_GetSupportedKeySystems(request, &response)); | |
71 DCHECK(response.compositing_codecs & content::EME_CODEC_ALL) | |
72 << "unrecognized codec"; | |
73 DCHECK(response.non_compositing_codecs & content::EME_CODEC_ALL) | |
74 << "unrecognized codec"; | |
75 if (response.compositing_codecs != content::EME_CODEC_NONE) { | |
76 AddWidevineWithCodecs( | |
77 WIDEVINE, | |
78 static_cast<SupportedCodecs>(response.compositing_codecs), | |
79 concrete_key_systems); | |
80 } | |
81 | |
82 if (response.non_compositing_codecs != content::EME_CODEC_NONE) { | |
83 AddWidevineWithCodecs( | |
84 WIDEVINE_HR_NON_COMPOSITING, | |
85 static_cast<SupportedCodecs>(response.non_compositing_codecs), | |
86 concrete_key_systems); | |
87 } | |
88 } | |
89 #endif // OS_ANDROID | |
90 | |
91 } // namespace cdm | 59 } // namespace cdm |
92 | 60 |
93 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 61 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
OLD | NEW |