Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
ddorwin
2012/12/14 05:17:01
There is a unit tests for this. You need to update
xhwang
2012/12/14 05:50:07
Done.
| |
| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 19 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 | 50 static const MediaFormatAndKeySystem |
| 53 supported_format_key_system_combinations[] = { | 51 supported_format_key_system_combinations[] = { |
| 54 // Clear Key. | 52 // Clear Key. |
| 55 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED) | |
| 56 { "video/webm", "vp8,vp8.0,", kClearKeyKeySystem }, | |
| 57 #else | |
| 58 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, | 53 { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, |
| 59 { "audio/webm", "vorbis,", kClearKeyKeySystem }, | 54 { "audio/webm", "vorbis,", kClearKeyKeySystem }, |
| 60 #endif | |
| 61 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 55 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
| 62 #if defined(DECRYPT_ONLY_AUDIO_NOT_SUPPORTED) | |
| 63 { "video/mp4", "avc1,", kClearKeyKeySystem }, | |
| 64 #else | |
| 65 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem }, | 56 { "video/mp4", "avc1,mp4a,", kClearKeyKeySystem }, |
| 66 { "audio/mp4", "mp4a,", kClearKeyKeySystem }, | 57 { "audio/mp4", "mp4a,", kClearKeyKeySystem }, |
| 67 #endif | 58 #endif |
| 68 #endif | |
| 69 | 59 |
| 70 // External Clear Key (used for testing). | 60 // External Clear Key (used for testing). |
| 71 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, | 61 { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, |
| 72 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, | 62 { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, |
| 73 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 63 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
| 74 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem }, | 64 { "video/mp4", "avc1,mp4a,", kExternalClearKeyKeySystem }, |
| 75 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem }, | 65 { "audio/mp4", "mp4a,", kExternalClearKeyKeySystem }, |
| 76 #endif | 66 #endif |
| 77 | 67 |
| 78 #if defined(WIDEVINE_CDM_AVAILABLE) | 68 #if defined(WIDEVINE_CDM_AVAILABLE) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 std::string GetPluginType(const std::string& key_system) { | 230 std::string GetPluginType(const std::string& key_system) { |
| 241 for (size_t i = 0; i < arraysize(key_system_to_plugin_type_mapping); ++i) { | 231 for (size_t i = 0; i < arraysize(key_system_to_plugin_type_mapping); ++i) { |
| 242 if (key_system_to_plugin_type_mapping[i].key_system == key_system) | 232 if (key_system_to_plugin_type_mapping[i].key_system == key_system) |
| 243 return key_system_to_plugin_type_mapping[i].plugin_type; | 233 return key_system_to_plugin_type_mapping[i].plugin_type; |
| 244 } | 234 } |
| 245 | 235 |
| 246 return std::string(); | 236 return std::string(); |
| 247 } | 237 } |
| 248 | 238 |
| 249 } // namespace webkit_media | 239 } // namespace webkit_media |
| OLD | NEW |