| 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..a420b336377abc0a200d90f8e2893e7989393d40 100644
|
| --- a/webkit/media/crypto/key_systems.cc
|
| +++ b/webkit/media/crypto/key_systems.cc
|
| @@ -4,8 +4,7 @@
|
|
|
| #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/WebCString.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
|
|
| namespace webkit_media {
|
| @@ -13,6 +12,7 @@ namespace webkit_media {
|
| namespace {
|
|
|
| const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
|
| +const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
|
|
|
| struct MediaFormatAndKeySystem {
|
| const char* mime_type;
|
| @@ -20,12 +20,17 @@ struct MediaFormatAndKeySystem {
|
| const char* key_system;
|
| };
|
|
|
| +struct KeySystemPluginTypePair {
|
| + const char* key_system;
|
| + const char* plugin_type;
|
| +};
|
| +
|
| static const MediaFormatAndKeySystem
|
| 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 +38,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,9 +72,8 @@ bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type,
|
| } // namespace
|
|
|
| bool IsSupportedKeySystem(const WebKit::WebString& key_system) {
|
| - if (key_system == kClearKeyKeySystem)
|
| - return true;
|
| - return false;
|
| + return CanUseAesDecryptor(key_system.utf8().data()) ||
|
| + !GetPluginType(key_system.utf8().data()).empty();
|
| }
|
|
|
| bool IsSupportedKeySystemWithMediaMimeType(
|
| @@ -77,11 +92,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;
|
| +}
|
| +
|
| +std::string 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 std::string();
|
| }
|
|
|
| } // namespace webkit_media
|
|
|