OLD | NEW |
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 Loading... |
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. | 41 // TODO(ddorwin): Automatically support parent systems: http://crbug.com/164303. |
44 static const char kWidevineBaseKeySystem[] = "com.widevine"; | 42 static const char kWidevineBaseKeySystem[] = "com.widevine"; |
45 | 43 |
46 // Specifies the container and codec combinations supported by individual | 44 // Specifies the container and codec combinations supported by individual |
47 // key systems. Each line is a container-codecs combination and the key system | 45 // key systems. Each line is a container-codecs combination and the key system |
48 // that supports it. Multiple codecs can be listed. A trailing commas in | 46 // that supports it. Multiple codecs can be listed. A trailing commas in |
49 // the |codecs_list| allows the container to be specified without a codec. | 47 // the |codecs_list| allows the container to be specified without a codec. |
50 // This list is converted at runtime into individual container-codec-key system | 48 // This list is converted at runtime into individual container-codec-key system |
51 // entries in KeySystems::key_system_map_. | 49 // entries in KeySystems::key_system_map_. |
52 static const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[] = { | 50 static const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[] = { |
53 // Clear Key. | 51 // Clear Key. |
54 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED) | |
55 { "video/webm", "vp8,vp8.0,", kClearKeyKeySystem }, | |
56 #else | |
57 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, | 52 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, |
58 { "audio/webm", "vorbis,", kClearKeyKeySystem }, | 53 { "audio/webm", "vorbis,", kClearKeyKeySystem }, |
59 #endif | |
60 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 54 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
61 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED) | |
62 { "video/mp4", "avc1,", kClearKeyKeySystem }, | |
63 #else | |
64 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem }, | 55 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem }, |
65 { "audio/mp4", "mp4a,", kClearKeyKeySystem }, | 56 { "audio/mp4", "mp4a,", kClearKeyKeySystem }, |
66 #endif | 57 #endif |
67 #endif | |
68 | 58 |
69 // External Clear Key (used for testing). | 59 // External Clear Key (used for testing). |
70 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, | 60 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, |
71 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, | 61 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, |
72 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 62 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
73 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem }, | 63 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem }, |
74 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem }, | 64 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem }, |
75 #endif | 65 #endif |
76 | 66 |
77 #if defined(WIDEVINE_CDM_AVAILABLE) | 67 #if defined(WIDEVINE_CDM_AVAILABLE) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 std::string GetPluginType(const std::string& key_system) { | 229 std::string GetPluginType(const std::string& key_system) { |
240 for (size_t i = 0; i < arraysize(kKeySystemToPluginTypeMapping); ++i) { | 230 for (size_t i = 0; i < arraysize(kKeySystemToPluginTypeMapping); ++i) { |
241 if (kKeySystemToPluginTypeMapping[i].key_system == key_system) | 231 if (kKeySystemToPluginTypeMapping[i].key_system == key_system) |
242 return kKeySystemToPluginTypeMapping[i].plugin_type; | 232 return kKeySystemToPluginTypeMapping[i].plugin_type; |
243 } | 233 } |
244 | 234 |
245 return std::string(); | 235 return std::string(); |
246 } | 236 } |
247 | 237 |
248 } // namespace webkit_media | 238 } // namespace webkit_media |
OLD | NEW |