From 1c03e830f2ab2d83e2bdc96cb399d2a43c77f576 Mon Sep 17 00:00:00 2001 From: xhwang Date: Thu, 23 Oct 2014 17:03:26 -0700 Subject: Move KeySystemInfo to media/. This is a preparation to move KeySystems to media, which is needed to support Encrypted Media Extensions (EME) without relying on content. BUG=422730 Review URL: https://codereview.chromium.org/665343002 Cr-Commit-Position: refs/heads/master@{#300992} --- components/cdm/DEPS | 1 + .../cdm/browser/cdm_message_filter_android.cc | 16 ++++++------- components/cdm/common/cdm_messages_android.h | 12 +++++----- components/cdm/renderer/BUILD.gn | 2 +- components/cdm/renderer/DEPS | 1 - components/cdm/renderer/android_key_systems.cc | 26 +++++++++++----------- components/cdm/renderer/android_key_systems.h | 6 ++--- components/cdm/renderer/widevine_key_systems.cc | 14 ++++++------ components/cdm/renderer/widevine_key_systems.h | 7 +++--- 9 files changed, 43 insertions(+), 42 deletions(-) (limited to 'components/cdm') diff --git a/components/cdm/DEPS b/components/cdm/DEPS index 1c40d98..5ca4943 100644 --- a/components/cdm/DEPS +++ b/components/cdm/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+ipc", + "+media/base", ] diff --git a/components/cdm/browser/cdm_message_filter_android.cc b/components/cdm/browser/cdm_message_filter_android.cc index ccea5fe..a19a037 100644 --- a/components/cdm/browser/cdm_message_filter_android.cc +++ b/components/cdm/browser/cdm_message_filter_android.cc @@ -13,9 +13,9 @@ #include "media/base/android/media_drm_bridge.h" using content::BrowserThread; -using content::SupportedCodecs; using media::MediaCodecBridge; using media::MediaDrmBridge; +using media::SupportedCodecs; namespace cdm { @@ -34,12 +34,12 @@ struct CodecInfo { }; const CodecInfo kCodecsToQuery[] = { - {content::EME_CODEC_WEBM_VORBIS, CODEC_AUDIO, "vorbis", "video/webm"}, - {content::EME_CODEC_WEBM_VP8, CODEC_VIDEO, "vp8", "video/webm"}, - {content::EME_CODEC_WEBM_VP9, CODEC_VIDEO, "vp9", "video/webm"}, + {media::EME_CODEC_WEBM_VORBIS, CODEC_AUDIO, "vorbis", "video/webm"}, + {media::EME_CODEC_WEBM_VP8, CODEC_VIDEO, "vp8", "video/webm"}, + {media::EME_CODEC_WEBM_VP9, CODEC_VIDEO, "vp9", "video/webm"}, #if defined(USE_PROPRIETARY_CODECS) - {content::EME_CODEC_MP4_AAC, CODEC_AUDIO, "mp4a", "video/mp4"}, - {content::EME_CODEC_MP4_AVC1, CODEC_VIDEO, "avc1", "video/mp4"} + {media::EME_CODEC_MP4_AAC, CODEC_AUDIO, "mp4a", "video/mp4"}, + {media::EME_CODEC_MP4_AVC1, CODEC_VIDEO, "avc1", "video/mp4"} #endif // defined(USE_PROPRIETARY_CODECS) }; @@ -47,7 +47,7 @@ static SupportedCodecs GetSupportedCodecs( const SupportedKeySystemRequest& request, bool video_must_be_compositable) { const std::string& key_system = request.key_system; - SupportedCodecs supported_codecs = content::EME_CODEC_NONE; + SupportedCodecs supported_codecs = media::EME_CODEC_NONE; for (size_t i = 0; i < arraysize(kCodecsToQuery); ++i) { const CodecInfo& info = kCodecsToQuery[i]; @@ -106,7 +106,7 @@ void CdmMessageFilterAndroid::OnQueryKeySystemSupport( if (!MediaDrmBridge::IsKeySystemSupported(request.key_system)) return; - DCHECK(request.codecs & content::EME_CODEC_ALL) << "unrecognized codec"; + DCHECK(request.codecs & media::EME_CODEC_ALL) << "unrecognized codec"; response->key_system = request.key_system; // TODO(qinmin): check composition is supported or not. response->compositing_codecs = GetSupportedCodecs(request, true); diff --git a/components/cdm/common/cdm_messages_android.h b/components/cdm/common/cdm_messages_android.h index 8e0ad1c..028306a 100644 --- a/components/cdm/common/cdm_messages_android.h +++ b/components/cdm/common/cdm_messages_android.h @@ -7,24 +7,24 @@ #include -#include "content/public/common/eme_constants.h" #include "ipc/ipc_message_macros.h" +#include "media/base/eme_constants.h" #define IPC_MESSAGE_START EncryptedMediaMsgStart IPC_STRUCT_BEGIN(SupportedKeySystemRequest) IPC_STRUCT_MEMBER(std::string, key_system) - IPC_STRUCT_MEMBER(content::SupportedCodecs, codecs, content::EME_CODEC_NONE) + IPC_STRUCT_MEMBER(media::SupportedCodecs, codecs, media::EME_CODEC_NONE) IPC_STRUCT_END() IPC_STRUCT_BEGIN(SupportedKeySystemResponse) IPC_STRUCT_MEMBER(std::string, key_system) - IPC_STRUCT_MEMBER(content::SupportedCodecs, + IPC_STRUCT_MEMBER(media::SupportedCodecs, compositing_codecs, - content::EME_CODEC_NONE) - IPC_STRUCT_MEMBER(content::SupportedCodecs, + media::EME_CODEC_NONE) + IPC_STRUCT_MEMBER(media::SupportedCodecs, non_compositing_codecs, - content::EME_CODEC_NONE) + media::EME_CODEC_NONE) IPC_STRUCT_END() // Messages sent from the renderer to the browser. diff --git a/components/cdm/renderer/BUILD.gn b/components/cdm/renderer/BUILD.gn index bc470b0..9652a6c 100644 --- a/components/cdm/renderer/BUILD.gn +++ b/components/cdm/renderer/BUILD.gn @@ -18,8 +18,8 @@ static_library("renderer") { deps = [ "//base", "//components/cdm/common", - "//content/public/common", "//content/public/renderer", + "//media/base", "//third_party/widevine/cdm:version_h", ] } diff --git a/components/cdm/renderer/DEPS b/components/cdm/renderer/DEPS index dbd28cf..725e151 100644 --- a/components/cdm/renderer/DEPS +++ b/components/cdm/renderer/DEPS @@ -1,4 +1,3 @@ include_rules = [ - "+content/public/common", "+content/public/renderer", ] diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc index c6adc80..83a0d04 100644 --- a/components/cdm/renderer/android_key_systems.cc +++ b/components/cdm/renderer/android_key_systems.cc @@ -10,13 +10,13 @@ #include "base/logging.h" #include "components/cdm/common/cdm_messages_android.h" #include "components/cdm/renderer/widevine_key_systems.h" -#include "content/public/common/eme_constants.h" #include "content/public/renderer/render_thread.h" +#include "media/base/eme_constants.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. -using content::KeySystemInfo; -using content::SupportedCodecs; +using media::KeySystemInfo; +using media::SupportedCodecs; namespace cdm { @@ -26,12 +26,12 @@ static SupportedKeySystemResponse QueryKeySystemSupport( SupportedKeySystemResponse response; request.key_system = key_system; - request.codecs = content::EME_CODEC_ALL; + request.codecs = media::EME_CODEC_ALL; content::RenderThread::Get()->Send( new ChromeViewHostMsg_QueryKeySystemSupport(request, &response)); - DCHECK(!(response.compositing_codecs & ~content::EME_CODEC_ALL)) + DCHECK(!(response.compositing_codecs & ~media::EME_CODEC_ALL)) << "unrecognized codec"; - DCHECK(!(response.non_compositing_codecs & ~content::EME_CODEC_ALL)) + DCHECK(!(response.non_compositing_codecs & ~media::EME_CODEC_ALL)) << "unrecognized codec"; return response; } @@ -39,14 +39,14 @@ static SupportedKeySystemResponse QueryKeySystemSupport( void AddAndroidWidevine(std::vector* concrete_key_systems) { SupportedKeySystemResponse response = QueryKeySystemSupport( kWidevineKeySystem); - if (response.compositing_codecs != content::EME_CODEC_NONE) { + if (response.compositing_codecs != media::EME_CODEC_NONE) { AddWidevineWithCodecs( WIDEVINE, static_cast(response.compositing_codecs), concrete_key_systems); } - if (response.non_compositing_codecs != content::EME_CODEC_NONE) { + if (response.non_compositing_codecs != media::EME_CODEC_NONE) { AddWidevineWithCodecs( WIDEVINE_HR_NON_COMPOSITING, static_cast(response.non_compositing_codecs), @@ -63,17 +63,17 @@ void AddAndroidPlatformKeySystems( for (std::vector::const_iterator it = key_system_names.begin(); it != key_system_names.end(); ++it) { SupportedKeySystemResponse response = QueryKeySystemSupport(*it); - if (response.compositing_codecs != content::EME_CODEC_NONE) { + if (response.compositing_codecs != media::EME_CODEC_NONE) { KeySystemInfo info(*it); info.supported_codecs = response.compositing_codecs; // Here we assume that support for a container implies support for the // associated initialization data type. KeySystems handles validating // |init_data_type| x |container| pairings. - if (response.compositing_codecs & content::EME_CODEC_WEBM_ALL) - info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_WEBM; + if (response.compositing_codecs & media::EME_CODEC_WEBM_ALL) + info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; #if defined(USE_PROPRIETARY_CODECS) - if (response.compositing_codecs & content::EME_CODEC_MP4_ALL) - info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; + if (response.compositing_codecs & media::EME_CODEC_MP4_ALL) + info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; #endif // defined(USE_PROPRIETARY_CODECS) concrete_key_systems->push_back(info); } diff --git a/components/cdm/renderer/android_key_systems.h b/components/cdm/renderer/android_key_systems.h index 36be6c9..fb962b1 100644 --- a/components/cdm/renderer/android_key_systems.h +++ b/components/cdm/renderer/android_key_systems.h @@ -7,17 +7,17 @@ #include -#include "content/public/renderer/key_system_info.h" +#include "media/base/key_system_info.h" namespace cdm { void AddAndroidWidevine( - std::vector* concrete_key_systems); + std::vector* concrete_key_systems); // Add platform-supported key systems which are not explicitly handled // by Chrome. void AddAndroidPlatformKeySystems( - std::vector* concrete_key_systems); + std::vector* concrete_key_systems); } // namespace cdm diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc index d08b6ad..f803e8e 100644 --- a/components/cdm/renderer/widevine_key_systems.cc +++ b/components/cdm/renderer/widevine_key_systems.cc @@ -8,14 +8,14 @@ #include #include "base/logging.h" -#include "content/public/common/eme_constants.h" +#include "media/base/eme_constants.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #if defined(WIDEVINE_CDM_AVAILABLE) -using content::KeySystemInfo; -using content::SupportedCodecs; +using media::KeySystemInfo; +using media::SupportedCodecs; namespace cdm { @@ -53,11 +53,11 @@ void AddWidevineWithCodecs(WidevineCdmType widevine_cdm_type, // Here we assume that support for a container imples support for the // associated initialization data type. KeySystems handles validating // |init_data_type| x |container| pairings. - if (supported_codecs & content::EME_CODEC_WEBM_ALL) - info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_WEBM; + if (supported_codecs & media::EME_CODEC_WEBM_ALL) + info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_WEBM; #if defined(USE_PROPRIETARY_CODECS) - if (supported_codecs & content::EME_CODEC_MP4_ALL) - info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; + if (supported_codecs & media::EME_CODEC_MP4_ALL) + info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; #endif // defined(USE_PROPRIETARY_CODECS) #if defined(ENABLE_PEPPER_CDMS) diff --git a/components/cdm/renderer/widevine_key_systems.h b/components/cdm/renderer/widevine_key_systems.h index ab1966f..1d42b3b 100644 --- a/components/cdm/renderer/widevine_key_systems.h +++ b/components/cdm/renderer/widevine_key_systems.h @@ -7,7 +7,8 @@ #include -#include "content/public/renderer/key_system_info.h" +#include "build/build_config.h" +#include "media/base/key_system_info.h" namespace cdm { @@ -20,8 +21,8 @@ enum WidevineCdmType { void AddWidevineWithCodecs( WidevineCdmType widevine_cdm_type, - content::SupportedCodecs supported_codecs, - std::vector* concrete_key_systems); + media::SupportedCodecs supported_codecs, + std::vector* concrete_key_systems); } // namespace cdm -- cgit v1.1