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 "content/renderer/media/crypto/key_systems.h" | 5 #include "content/renderer/media/crypto/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 {"audio/mp4", EME_CODEC_MP4_AUDIO_ALL}, | 43 {"audio/mp4", EME_CODEC_MP4_AUDIO_ALL}, |
44 {"video/mp4", EME_CODEC_MP4_ALL} | 44 {"video/mp4", EME_CODEC_MP4_ALL} |
45 #endif // defined(USE_PROPRIETARY_CODECS) | 45 #endif // defined(USE_PROPRIETARY_CODECS) |
46 }; | 46 }; |
47 | 47 |
48 // Mapping between codec types and their masks. | 48 // Mapping between codec types and their masks. |
49 CodecMask kCodecMasks[] = { | 49 CodecMask kCodecMasks[] = { |
50 {"vorbis", EME_CODEC_WEBM_VORBIS}, | 50 {"vorbis", EME_CODEC_WEBM_VORBIS}, |
51 {"vp8", EME_CODEC_WEBM_VP8}, | 51 {"vp8", EME_CODEC_WEBM_VP8}, |
52 {"vp8.0", EME_CODEC_WEBM_VP8}, | 52 {"vp8.0", EME_CODEC_WEBM_VP8}, |
| 53 {"vp9", EME_CODEC_WEBM_VP9}, |
| 54 {"vp9.0", EME_CODEC_WEBM_VP9}, |
53 #if defined(USE_PROPRIETARY_CODECS) | 55 #if defined(USE_PROPRIETARY_CODECS) |
54 {"mp4a", EME_CODEC_MP4_AAC}, | 56 {"mp4a", EME_CODEC_MP4_AAC}, |
55 {"avc1", EME_CODEC_MP4_AVC1}, | 57 {"avc1", EME_CODEC_MP4_AVC1}, |
56 {"avc3", EME_CODEC_MP4_AVC1} | 58 {"avc3", EME_CODEC_MP4_AVC1} |
57 #endif // defined(USE_PROPRIETARY_CODECS) | 59 #endif // defined(USE_PROPRIETARY_CODECS) |
58 }; | 60 }; |
59 | 61 |
60 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { | 62 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
61 KeySystemInfo info(kClearKeyKeySystem); | 63 KeySystemInfo info(kClearKeyKeySystem); |
62 | 64 |
63 // On Android, Vorbis, VP8, AAC and AVC1 are supported in all MediaCodec | 65 // On Android, Vorbis, VP8, AAC and AVC1 are supported in MediaCodec: |
64 // implementations: | |
65 // http://developer.android.com/guide/appendix/media-formats.html | 66 // http://developer.android.com/guide/appendix/media-formats.html |
| 67 // VP9 support is device dependent. |
66 | 68 |
67 info.supported_codecs = EME_CODEC_WEBM_ALL; | 69 info.supported_codecs = EME_CODEC_WEBM_ALL; |
| 70 |
| 71 #if defined(OS_ANDROID) |
| 72 // Temporarily disable VP9 support for Android. |
| 73 // TODO(xhwang): Use mime_util.h to query VP9 support on Android. |
| 74 info.supported_codecs &= ~EME_CODEC_WEBM_VP9; |
| 75 #endif // defined(OS_ANDROID) |
| 76 |
68 #if defined(USE_PROPRIETARY_CODECS) | 77 #if defined(USE_PROPRIETARY_CODECS) |
69 info.supported_codecs |= EME_CODEC_MP4_ALL; | 78 info.supported_codecs |= EME_CODEC_MP4_ALL; |
70 #endif // defined(USE_PROPRIETARY_CODECS) | 79 #endif // defined(USE_PROPRIETARY_CODECS) |
71 | 80 |
72 info.use_aes_decryptor = true; | 81 info.use_aes_decryptor = true; |
73 | 82 |
74 concrete_key_systems->push_back(info); | 83 concrete_key_systems->push_back(info); |
75 } | 84 } |
76 | 85 |
77 class KeySystems { | 86 class KeySystems { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 CONTENT_EXPORT void AddContainerMask(const std::string& container, | 453 CONTENT_EXPORT void AddContainerMask(const std::string& container, |
445 uint32 mask) { | 454 uint32 mask) { |
446 KeySystems::GetInstance().AddContainerMask(container, mask); | 455 KeySystems::GetInstance().AddContainerMask(container, mask); |
447 } | 456 } |
448 | 457 |
449 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { | 458 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { |
450 KeySystems::GetInstance().AddCodecMask(codec, mask); | 459 KeySystems::GetInstance().AddCodecMask(codec, mask); |
451 } | 460 } |
452 | 461 |
453 } // namespace content | 462 } // namespace content |
OLD | NEW |