Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: webkit/media/crypto/key_systems.cc

Issue 11474037: Several updates to canPlayType() results for EME (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/media/crypto/key_systems_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 6
7 #include "webkit/media/crypto/key_systems.h" 7 #include "webkit/media/crypto/key_systems.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 20 matching lines...) Expand all
31 const char* mime_type; 31 const char* mime_type;
32 const char* codecs_list; 32 const char* codecs_list;
33 const char* key_system; 33 const char* key_system;
34 }; 34 };
35 35
36 struct KeySystemPluginTypePair { 36 struct KeySystemPluginTypePair {
37 const char* key_system; 37 const char* key_system;
38 const char* plugin_type; 38 const char* plugin_type;
39 }; 39 };
40 40
41 // TODO(xhwang): Remove this and ifdefs after fixing http://crbug.com/123421.
42 #define DECRYPT_ONLY_AUDIO_NOT_SUPPORTED
43 // TODO(ddorwin): Automatically support parent systems: http://crbug.com/164303.
44 static const char kWidevineBaseKeySystem[] = "com.widevine";
45
41 // Specifies the container and codec combinations supported by individual 46 // Specifies the container and codec combinations supported by individual
42 // key systems. Each line is a container-codecs combination and the key system 47 // key systems. Each line is a container-codecs combination and the key system
43 // that supports it. Multiple codecs can be listed. A trailing commas in 48 // that supports it. Multiple codecs can be listed. A trailing commas in
44 // the |codecs_list| allows the container to be specified without a codec. 49 // the |codecs_list| allows the container to be specified without a codec.
45 // This list is converted at runtime into individual container-codec-key system 50 // This list is converted at runtime into individual container-codec-key system
46 // entries in KeySystems::key_system_map_. 51 // entries in KeySystems::key_system_map_.
47 static const MediaFormatAndKeySystem 52 static const MediaFormatAndKeySystem
48 supported_format_key_system_combinations[] = { 53 supported_format_key_system_combinations[] = {
49 // Clear Key. 54 // Clear Key.
55 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED)
56 { "video/webm", "vp8,vp8.0,", kClearKeyKeySystem },
57 #else
50 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, 58 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem },
51 { "audio/webm", "vorbis,", kClearKeyKeySystem }, 59 { "audio/webm", "vorbis,", kClearKeyKeySystem },
60 #endif
52 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) 61 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
62 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED)
63 { "video/mp4", "avc1,", kClearKeyKeySystem },
64 #else
53 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem }, 65 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem },
54 { "audio/mp4", "mp4a,", kClearKeyKeySystem }, 66 { "audio/mp4", "mp4a,", kClearKeyKeySystem },
55 #endif 67 #endif
68 #endif
56 69
57 // External Clear Key (used for testing). 70 // External Clear Key (used for testing).
58 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, 71 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem },
59 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, 72 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem },
60 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) 73 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
61 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem }, 74 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem },
62 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem }, 75 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem },
63 #endif 76 #endif
64 77
65 #if defined(WIDEVINE_CDM_AVAILABLE) 78 #if defined(WIDEVINE_CDM_AVAILABLE)
66 // Widevine. 79 // Widevine.
67 { "video/webm", "vorbis,vp8,vp8.0,", kWidevineKeySystem }, 80 { "video/webm", "vorbis,vp8,vp8.0,", kWidevineKeySystem },
68 { "audio/webm", "vorbis,", kWidevineKeySystem }, 81 { "audio/webm", "vorbis,", kWidevineKeySystem },
82 { "video/webm", "vorbis,vp8,vp8.0,", kWidevineBaseKeySystem },
83 { "audio/webm", "vorbis,", kWidevineBaseKeySystem },
84 #if defined(WIDEVINE_CDM_CENC_SUPPORT_AVAILABLE)
85 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
86 { "video/mp4", "avc1,mp4a,", kWidevineKeySystem },
87 { "audio/mp4", "mp4a,", kWidevineKeySystem },
88 { "video/mp4", "avc1,mp4a,", kWidevineBaseKeySystem },
89 { "audio/mp4", "mp4a,", kWidevineBaseKeySystem },
90 #endif
91 #endif
69 #endif // WIDEVINE_CDM_AVAILABLE 92 #endif // WIDEVINE_CDM_AVAILABLE
70 }; 93 };
71 94
72 static const KeySystemPluginTypePair key_system_to_plugin_type_mapping[] = { 95 static const KeySystemPluginTypePair key_system_to_plugin_type_mapping[] = {
73 // TODO(xhwang): Update this with the real plugin name. 96 // TODO(xhwang): Update this with the real plugin name.
74 { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm" }, 97 { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm" },
75 #if defined(WIDEVINE_CDM_AVAILABLE) 98 #if defined(WIDEVINE_CDM_AVAILABLE)
76 { kWidevineKeySystem, kWidevineCdmPluginMimeType } 99 { kWidevineKeySystem, kWidevineCdmPluginMimeType }
77 #endif // WIDEVINE_CDM_AVAILABLE 100 #endif // WIDEVINE_CDM_AVAILABLE
78 }; 101 };
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 DCHECK(mime_types_map.find(combination.mime_type) == 157 DCHECK(mime_types_map.find(combination.mime_type) ==
135 mime_types_map.end()); 158 mime_types_map.end());
136 mime_types_map[combination.mime_type] = codecs; 159 mime_types_map[combination.mime_type] = codecs;
137 } 160 }
138 } 161 }
139 } 162 }
140 163
141 bool KeySystems::IsSupportedKeySystem(const std::string& key_system) { 164 bool KeySystems::IsSupportedKeySystem(const std::string& key_system) {
142 bool is_supported = key_system_map_.find(key_system) != key_system_map_.end(); 165 bool is_supported = key_system_map_.find(key_system) != key_system_map_.end();
143 166
144 DCHECK_EQ(is_supported,
145 (CanUseAesDecryptor(key_system) ||
146 !GetPluginType(key_system).empty()))
147 << "key_system_map_ & key_system_to_plugin_type_mapping are inconsistent";
148 return is_supported; 167 return is_supported;
149 } 168 }
150 169
151 bool KeySystems::IsSupportedKeySystemWithContainerAndCodec( 170 bool KeySystems::IsSupportedKeySystemWithContainerAndCodec(
152 const std::string& mime_type, 171 const std::string& mime_type,
153 const std::string& codec, 172 const std::string& codec,
154 const std::string& key_system) { 173 const std::string& key_system) {
155 174
156 KeySystemMappings::const_iterator key_system_iter = 175 KeySystemMappings::const_iterator key_system_iter =
157 key_system_map_.find(key_system); 176 key_system_map_.find(key_system);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 std::string GetPluginType(const std::string& key_system) { 240 std::string GetPluginType(const std::string& key_system) {
222 for (size_t i = 0; i < arraysize(key_system_to_plugin_type_mapping); ++i) { 241 for (size_t i = 0; i < arraysize(key_system_to_plugin_type_mapping); ++i) {
223 if (key_system_to_plugin_type_mapping[i].key_system == key_system) 242 if (key_system_to_plugin_type_mapping[i].key_system == key_system)
224 return key_system_to_plugin_type_mapping[i].plugin_type; 243 return key_system_to_plugin_type_mapping[i].plugin_type;
225 } 244 }
226 245
227 return std::string(); 246 return std::string();
228 } 247 }
229 248
230 } // namespace webkit_media 249 } // namespace webkit_media
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/media/crypto/key_systems_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698