Chromium Code Reviews| Index: webkit/media/crypto/key_systems.cc |
| diff --git a/webkit/media/crypto/key_systems.cc b/webkit/media/crypto/key_systems.cc |
| index b4aeb90b56ce84bb11f981889a09abd04ea78a84..1e8365b3fd458ede330ff912b5c6379f43b5062c 100644 |
| --- a/webkit/media/crypto/key_systems.cc |
| +++ b/webkit/media/crypto/key_systems.cc |
| @@ -4,8 +4,6 @@ |
| #include "webkit/media/crypto/key_systems.h" |
| -#include "media/base/decryptor.h" |
| -#include "media/crypto/aes_decryptor.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| namespace webkit_media { |
| @@ -13,6 +11,7 @@ namespace webkit_media { |
| namespace { |
| const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
| +const char kExternalClearKeyKeySystem[] = "org.chromium.external-clearkey"; |
|
ddorwin
2012/07/19 01:12:34
Not sure whether we should use a '-'. I guess it's
xhwang
2012/07/19 15:54:34
Done.
|
| struct MediaFormatAndKeySystem { |
| const char* mime_type; |
| @@ -20,12 +19,17 @@ struct MediaFormatAndKeySystem { |
| const char* key_system; |
| }; |
| +struct KeySystemPluginTypePair { |
| + const char* key_system; |
| + const char* plugin_type; |
| +}; |
| + |
| static const MediaFormatAndKeySystem |
|
xhwang
2012/07/19 15:54:34
We have both anonymous namespace and static functi
ddorwin
2012/07/19 20:50:09
SG. I guess both are allowed (last paragraph): htt
xhwang
2012/07/19 21:54:03
Done.
|
| supported_format_key_system_combinations[] = { |
| // TODO(ddorwin): Reconsider based on how usage of this class evolves. |
| // For now, this class is stateless, so we do not have the opportunity to |
| // build a list using ParseCodecString() like |
| - // net::MimeUtil::InitializeMimeTypeMaps(). Therfore, the following line must |
| + // net::MimeUtil::InitializeMimeTypeMaps(). Therefore, the following line must |
| // be separate entries. |
| // { "video/webm", "vorbis,vp8,vp8.0", kClearKeyKeySystem }, |
| { "video/webm", "vorbis", kClearKeyKeySystem }, |
| @@ -33,7 +37,18 @@ supported_format_key_system_combinations[] = { |
| { "video/webm", "vp8.0", kClearKeyKeySystem }, |
| { "audio/webm", "vorbis", kClearKeyKeySystem }, |
| { "video/webm", "", kClearKeyKeySystem }, |
| - { "audio/webm", "", kClearKeyKeySystem } |
| + { "audio/webm", "", kClearKeyKeySystem }, |
| + { "video/webm", "vorbis", kExternalClearKeyKeySystem }, |
| + { "video/webm", "vp8", kExternalClearKeyKeySystem }, |
| + { "video/webm", "vp8.0", kExternalClearKeyKeySystem }, |
| + { "audio/webm", "vorbis", kExternalClearKeyKeySystem }, |
| + { "video/webm", "", kExternalClearKeyKeySystem }, |
| + { "audio/webm", "", kExternalClearKeyKeySystem } |
| +}; |
| + |
| +static const KeySystemPluginTypePair key_system_to_plugin_type_mapping[] = { |
| + // TODO(xhwang): Update this with the real plugin name. |
| + { kExternalClearKeyKeySystem, "application/x-ppapi-example" } |
| }; |
| bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type, |
| @@ -56,7 +71,8 @@ bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type, |
| } // namespace |
| bool IsSupportedKeySystem(const WebKit::WebString& key_system) { |
| - if (key_system == kClearKeyKeySystem) |
| + if (key_system == kClearKeyKeySystem || |
|
ddorwin
2012/07/19 01:12:34
We _could_ replace this with:
if (CanUseAesDecry
xhwang
2012/07/19 15:54:34
Done.
|
| + key_system == kExternalClearKeyKeySystem) |
| return true; |
| return false; |
| } |
| @@ -77,11 +93,17 @@ bool IsSupportedKeySystemWithMediaMimeType( |
| return true; |
| } |
| -scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system, |
| - media::DecryptorClient* client) { |
| - if (key_system == kClearKeyKeySystem) |
| - return scoped_ptr<media::Decryptor>(new media::AesDecryptor(client)); |
| - return scoped_ptr<media::Decryptor>(); |
| +bool CanUseAesDecryptor(const std::string& key_system) { |
| + return key_system == kClearKeyKeySystem; |
| +} |
| + |
| +const char* GetPluginType(const std::string& key_system) { |
| + for (size_t i = 0; i < arraysize(key_system_to_plugin_type_mapping); ++i) { |
| + if (key_system_to_plugin_type_mapping[i].key_system == key_system) |
| + return key_system_to_plugin_type_mapping[i].plugin_type; |
| + } |
| + |
| + return NULL; |
| } |
| } // namespace webkit_media |