| 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 "components/cdm/renderer/widevine_key_systems.h" | 5 #include "components/cdm/renderer/widevine_key_systems.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.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 #if defined(WIDEVINE_CDM_AVAILABLE) | 18 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 19 | 19 |
| 20 using media::KeySystemInfo; | 20 using media::KeySystemInfo; |
| 21 using media::SupportedCodecs; | 21 using media::SupportedCodecs; |
| 22 | 22 |
| 23 namespace cdm { | 23 namespace cdm { |
| 24 | 24 |
| 25 // Return |name|'s parent key system. | |
| 26 static std::string GetDirectParentName(const std::string& name) { | |
| 27 size_t last_period = name.find_last_of('.'); | |
| 28 DCHECK_GT(last_period, 0u); | |
| 29 return name.substr(0u, last_period); | |
| 30 } | |
| 31 | |
| 32 void AddWidevineWithCodecs( | 25 void AddWidevineWithCodecs( |
| 33 WidevineCdmType widevine_cdm_type, | 26 WidevineCdmType widevine_cdm_type, |
| 34 SupportedCodecs supported_codecs, | 27 SupportedCodecs supported_codecs, |
| 35 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 36 SupportedCodecs supported_secure_codecs, | 29 SupportedCodecs supported_secure_codecs, |
| 37 #endif // defined(OS_ANDROID) | 30 #endif // defined(OS_ANDROID) |
| 38 media::EmeRobustness max_audio_robustness, | 31 media::EmeRobustness max_audio_robustness, |
| 39 media::EmeRobustness max_video_robustness, | 32 media::EmeRobustness max_video_robustness, |
| 40 media::EmeSessionTypeSupport persistent_license_support, | 33 media::EmeSessionTypeSupport persistent_license_support, |
| 41 media::EmeSessionTypeSupport persistent_release_message_support, | 34 media::EmeSessionTypeSupport persistent_release_message_support, |
| 42 media::EmeFeatureSupport persistent_state_support, | 35 media::EmeFeatureSupport persistent_state_support, |
| 43 media::EmeFeatureSupport distinctive_identifier_support, | 36 media::EmeFeatureSupport distinctive_identifier_support, |
| 44 std::vector<KeySystemInfo>* concrete_key_systems) { | 37 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 45 KeySystemInfo info; | 38 KeySystemInfo info; |
| 46 info.key_system = kWidevineKeySystem; | 39 info.key_system = kWidevineKeySystem; |
| 47 | 40 |
| 48 switch (widevine_cdm_type) { | 41 switch (widevine_cdm_type) { |
| 49 case WIDEVINE: | 42 case WIDEVINE: |
| 50 // For standard Widevine, add parent name. | |
| 51 info.parent_key_system = GetDirectParentName(kWidevineKeySystem); | |
| 52 break; | 43 break; |
| 53 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
| 54 case WIDEVINE_HR_NON_COMPOSITING: | 45 case WIDEVINE_HR_NON_COMPOSITING: |
| 55 info.key_system.append(".hrnoncompositing"); | 46 info.key_system.append(".hrnoncompositing"); |
| 56 break; | 47 break; |
| 57 #endif // defined(OS_ANDROID) | 48 #endif // defined(OS_ANDROID) |
| 58 default: | 49 default: |
| 59 NOTREACHED(); | 50 NOTREACHED(); |
| 60 } | 51 } |
| 61 | 52 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 #if defined(ENABLE_PEPPER_CDMS) | 78 #if defined(ENABLE_PEPPER_CDMS) |
| 88 info.pepper_type = kWidevineCdmPluginMimeType; | 79 info.pepper_type = kWidevineCdmPluginMimeType; |
| 89 #endif // defined(ENABLE_PEPPER_CDMS) | 80 #endif // defined(ENABLE_PEPPER_CDMS) |
| 90 | 81 |
| 91 concrete_key_systems->push_back(info); | 82 concrete_key_systems->push_back(info); |
| 92 } | 83 } |
| 93 | 84 |
| 94 } // namespace cdm | 85 } // namespace cdm |
| 95 | 86 |
| 96 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 87 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| OLD | NEW |