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 "chromecast/renderer/key_systems_cast.h"
9 #include "base/command_line.h"
10 #include "base/logging.h"
11 #include "build/build_config.h"
12 #include "chromecast/media/base/key_systems_common.h"
13 #include "components/cdm/renderer/widevine_key_systems.h"
14 #include "media/base/eme_constants.h"
16 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
18 using ::media::EmeFeatureSupport
;
19 using ::media::EmeRobustness
;
20 using ::media::EmeSessionTypeSupport
;
22 namespace chromecast
{
25 void AddKeySystemWithCodecs(
26 const std::string
& key_system_name
,
27 std::vector
<::media::KeySystemInfo
>* key_systems_info
) {
28 ::media::KeySystemInfo info
;
29 info
.key_system
= key_system_name
;
30 info
.supported_init_data_types
= ::media::kInitDataTypeMaskCenc
;
31 info
.supported_codecs
=
32 ::media::EME_CODEC_MP4_AAC
| ::media::EME_CODEC_MP4_AVC1
;
33 info
.max_audio_robustness
= ::media::EmeRobustness::EMPTY
;
34 info
.max_video_robustness
= ::media::EmeRobustness::EMPTY
;
35 #if defined(OS_ANDROID)
36 info
.persistent_license_support
=
37 ::media::EmeSessionTypeSupport::NOT_SUPPORTED
;
39 info
.persistent_license_support
=
40 ::media::EmeSessionTypeSupport::SUPPORTED
;
42 info
.persistent_release_message_support
=
43 ::media::EmeSessionTypeSupport::NOT_SUPPORTED
;
44 info
.persistent_state_support
= ::media::EmeFeatureSupport::ALWAYS_ENABLED
;
45 info
.distinctive_identifier_support
=
46 ::media::EmeFeatureSupport::ALWAYS_ENABLED
;
47 key_systems_info
->push_back(info
);
50 void AddChromecastKeySystems(
51 std::vector
<::media::KeySystemInfo
>* key_systems_info
) {
52 #if defined(WIDEVINE_CDM_AVAILABLE)
53 ::media::SupportedCodecs codecs
=
54 ::media::EME_CODEC_MP4_AAC
| ::media::EME_CODEC_MP4_AVC1
;
55 AddWidevineWithCodecs(
57 codecs
, // Regular codecs.
58 #if defined(OS_ANDROID)
59 codecs
, // Hardware-secure codecs.
60 #endif // defined(OS_ANDROID)
61 EmeRobustness::HW_SECURE_ALL
, // Max audio robustness.
62 EmeRobustness::HW_SECURE_ALL
, // Max video robustness.
63 EmeSessionTypeSupport::NOT_SUPPORTED
, // persistent-license.
64 EmeSessionTypeSupport::NOT_SUPPORTED
, // persistent-release-message.
65 // Note: On Chromecast, all CDMs may have persistent state.
66 EmeFeatureSupport::ALWAYS_ENABLED
, // Persistent state.
67 EmeFeatureSupport::ALWAYS_ENABLED
, // Distinctive identifier.
69 #endif // defined(WIDEVINE_CDM_AVAILABLE)
71 #if defined(PLAYREADY_CDM_AVAILABLE)
72 AddKeySystemWithCodecs(media::kChromecastPlayreadyKeySystem
,
74 #endif // defined(PLAYREADY_CDM_AVAILABLE)
78 } // namespace chromecast