Skip to content

Commit

Permalink
Move KeySystemInfo to media/.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
xhwang-chromium authored and Commit bot committed Oct 24, 2014
1 parent 9448dfa commit 1c03e83
Show file tree
Hide file tree
Showing 33 changed files with 154 additions and 138 deletions.
2 changes: 2 additions & 0 deletions android_webview/renderer/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ include_rules = [

"+content/public/renderer",

"+media/base",

"+printing",

"+third_party/WebKit/public/platform",
Expand Down
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
}

void AwContentRendererClient::AddKeySystems(
std::vector<content::KeySystemInfo>* key_systems) {
std::vector<media::KeySystemInfo>* key_systems) {
AwAddKeySystems(key_systems);
}

Expand Down
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_content_renderer_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AwContentRendererClient : public content::ContentRendererClient {
size_t length) override;
virtual bool IsLinkVisited(unsigned long long link_hash) override;
virtual void AddKeySystems(
std::vector<content::KeySystemInfo>* key_systems) override;
std::vector<media::KeySystemInfo>* key_systems) override;

virtual bool HandleNavigation(content::RenderFrame* render_frame,
content::DocumentState* document_state,
Expand Down
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace android_webview {

void AwAddKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info) {
std::vector<media::KeySystemInfo>* key_systems_info) {
cdm::AddAndroidWidevine(key_systems_info);
cdm::AddAndroidPlatformKeySystems(key_systems_info);
}
Expand Down
6 changes: 4 additions & 2 deletions android_webview/renderer/aw_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
#ifndef ANDROID_WEBVIEW_RENDERER_AW_KEY_SYSTEMS_H_
#define ANDROID_WEBVIEW_RENDERER_AW_KEY_SYSTEMS_H_

#include "content/public/renderer/key_system_info.h"
#include <vector>

#include "media/base/key_system_info.h"

namespace android_webview {

void AwAddKeySystems(std::vector<content::KeySystemInfo>* key_systems_info);
void AwAddKeySystems(std::vector<media::KeySystemInfo>* key_systems_info);

} // namespace android_webview

Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/chrome_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ bool ChromeContentRendererClient::AllowPepperMediaStreamAPI(
}

void ChromeContentRendererClient::AddKeySystems(
std::vector<content::KeySystemInfo>* key_systems) {
std::vector<media::KeySystemInfo>* key_systems) {
AddChromeKeySystems(key_systems);
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/chrome_content_renderer_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient {
content::RenderFrame* render_frame,
blink::WebFrame* frame) override;
bool AllowPepperMediaStreamAPI(const GURL& url) override;
void AddKeySystems(std::vector<content::KeySystemInfo>* key_systems) override;
void AddKeySystems(std::vector<media::KeySystemInfo>* key_systems) override;
bool IsPluginAllowedToUseDevChannelAPIs() override;
bool IsPluginAllowedToUseCompositorAPI(const GURL& url) override;
bool IsPluginAllowedToUseVideoDecodeAPI(const GURL& url) override;
Expand Down
26 changes: 13 additions & 13 deletions chrome/renderer/media/chrome_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/render_messages.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"

#if defined(OS_ANDROID)
#include "components/cdm/renderer/android_key_systems.h"
Expand All @@ -29,8 +29,8 @@
#include "base/version.h"
#endif

using content::KeySystemInfo;
using content::SupportedCodecs;
using media::KeySystemInfo;
using media::SupportedCodecs;

#if defined(ENABLE_PEPPER_CDMS)
static bool IsPepperCdmAvailable(
Expand Down Expand Up @@ -74,11 +74,11 @@ static void AddExternalClearKey(

KeySystemInfo info(kExternalClearKeyKeySystem);

info.supported_codecs = content::EME_CODEC_WEBM_ALL;
info.supported_init_data_types = content::EME_INIT_DATA_TYPE_WEBM;
info.supported_codecs = media::EME_CODEC_WEBM_ALL;
info.supported_init_data_types = media::EME_INIT_DATA_TYPE_WEBM;
#if defined(USE_PROPRIETARY_CODECS)
info.supported_codecs |= content::EME_CODEC_MP4_ALL;
info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC;
info.supported_codecs |= media::EME_CODEC_MP4_ALL;
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
#endif // defined(USE_PROPRIETARY_CODECS)

info.pepper_type = kExternalClearKeyPepperType;
Expand Down Expand Up @@ -156,19 +156,19 @@ static void AddPepperBasedWidevine(
additional_param_values,
&codecs);

SupportedCodecs supported_codecs = content::EME_CODEC_NONE;
SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
for (size_t i = 0; i < codecs.size(); ++i) {
if (codecs[i] == kCdmSupportedCodecVorbis)
supported_codecs |= content::EME_CODEC_WEBM_VORBIS;
supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
if (codecs[i] == kCdmSupportedCodecVp8)
supported_codecs |= content::EME_CODEC_WEBM_VP8;
supported_codecs |= media::EME_CODEC_WEBM_VP8;
if (codecs[i] == kCdmSupportedCodecVp9)
supported_codecs |= content::EME_CODEC_WEBM_VP9;
supported_codecs |= media::EME_CODEC_WEBM_VP9;
#if defined(USE_PROPRIETARY_CODECS)
if (codecs[i] == kCdmSupportedCodecAac)
supported_codecs |= content::EME_CODEC_MP4_AAC;
supported_codecs |= media::EME_CODEC_MP4_AAC;
if (codecs[i] == kCdmSupportedCodecAvc1)
supported_codecs |= content::EME_CODEC_MP4_AVC1;
supported_codecs |= media::EME_CODEC_MP4_AVC1;
#endif // defined(USE_PROPRIETARY_CODECS)
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/media/chrome_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <vector>

#include "content/public/renderer/key_system_info.h"
#include "media/base/key_system_info.h"

void AddChromeKeySystems(std::vector<content::KeySystemInfo>* key_systems_info);
void AddChromeKeySystems(std::vector<media::KeySystemInfo>* key_systems_info);

#endif // CHROME_RENDERER_MEDIA_CHROME_KEY_SYSTEMS_H_
1 change: 1 addition & 0 deletions chromecast/renderer/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include_rules = [
"+chromecast/media",
"+components/cdm/renderer",
"+content/public/renderer",
"+media/base",
"+third_party/WebKit/public/platform",
"+third_party/WebKit/public/web",
]
12 changes: 6 additions & 6 deletions chromecast/renderer/key_systems_cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "base/logging.h"
#include "chromecast/media/base/key_systems_common.h"
#include "components/cdm/renderer/widevine_key_systems.h"
#include "content/public/common/eme_constants.h"
#include "media/base/eme_constants.h"

#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.

Expand All @@ -19,17 +19,17 @@ namespace shell {

void AddKeySystemWithCodecs(
const std::string& key_system_name,
std::vector<content::KeySystemInfo>* concrete_key_systems) {
content::KeySystemInfo info(key_system_name);
info.supported_codecs = content::EME_CODEC_MP4_ALL;
std::vector<media::KeySystemInfo>* concrete_key_systems) {
media::KeySystemInfo info(key_system_name);
info.supported_codecs = media::EME_CODEC_MP4_ALL;
concrete_key_systems->push_back(info);
}

void AddChromecastKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info) {
std::vector<media::KeySystemInfo>* key_systems_info) {
#if defined(WIDEVINE_CDM_AVAILABLE)
AddWidevineWithCodecs(cdm::WIDEVINE,
content::EME_CODEC_MP4_ALL,
media::EME_CODEC_MP4_ALL,
key_systems_info);
#endif

Expand Down
8 changes: 4 additions & 4 deletions chromecast/renderer/key_systems_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@

#include <vector>

#include "content/public/renderer/key_system_info.h"
#include "media/base/key_system_info.h"

namespace chromecast {
namespace shell {

// Adds a single key system by name.
void AddKeySystemWithCodecs(
const std::string& key_system_name,
std::vector<content::KeySystemInfo>* concrete_key_systems);
std::vector<media::KeySystemInfo>* concrete_key_systems);

void AddChromecastKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info);
std::vector<media::KeySystemInfo>* key_systems_info);

// TODO(gunsch): Remove when prefixed EME is removed.
void AddChromecastPlatformKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info);
std::vector<media::KeySystemInfo>* key_systems_info);

} // namespace shell
} // namespace chromecast
Expand Down
5 changes: 2 additions & 3 deletions components/cdm.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
'dependencies': [
'cdm_common',
'../base/base.gyp:base',
'../content/content.gyp:content_common',
'../content/content.gyp:content_renderer',
'../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
],
Expand All @@ -43,8 +42,8 @@
'sources': [
'cdm/renderer/android_key_systems.cc',
'cdm/renderer/android_key_systems.h',
],
}],
],
}],
],
},
],
Expand Down
1 change: 1 addition & 0 deletions components/cdm/DEPS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include_rules = [
"+ipc",
"+media/base",
]
16 changes: 8 additions & 8 deletions components/cdm/browser/cdm_message_filter_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -34,20 +34,20 @@ 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)
};

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];
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions components/cdm/common/cdm_messages_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@

#include <vector>

#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.
Expand Down
2 changes: 1 addition & 1 deletion components/cdm/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
}
1 change: 0 additions & 1 deletion components/cdm/renderer/DEPS
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include_rules = [
"+content/public/common",
"+content/public/renderer",
]
Loading

0 comments on commit 1c03e83

Please sign in to comment.