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