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

Unified Diff: webkit/media/crypto/key_systems.cc

Issue 10704241: Add PpapiDecryptor which wraps a CDM plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add webkit bug in comments. Created 8 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/media/crypto/key_systems.h ('k') | webkit/media/crypto/ppapi_decryptor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..11a307c8ad671af4e6d7ad343f7da11ca634fb51 100644
--- a/webkit/media/crypto/key_systems.cc
+++ b/webkit/media/crypto/key_systems.cc
@@ -4,15 +4,14 @@
#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 {
-namespace {
-
-const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
+static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
+static const char kExternalClearKeyKeySystem[] =
+ "org.chromium.externalclearkey";
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
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,12 +37,24 @@ 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 }
};
-bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type,
- const std::string& codec,
- const std::string& key_system) {
+static const KeySystemPluginTypePair key_system_to_plugin_type_mapping[] = {
+ // TODO(xhwang): Update this with the real plugin name.
+ { kExternalClearKeyKeySystem, "application/x-ppapi-example" }
+};
+
+static bool IsSupportedKeySystemWithContainerAndCodec(
+ const std::string& mime_type,
+ const std::string& codec,
+ const std::string& key_system) {
for (size_t i = 0;
i < arraysize(supported_format_key_system_combinations);
++i) {
@@ -53,12 +69,9 @@ bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type,
return false;
}
-} // 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 +90,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
« no previous file with comments | « webkit/media/crypto/key_systems.h ('k') | webkit/media/crypto/ppapi_decryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698