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