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

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: 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
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..2e20b643068159b92d0c21428be745abb274d477 100644
--- a/webkit/media/crypto/key_systems.cc
+++ b/webkit/media/crypto/key_systems.cc
@@ -7,12 +7,14 @@
#include "media/base/decryptor.h"
#include "media/crypto/aes_decryptor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "webkit/media/crypto/ppapi_decryptor.h"
namespace webkit_media {
namespace {
const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
+const char kExternalClearKeyKeySystem[] = "webkit-org.w3.external-clearkey";
ddorwin 2012/07/17 21:31:28 I haven't thought this through entirely, but it se
xhwang 2012/07/18 19:43:17 Done.
struct MediaFormatAndKeySystem {
const char* mime_type;
@@ -20,6 +22,11 @@ struct MediaFormatAndKeySystem {
const char* key_system;
};
+struct KeySystemPluginNamePair {
ddorwin 2012/07/17 21:31:28 MimeType here and below.
xhwang 2012/07/18 19:43:17 Use PluginType as discussed.
+ const char* key_system;
+ const char* plugin_name;
+};
+
static const MediaFormatAndKeySystem
supported_format_key_system_combinations[] = {
// TODO(ddorwin): Reconsider based on how usage of this class evolves.
@@ -36,6 +43,11 @@ supported_format_key_system_combinations[] = {
{ "audio/webm", "", kClearKeyKeySystem }
ddorwin 2012/07/17 21:31:28 Need to update these tables too.
xhwang 2012/07/18 19:43:17 Done.
};
+static const KeySystemPluginNamePair key_system_to_plugin_name_mapping[] = {
+ // TODO(xhwang): Update this with the real plugin name.
+ { kExternalClearKeyKeySystem, "application/x-ppapi-example" }
ddorwin 2012/07/17 21:31:28 FYI, the same TODO as in the above table would app
+};
+
bool IsSupportedKeySystemWithContainerAndCodec(const std::string& mime_type,
const std::string& codec,
const std::string& key_system) {
@@ -77,10 +89,24 @@ bool IsSupportedKeySystemWithMediaMimeType(
return true;
}
-scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system,
- media::DecryptorClient* client) {
+const char* GetPluginName(const std::string& key_system) {
+ for (size_t i = 0; i < arraysize(key_system_to_plugin_name_mapping); ++i) {
+ if (key_system_to_plugin_name_mapping[i].key_system == key_system)
+ return key_system_to_plugin_name_mapping[i].plugin_name;
+ }
+
+ return NULL;
+}
+
+scoped_ptr<media::Decryptor> CreateDecryptor(
+ const std::string& key_system,
+ media::DecryptorClient* client,
+ const CreatePluginCB& create_plugin_cb) {
ddorwin 2012/07/17 21:31:28 It's unexpected that this cb isn't always called.
xhwang 2012/07/18 19:43:17 Removed CreatePluginCB and just passing the client
if (key_system == kClearKeyKeySystem)
return scoped_ptr<media::Decryptor>(new media::AesDecryptor(client));
+ else if (key_system == kExternalClearKeyKeySystem)
ddorwin 2012/07/17 21:31:28 I think we should GetPlugingMimeType() and if not
xhwang 2012/07/18 19:43:17 Moved this check and related logic into PpapiDecry
+ return scoped_ptr<media::Decryptor>(
+ new webkit_media::PpapiDecryptor(client, create_plugin_cb));
return scoped_ptr<media::Decryptor>();
}

Powered by Google App Engine
This is Rietveld 408576698