Fix breakages in https://codereview.chromium.org/1155713003/
[chromium-blink-merge.git] / chromecast / renderer / key_systems_cast.cc
blobbb27a6f11a2dea389e067a9678dff7783dc654d2
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"
7 #include <string>
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 {
23 namespace shell {
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;
38 #else
39 info.persistent_license_support =
40 ::media::EmeSessionTypeSupport::SUPPORTED;
41 #endif
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(
56 cdm::WIDEVINE,
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.
68 key_systems_info);
69 #endif // defined(WIDEVINE_CDM_AVAILABLE)
71 #if defined(PLAYREADY_CDM_AVAILABLE)
72 AddKeySystemWithCodecs(media::kChromecastPlayreadyKeySystem,
73 key_systems_info);
74 #endif // defined(PLAYREADY_CDM_AVAILABLE)
77 } // namespace shell
78 } // namespace chromecast