| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/base/key_systems.h" | 5 #include "media/base/key_systems.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "media/base/key_system_info.h" | 17 #include "media/base/key_system_info.h" |
| 18 #include "media/base/key_systems_support_uma.h" | 18 #include "media/base/key_systems_support_uma.h" |
| 19 #include "media/base/media_client.h" | 19 #include "media/base/media_client.h" |
| 20 #include "media/cdm/key_system_names.h" | 20 #include "media/cdm/key_system_names.h" |
| 21 #include "media/media_features.h" |
| 21 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 22 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
| 22 | 23 |
| 23 namespace media { | 24 namespace media { |
| 24 | 25 |
| 25 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 26 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 26 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 27 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
| 27 const char kUnsupportedClearKeyKeySystem[] = "unsupported-org.w3.clearkey"; | 28 const char kUnsupportedClearKeyKeySystem[] = "unsupported-org.w3.clearkey"; |
| 28 | 29 |
| 29 // These names are used by UMA. Do not change them! | 30 // These names are used by UMA. Do not change them! |
| 30 const char kClearKeyKeySystemNameForUMA[] = "ClearKey"; | 31 const char kClearKeyKeySystemNameForUMA[] = "ClearKey"; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 // Mapping between codec names and enum values. | 53 // Mapping between codec names and enum values. |
| 53 static NamedCodec kCodecStrings[] = { | 54 static NamedCodec kCodecStrings[] = { |
| 54 {"opus", EME_CODEC_WEBM_OPUS}, | 55 {"opus", EME_CODEC_WEBM_OPUS}, |
| 55 {"vorbis", EME_CODEC_WEBM_VORBIS}, | 56 {"vorbis", EME_CODEC_WEBM_VORBIS}, |
| 56 {"vp8", EME_CODEC_WEBM_VP8}, | 57 {"vp8", EME_CODEC_WEBM_VP8}, |
| 57 {"vp8.0", EME_CODEC_WEBM_VP8}, | 58 {"vp8.0", EME_CODEC_WEBM_VP8}, |
| 58 {"vp9", EME_CODEC_WEBM_VP9}, | 59 {"vp9", EME_CODEC_WEBM_VP9}, |
| 59 {"vp9.0", EME_CODEC_WEBM_VP9}, | 60 {"vp9.0", EME_CODEC_WEBM_VP9}, |
| 60 #if defined(USE_PROPRIETARY_CODECS) | 61 #if defined(USE_PROPRIETARY_CODECS) |
| 62 #if BUILDFLAG(ENABLE_MP4_VP8_VP9_DEMUXING) |
| 63 {"vp08", EME_CODEC_MP4_VP8}, |
| 64 {"vp09", EME_CODEC_MP4_VP9}, |
| 65 #endif |
| 61 {"mp4a", EME_CODEC_MP4_AAC}, | 66 {"mp4a", EME_CODEC_MP4_AAC}, |
| 62 {"avc1", EME_CODEC_MP4_AVC1}, | 67 {"avc1", EME_CODEC_MP4_AVC1}, |
| 63 {"avc3", EME_CODEC_MP4_AVC1} | 68 {"avc3", EME_CODEC_MP4_AVC1} |
| 64 #endif // defined(USE_PROPRIETARY_CODECS) | 69 #endif // defined(USE_PROPRIETARY_CODECS) |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 static EmeRobustness ConvertRobustness(const std::string& robustness) { | 72 static EmeRobustness ConvertRobustness(const std::string& robustness) { |
| 68 if (robustness.empty()) | 73 if (robustness.empty()) |
| 69 return EmeRobustness::EMPTY; | 74 return EmeRobustness::EMPTY; |
| 70 if (robustness == "SW_SECURE_CRYPTO") | 75 if (robustness == "SW_SECURE_CRYPTO") |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 KeySystemsImpl::GetInstance()->AddContainerMask(container, mask); | 943 KeySystemsImpl::GetInstance()->AddContainerMask(container, mask); |
| 939 } | 944 } |
| 940 | 945 |
| 941 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, | 946 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, |
| 942 const std::string& codec, | 947 const std::string& codec, |
| 943 uint32_t mask) { | 948 uint32_t mask) { |
| 944 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); | 949 KeySystemsImpl::GetInstance()->AddCodecMask(media_type, codec, mask); |
| 945 } | 950 } |
| 946 | 951 |
| 947 } // namespace media | 952 } // namespace media |
| OLD | NEW |