Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 {"audio/webm", EME_CODEC_WEBM_AUDIO_ALL}, | 53 {"audio/webm", EME_CODEC_WEBM_AUDIO_ALL}, |
| 54 {"video/webm", EME_CODEC_WEBM_ALL}, | 54 {"video/webm", EME_CODEC_WEBM_ALL}, |
| 55 #if defined(USE_PROPRIETARY_CODECS) | 55 #if defined(USE_PROPRIETARY_CODECS) |
| 56 {"audio/mp4", EME_CODEC_MP4_AUDIO_ALL}, | 56 {"audio/mp4", EME_CODEC_MP4_AUDIO_ALL}, |
| 57 {"video/mp4", EME_CODEC_MP4_ALL} | 57 {"video/mp4", EME_CODEC_MP4_ALL} |
| 58 #endif // defined(USE_PROPRIETARY_CODECS) | 58 #endif // defined(USE_PROPRIETARY_CODECS) |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Mapping between codec names and enum values. | 61 // Mapping between codec names and enum values. |
| 62 static NamedCodec kCodecStrings[] = { | 62 static NamedCodec kCodecStrings[] = { |
| 63 {"opus", EME_CODEC_WEBM_OPUS}, | |
| 63 {"vorbis", EME_CODEC_WEBM_VORBIS}, | 64 {"vorbis", EME_CODEC_WEBM_VORBIS}, |
| 64 {"vp8", EME_CODEC_WEBM_VP8}, | 65 {"vp8", EME_CODEC_WEBM_VP8}, |
| 65 {"vp8.0", EME_CODEC_WEBM_VP8}, | 66 {"vp8.0", EME_CODEC_WEBM_VP8}, |
| 66 {"vp9", EME_CODEC_WEBM_VP9}, | 67 {"vp9", EME_CODEC_WEBM_VP9}, |
| 67 {"vp9.0", EME_CODEC_WEBM_VP9}, | 68 {"vp9.0", EME_CODEC_WEBM_VP9}, |
| 68 #if defined(USE_PROPRIETARY_CODECS) | 69 #if defined(USE_PROPRIETARY_CODECS) |
| 69 {"mp4a", EME_CODEC_MP4_AAC}, | 70 {"mp4a", EME_CODEC_MP4_AAC}, |
| 70 {"avc1", EME_CODEC_MP4_AVC1}, | 71 {"avc1", EME_CODEC_MP4_AVC1}, |
| 71 {"avc3", EME_CODEC_MP4_AVC1} | 72 {"avc3", EME_CODEC_MP4_AVC1} |
| 72 #endif // defined(USE_PROPRIETARY_CODECS) | 73 #endif // defined(USE_PROPRIETARY_CODECS) |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { | 76 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
| 76 KeySystemInfo info(kClearKeyKeySystem); | 77 KeySystemInfo info(kClearKeyKeySystem); |
| 77 | 78 |
| 78 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: | 79 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: |
| 79 // http://developer.android.com/guide/appendix/media-formats.html | 80 // http://developer.android.com/guide/appendix/media-formats.html |
| 80 // VP9 support is device dependent. | 81 // VP9 support is device dependent. |
| 81 | 82 |
| 82 info.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; | 83 info.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; |
| 83 info.supported_codecs = EME_CODEC_WEBM_ALL; | 84 info.supported_codecs = EME_CODEC_WEBM_ALL; |
|
ddorwin
2014/11/25 20:54:51
In a separate CL, we should stop using _ALL, which
| |
| 84 | 85 |
| 85 #if defined(OS_ANDROID) | 86 #if defined(OS_ANDROID) |
| 86 // Temporarily disable VP9 support for Android. | 87 // Temporarily disable VP9 support for Android. |
| 87 // TODO(xhwang): Use mime_util.h to query VP9 support on Android. | 88 // TODO(xhwang): Use mime_util.h to query VP9 support on Android. |
| 88 info.supported_codecs &= ~EME_CODEC_WEBM_VP9; | 89 info.supported_codecs &= ~EME_CODEC_WEBM_VP9; |
| 90 | |
| 91 // Opus is not supported on Android yet. http://crbug.com/318436. | |
| 92 // TODO(sandersd): Check for platform support to set this bit. | |
| 93 info.supported_codecs &= ~EME_CODEC_WEBM_OPUS; | |
| 89 #endif // defined(OS_ANDROID) | 94 #endif // defined(OS_ANDROID) |
| 90 | 95 |
| 91 #if defined(USE_PROPRIETARY_CODECS) | 96 #if defined(USE_PROPRIETARY_CODECS) |
| 92 info.supported_init_data_types |= EME_INIT_DATA_TYPE_CENC; | 97 info.supported_init_data_types |= EME_INIT_DATA_TYPE_CENC; |
| 93 info.supported_codecs |= EME_CODEC_MP4_ALL; | 98 info.supported_codecs |= EME_CODEC_MP4_ALL; |
| 94 #endif // defined(USE_PROPRIETARY_CODECS) | 99 #endif // defined(USE_PROPRIETARY_CODECS) |
| 95 | 100 |
| 96 info.use_aes_decryptor = true; | 101 info.use_aes_decryptor = true; |
| 97 | 102 |
| 98 concrete_key_systems->push_back(info); | 103 concrete_key_systems->push_back(info); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 MEDIA_EXPORT void AddContainerMask(const std::string& container, | 647 MEDIA_EXPORT void AddContainerMask(const std::string& container, |
| 643 uint32 mask) { | 648 uint32 mask) { |
| 644 KeySystems::GetInstance().AddContainerMask(container, mask); | 649 KeySystems::GetInstance().AddContainerMask(container, mask); |
| 645 } | 650 } |
| 646 | 651 |
| 647 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { | 652 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { |
| 648 KeySystems::GetInstance().AddCodecMask(codec, mask); | 653 KeySystems::GetInstance().AddCodecMask(codec, mask); |
| 649 } | 654 } |
| 650 | 655 |
| 651 } // namespace media | 656 } // namespace media |
| OLD | NEW |