| 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 <string> | 7 #include <string> |
| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 struct NamedInitDataType { | 32 struct NamedInitDataType { |
| 33 const char* name; | 33 const char* name; |
| 34 EmeInitDataType type; | 34 EmeInitDataType type; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Mapping between initialization data types names and enum values. When adding | 37 // Mapping between initialization data types names and enum values. When adding |
| 38 // entries, make sure to update IsSaneInitDataTypeWithContainer(). | 38 // entries, make sure to update IsSaneInitDataTypeWithContainer(). |
| 39 static NamedInitDataType kInitDataTypeNames[] = { | 39 static NamedInitDataType kInitDataTypeNames[] = { |
| 40 {"webm", EME_INIT_DATA_TYPE_WEBM}, | 40 {"webm", EME_INIT_DATA_TYPE_WEBM}, |
| 41 #if defined(USE_PROPRIETARY_CODECS) | 41 #if defined(USE_PROPRIETARY_CODECS) |
| 42 {"cenc", EME_INIT_DATA_TYPE_CENC} | 42 {"cenc", EME_INIT_DATA_TYPE_CENC}, |
| 43 #endif // defined(USE_PROPRIETARY_CODECS) | 43 #endif // defined(USE_PROPRIETARY_CODECS) |
| 44 {"keyids", EME_INIT_DATA_TYPE_KEYIDS}, |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 struct NamedCodec { | 47 struct NamedCodec { |
| 47 const char* name; | 48 const char* name; |
| 48 EmeCodec type; | 49 EmeCodec type; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 // Mapping between containers and their codecs. | 52 // Mapping between containers and their codecs. |
| 52 // Only audio codec can belong to a "audio/*" container. Both audio and video | 53 // Only audio codec can belong to a "audio/*" container. Both audio and video |
| 53 // codecs can belong to a "video/*" container. | 54 // codecs can belong to a "video/*" container. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { | 79 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
| 79 KeySystemInfo info; | 80 KeySystemInfo info; |
| 80 info.key_system = kClearKeyKeySystem; | 81 info.key_system = kClearKeyKeySystem; |
| 81 | 82 |
| 82 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: | 83 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: |
| 83 // http://developer.android.com/guide/appendix/media-formats.html | 84 // http://developer.android.com/guide/appendix/media-formats.html |
| 84 // VP9 support is device dependent. | 85 // VP9 support is device dependent. |
| 85 | 86 |
| 86 info.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; | 87 info.supported_init_data_types = |
| 88 EME_INIT_DATA_TYPE_WEBM | EME_INIT_DATA_TYPE_KEYIDS; |
| 87 info.supported_codecs = EME_CODEC_WEBM_ALL; | 89 info.supported_codecs = EME_CODEC_WEBM_ALL; |
| 88 | 90 |
| 89 #if defined(OS_ANDROID) | 91 #if defined(OS_ANDROID) |
| 90 // Temporarily disable VP9 support for Android. | 92 // Temporarily disable VP9 support for Android. |
| 91 // TODO(xhwang): Use mime_util.h to query VP9 support on Android. | 93 // TODO(xhwang): Use mime_util.h to query VP9 support on Android. |
| 92 info.supported_codecs &= ~EME_CODEC_WEBM_VP9; | 94 info.supported_codecs &= ~EME_CODEC_WEBM_VP9; |
| 93 | 95 |
| 94 // Opus is not supported on Android yet. http://crbug.com/318436. | 96 // Opus is not supported on Android yet. http://crbug.com/318436. |
| 95 // TODO(sandersd): Check for platform support to set this bit. | 97 // TODO(sandersd): Check for platform support to set this bit. |
| 96 info.supported_codecs &= ~EME_CODEC_WEBM_OPUS; | 98 info.supported_codecs &= ~EME_CODEC_WEBM_OPUS; |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 888 |
| 887 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { | 889 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask) { |
| 888 KeySystems::GetInstance().AddContainerMask(container, mask); | 890 KeySystems::GetInstance().AddContainerMask(container, mask); |
| 889 } | 891 } |
| 890 | 892 |
| 891 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { | 893 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { |
| 892 KeySystems::GetInstance().AddCodecMask(codec, mask); | 894 KeySystems::GetInstance().AddCodecMask(codec, mask); |
| 893 } | 895 } |
| 894 | 896 |
| 895 } // namespace media | 897 } // namespace media |
| OLD | NEW |