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
3 // found in the LICENSE file.
5 #include "components/cdm/renderer/widevine_key_systems.h"
10 #include "base/logging.h"
12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
14 #if defined(WIDEVINE_CDM_AVAILABLE)
16 using content::KeySystemInfo
;
17 using content::SupportedCodecs
;
21 // Return |name|'s parent key system.
22 static std::string
GetDirectParentName(std::string name
) {
23 size_t last_period
= name
.find_last_of('.');
24 DCHECK_GT(last_period
, 0u);
25 return name
.substr(0u, last_period
);
28 void AddWidevineWithCodecs(WidevineCdmType widevine_cdm_type
,
29 SupportedCodecs supported_codecs
,
30 std::vector
<KeySystemInfo
>* concrete_key_systems
) {
31 KeySystemInfo
info(kWidevineKeySystem
);
33 switch (widevine_cdm_type
) {
35 // For standard Widevine, add parent name.
36 info
.parent_key_system
= GetDirectParentName(kWidevineKeySystem
);
38 #if defined(OS_ANDROID)
39 case WIDEVINE_HR_NON_COMPOSITING
:
40 info
.key_system
.append(".hrnoncompositing");
42 #endif // defined(OS_ANDROID)
47 // TODO(xhwang): A container or an initDataType may be supported even though
48 // there are no codecs supported in that container. Fix this when we support
50 info
.supported_codecs
= supported_codecs
;
52 #if defined(ENABLE_PEPPER_CDMS)
53 info
.pepper_type
= kWidevineCdmPluginMimeType
;
54 #endif // defined(ENABLE_PEPPER_CDMS)
56 concrete_key_systems
->push_back(info
);
61 #endif // defined(WIDEVINE_CDM_AVAILABLE)