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