diff options
author | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 00:10:09 +0000 |
---|---|---|
committer | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 00:10:09 +0000 |
commit | a9cde19aba88ab75887dc6f696e74f405c786e22 (patch) | |
tree | ebcb7090e09b076a66b4df6025178f1be1bc7d87 | |
parent | b97d349ad8f6b1da6a15ed7d6cd3b0eef930b86b (diff) | |
download | chromium_src-a9cde19aba88ab75887dc6f696e74f405c786e22.zip chromium_src-a9cde19aba88ab75887dc6f696e74f405c786e22.tar.gz chromium_src-a9cde19aba88ab75887dc6f696e74f405c786e22.tar.bz2 |
Add the Widevine CDM to Chrome.
This CL adds the key system and enables the media stack to find the CDM.
BUG=149772
TEST=Play content that uses this key system.
Review URL: https://chromiumcodereview.appspot.com/11099059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161455 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome_common.gypi | 1 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 6 | ||||
-rw-r--r-- | chrome/common/chrome_content_client.cc | 34 | ||||
-rw-r--r-- | chrome/common/chrome_paths.cc | 17 | ||||
-rw-r--r-- | chrome/common/chrome_paths.h | 2 | ||||
-rw-r--r-- | chrome/common_constants.gyp | 8 | ||||
-rw-r--r-- | third_party/widevine/cdm/widevine_cdm_common.h | 33 | ||||
-rw-r--r-- | third_party/widevine/cdm/widevine_cdm_version.h | 3 | ||||
-rw-r--r-- | webkit/media/crypto/key_systems.cc | 15 | ||||
-rw-r--r-- | webkit/media/webkit_media.gypi | 4 |
10 files changed, 114 insertions, 9 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 7b26b21..49399b2 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -52,6 +52,7 @@ '<(DEPTH)/third_party/mt19937ar/mt19937ar.gyp:mt19937ar', '<(DEPTH)/third_party/re2/re2.gyp:re2', '<(DEPTH)/third_party/sqlite/sqlite.gyp:sqlite', + '<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', '<(DEPTH)/third_party/zlib/zlib.gyp:zlib', '<(DEPTH)/ui/ui.gyp:ui_resources', '<(DEPTH)/webkit/support/webkit_support.gyp:glue', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index c454867..a3a6d8d 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -4277,7 +4277,7 @@ 'product_name': 'app_mode_app_tests', 'dependencies': [ '../base/base.gyp:test_support_base', - '../chrome/common_constants.gyp:common_constants', + '../chrome/common_constants.gyp:common_constants', '../testing/gtest.gyp:gtest', 'chrome.gyp:chrome', # run time dependency 'app_mode_app_support', @@ -4303,6 +4303,9 @@ { 'target_name': 'perf_tests', 'type': 'executable', + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', # Needed by key_systems.cc. + ], 'dependencies': [ 'browser', 'chrome_resources.gyp:chrome_resources', @@ -4317,6 +4320,7 @@ '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', '../webkit/support/webkit_support.gyp:glue', + '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'sources': [ 'browser/net/sqlite_persistent_cookie_store_perftest.cc', diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index f9c8330..69f1e36 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -36,6 +36,7 @@ #include "webkit/user_agent/user_agent_util.h" #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #if defined(OS_WIN) #include "base/win/registry.h" @@ -79,8 +80,11 @@ const char kGTalkPluginDescription[] = "Google Talk Plugin"; const uint32 kGTalkPluginPermissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV; -const char kInterposeLibraryPath[] = - "@executable_path/../../../libplugin_carbon_interpose.dylib"; +#if defined(WIDEVINE_CDM_AVAILABLE) +const char kWidevineCdmPluginExtension[] = ""; +const uint32 kWidevineCdmPluginPermissions = ppapi::PERMISSION_PRIVATE | + ppapi::PERMISSION_DEV; +#endif // WIDEVINE_CDM_AVAILABLE #if defined(ENABLE_REMOTING) #if defined(GOOGLE_CHROME_BUILD) @@ -102,6 +106,9 @@ const char kRemotingViewerPluginMimeExtension[] = ""; const char kRemotingViewerPluginMimeDescription[] = ""; #endif // defined(ENABLE_REMOTING) +const char kInterposeLibraryPath[] = + "@executable_path/../../../libplugin_carbon_interpose.dylib"; + // Appends the known built-in plugins to the given vector. Some built-in // plugins are "internal" which means they are compiled into the Chrome binary, // and some are extra shared libraries distributed with the browser (these are @@ -196,6 +203,29 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { } } +#if defined(WIDEVINE_CDM_AVAILABLE) + static bool skip_widevine_cdm_file_check = false; + if (PathService::Get(chrome::FILE_WIDEVINE_CDM_PLUGIN, &path)) { + if (skip_widevine_cdm_file_check || file_util::PathExists(path)) { + content::PepperPluginInfo widevine_cdm; + widevine_cdm.is_out_of_process = true; + widevine_cdm.path = path; + widevine_cdm.name = kWidevineCdmPluginName; + widevine_cdm.description = kWidevineCdmPluginDescription; + widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING; + webkit::WebPluginMimeType widevine_cdm_mime_type( + kWidevineCdmPluginMimeType, + kWidevineCdmPluginExtension, + kWidevineCdmPluginMimeTypeDescription); + widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); + widevine_cdm.permissions = kWidevineCdmPluginPermissions; + plugins->push_back(widevine_cdm); + + skip_widevine_cdm_file_check = true; + } + } +#endif // WIDEVINE_CDM_AVAILABLE + // The Remoting Viewer plugin is built-in. #if defined(ENABLE_REMOTING) content::PepperPluginInfo info; diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 9a666a3..ab3cff3 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -23,6 +23,8 @@ #include "base/mac/mac_util.h" #endif +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. + namespace { // File name of the internal Flash plugin on different platforms. @@ -322,16 +324,23 @@ bool PathProvider(int key, FilePath* result) { cur = cur.Append(kInternalNaClHelperBootstrapFileName); break; case chrome::FILE_O3D_PLUGIN: - if (!PathService::Get(base::DIR_MODULE, &cur)) - return false; + if (!PathService::Get(base::DIR_MODULE, &cur)) + return false; cur = cur.Append(kO3DPluginFileName); break; case chrome::FILE_GTALK_PLUGIN: - if (!PathService::Get(base::DIR_MODULE, &cur)) - return false; + if (!PathService::Get(base::DIR_MODULE, &cur)) + return false; cur = cur.Append(kGTalkPluginFileName); break; #endif +#if defined(WIDEVINE_CDM_AVAILABLE) + case chrome::FILE_WIDEVINE_CDM_PLUGIN: + if (!PathService::Get(base::DIR_MODULE, &cur)) + return false; + cur = cur.Append(kWidevineCdmPluginFileName); + break; +#endif case chrome::FILE_RESOURCES_PACK: #if defined(OS_MACOSX) if (base::mac::AmIBundled()) { diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h index 64813a7..8763836 100644 --- a/chrome/common/chrome_paths.h +++ b/chrome/common/chrome_paths.h @@ -103,6 +103,8 @@ enum { // (subdir of DIR_PNACL_BASE). FILE_O3D_PLUGIN, // Full path to the O3D Pepper plugin file. FILE_GTALK_PLUGIN, // Full path to the GTalk Pepper plugin file. + FILE_WIDEVINE_CDM_PLUGIN, // Full path to the Widevine CDM Pepper plugin + // file. FILE_LIBAVCODEC, // Full path to libavcodec media decoding // library. FILE_LIBAVFORMAT, // Full path to libavformat media parsing diff --git a/chrome/common_constants.gyp b/chrome/common_constants.gyp index 8952dae..e5f6d61 100644 --- a/chrome/common_constants.gyp +++ b/chrome/common_constants.gyp @@ -58,8 +58,12 @@ { 'target_name': 'common_constants', 'type': 'static_library', + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', # Needed by chrome_paths.cc. + ], 'dependencies': [ '../base/base.gyp:base', + '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'conditions': [ ['toolkit_uses_gtk == 1', { @@ -74,8 +78,12 @@ { 'target_name': 'common_constants_win64', 'type': 'static_library', + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', # Needed by chrome_paths.cc. + ], 'dependencies': [ '../base/base.gyp:base_nacl_win64', + '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'defines': [ '<@(nacl_win64_defines)', diff --git a/third_party/widevine/cdm/widevine_cdm_common.h b/third_party/widevine/cdm/widevine_cdm_common.h new file mode 100644 index 0000000..752b68b --- /dev/null +++ b/third_party/widevine/cdm/widevine_cdm_common.h @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WIDEVINE_CDM_COMMON_H_INCLUDED_ +#define WIDEVINE_CDM_COMMON_H_INCLUDED_ + +#include "base/file_path.h" + +// This file defines constants common to all Widevine CDM versions. + +// "alpha" is a temporary name until a convention is defined. +const char kWidevineKeySystem[] = "com.widevine.alpha"; + +const char kWidevineCdmPluginName[] = "Widevine HTML CDM"; +// Will be parsed as HTML. +const char kWidevineCdmPluginDescription[] = + "This plugin enables Widevine licenses for playback of HTML audio/video " + "content."; +const char kWidevineCdmPluginMimeType[] ="application/x-ppapi-widevine-cdm"; +const char kWidevineCdmPluginMimeTypeDescription[] = "Widevine HTML CDM"; + +// File name of the plugin on different platforms. +const FilePath::CharType kWidevineCdmPluginFileName[] = +#if defined(OS_MACOSX) + FILE_PATH_LITERAL("widevinecdmplugin.plugin"); +#elif defined(OS_WIN) + FILE_PATH_LITERAL("widevinecdmplugin.dll"); +#else // OS_LINUX, etc. + FILE_PATH_LITERAL("libwidevinecdmplugin.so"); +#endif + +#endif // WIDEVINE_CDM_COMMON_H_INCLUDED_ diff --git a/third_party/widevine/cdm/widevine_cdm_version.h b/third_party/widevine/cdm/widevine_cdm_version.h index 5b1ffeb..c3b624f 100644 --- a/third_party/widevine/cdm/widevine_cdm_version.h +++ b/third_party/widevine/cdm/widevine_cdm_version.h @@ -8,7 +8,8 @@ #ifndef WIDEVINE_CDM_VERSION_H_INCLUDED_ #define WIDEVINE_CDM_VERSION_H_INCLUDED_ -// If the Widevine CDM were available, we'd define two things: +// If the Widevine CDM were available, we would include +// third_party/widevine/cdm/widevine_cdm_common.h and define two things: // - WIDEVINE_CDM_AVAILABLE (to indicate availability), and // - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available // as a string, e.g., "1.0.123.456"). diff --git a/webkit/media/crypto/key_systems.cc b/webkit/media/crypto/key_systems.cc index 1b571d8..01d5a1a8d 100644 --- a/webkit/media/crypto/key_systems.cc +++ b/webkit/media/crypto/key_systems.cc @@ -13,6 +13,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. + namespace webkit_media { // Convert a WebString to ASCII, falling back on an empty string in the case @@ -44,16 +46,27 @@ struct KeySystemPluginTypePair { // entries in KeySystems::key_system_map_. static const MediaFormatAndKeySystem supported_format_key_system_combinations[] = { + // Clear Key. { "video/webm", "vorbis,vp8,vp8.0,", kClearKeyKeySystem }, { "audio/webm", "vorbis,", kClearKeyKeySystem }, + // External Clear Key (used for testing). { "video/webm", "vorbis,vp8,vp8.0,", kExternalClearKeyKeySystem }, { "audio/webm", "vorbis,", kExternalClearKeyKeySystem }, + +#if defined(WIDEVINE_CDM_AVAILABLE) + // Widevine. + { "video/webm", "vorbis,vp8,vp8.0,", kWidevineKeySystem }, + { "audio/webm", "vorbis,", kWidevineKeySystem }, +#endif // WIDEVINE_CDM_AVAILABLE }; static const KeySystemPluginTypePair key_system_to_plugin_type_mapping[] = { // TODO(xhwang): Update this with the real plugin name. - { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm" } + { kExternalClearKeyKeySystem, "application/x-ppapi-clearkey-cdm" }, +#if defined(WIDEVINE_CDM_AVAILABLE) + { kWidevineKeySystem, kWidevineCdmPluginMimeType } +#endif // WIDEVINE_CDM_AVAILABLE }; class KeySystems { diff --git a/webkit/media/webkit_media.gypi b/webkit/media/webkit_media.gypi index 08c8646..d33d838 100644 --- a/webkit/media/webkit_media.gypi +++ b/webkit/media/webkit_media.gypi @@ -8,11 +8,15 @@ 'target_name': 'webkit_media', 'type': 'static_library', 'variables': { 'enable_wexit_time_destructors': 1, }, + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', # Needed by key_systems.cc. + ], 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/media/media.gyp:shared_memory_support', '<(DEPTH)/media/media.gyp:yuv_convert', '<(DEPTH)/skia/skia.gyp:skia', + '<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'sources': [ 'android/audio_decoder_android.cc', |