Commit b50a4e3f authored by gunsch's avatar gunsch Committed by Commit bot

Adds initial key systems support for Chromecast.

R=lcwu@chromium.org,byungchul@chromium.org
BUG=400914

Review URL: https://codereview.chromium.org/568243002

Cr-Commit-Position: refs/heads/master@{#295226}
parent f79df334
...@@ -1825,6 +1825,7 @@ ...@@ -1825,6 +1825,7 @@
'enable_mpeg2ts_stream_parser%': 1, 'enable_mpeg2ts_stream_parser%': 1,
'ffmpeg_branding%': 'Chrome', 'ffmpeg_branding%': 'Chrome',
'ozone_platform_ozonex%': 1, 'ozone_platform_ozonex%': 1,
'use_playready%': 0,
'conditions': [ 'conditions': [
['target_arch=="arm"', { ['target_arch=="arm"', {
'arm_arch%': '', 'arm_arch%': '',
...@@ -2821,6 +2822,11 @@ ...@@ -2821,6 +2822,11 @@
'__SOFTFP', '__SOFTFP',
], ],
}], }],
['use_playready==1', {
'defines': [
'PLAYREADY_CDM_AVAILABLE',
],
}],
], ],
}], }],
['enable_task_manager==1', { ['enable_task_manager==1', {
......
...@@ -200,10 +200,12 @@ ...@@ -200,10 +200,12 @@
'cast_version_header', 'cast_version_header',
'chromecast_locales.gyp:chromecast_locales_pak', 'chromecast_locales.gyp:chromecast_locales_pak',
'chromecast_locales.gyp:chromecast_settings', 'chromecast_locales.gyp:chromecast_settings',
'media/media.gyp:media_base',
'../components/components.gyp:component_metrics_proto', '../components/components.gyp:component_metrics_proto',
'../content/content.gyp:content', '../content/content.gyp:content',
'../content/content.gyp:content_app_browser', '../content/content.gyp:content_app_browser',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
], ],
'sources': [ 'sources': [
'shell/app/cast_main_delegate.cc', 'shell/app/cast_main_delegate.cc',
...@@ -231,6 +233,8 @@ ...@@ -231,6 +233,8 @@
'shell/common/cast_content_client.h', 'shell/common/cast_content_client.h',
'shell/renderer/cast_content_renderer_client.cc', 'shell/renderer/cast_content_renderer_client.cc',
'shell/renderer/cast_content_renderer_client.h', 'shell/renderer/cast_content_renderer_client.h',
'shell/renderer/key_systems_cast.cc',
'shell/renderer/key_systems_cast.h',
], ],
'conditions': [ 'conditions': [
['chromecast_branding=="Chrome"', { ['chromecast_branding=="Chrome"', {
...@@ -241,6 +245,7 @@ ...@@ -241,6 +245,7 @@
'sources': [ 'sources': [
'shell/browser/devtools/remote_debugging_server_simple.cc', 'shell/browser/devtools/remote_debugging_server_simple.cc',
'shell/browser/webui/webui_cast_simple.cc', 'shell/browser/webui/webui_cast_simple.cc',
'shell/renderer/key_systems_cast_simple.cc',
], ],
}], }],
], ],
......
include_rules = [ include_rules = [
"+media/base", "+media/base",
"+media/cdm",
] ]
// Copyright 2014 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.
#include "chromecast/media/base/key_systems_common.h"
#include <cstddef>
#include "media/cdm/key_system_names.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
namespace chromecast {
namespace media {
const char kChromecastPlayreadyKeySystem[] = "com.chromecast.playready";
CastKeySystem GetKeySystemByName(const std::string& key_system_name) {
#if defined(WIDEVINE_CDM_AVAILABLE)
if (key_system_name.compare(kWidevineKeySystem) == 0) {
return KEY_SYSTEM_WIDEVINE;
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
#if defined(PLAYREADY_CDM_AVAILABLE)
if (key_system_name.compare(kChromecastPlayreadyKeySystem) == 0) {
return KEY_SYSTEM_PLAYREADY;
}
#endif // defined(PLAYREADY_CDM_AVAILABLE)
if (key_system_name.compare(::media::kClearKey) == 0) {
return KEY_SYSTEM_CLEAR_KEY;
}
return GetPlatformKeySystemByName(key_system_name);
}
} // namespace media
} // namespace chromecast
// Copyright 2014 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 CHROMECAST_MEDIA_BASE_KEY_SYSTEMS_COMMON_H_
#define CHROMECAST_MEDIA_BASE_KEY_SYSTEMS_COMMON_H_
#include <string>
namespace chromecast {
namespace media {
extern const char kChromecastPlayreadyKeySystem[];
enum CastKeySystem {
KEY_SYSTEM_NONE = 0,
KEY_SYSTEM_CLEAR_KEY,
KEY_SYSTEM_PLAYREADY,
KEY_SYSTEM_WIDEVINE
};
// Translates a key system string into a CastKeySystem, calling into the
// platform for known key systems if needed.
CastKeySystem GetKeySystemByName(const std::string& key_system_name);
// Translates a platform-specific key system string into a CastKeySystem.
// TODO(gunsch): Remove when prefixed EME is removed.
CastKeySystem GetPlatformKeySystemByName(const std::string& key_system_name);
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_BASE_KEY_SYSTEMS_COMMON_H_
// Copyright 2014 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.
#include "chromecast/media/base/key_systems_common.h"
namespace chromecast {
namespace media {
CastKeySystem GetPlatformKeySystemByName(const std::string& key_system_name) {
return KEY_SYSTEM_NONE;
}
} // namespace media
} // namespace chromecast
...@@ -3,7 +3,33 @@ ...@@ -3,7 +3,33 @@
# found in the LICENSE file. # found in the LICENSE file.
{ {
'variables': {
'chromecast_branding%': 'Chromium',
},
'targets': [ 'targets': [
{
'target_name': 'media_base',
'type': '<(component)',
'dependencies': [
'../../base/base.gyp:base',
'../../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
],
'sources': [
'base/key_systems_common.cc',
'base/key_systems_common.h',
],
'conditions': [
['chromecast_branding=="Chrome"', {
'dependencies': [
'internal/chromecast_internal.gyp:media_base_internal',
],
}, {
'sources': [
'base/key_systems_common_simple.cc',
],
}],
],
},
{ {
'target_name': 'cma_base', 'target_name': 'cma_base',
'type': '<(component)', 'type': '<(component)',
......
include_rules = [ include_rules = [
"+components/cdm/renderer",
"+content/public/renderer", "+content/public/renderer",
"+third_party/WebKit/public/platform", "+third_party/WebKit/public/platform",
"+third_party/WebKit/public/web", "+third_party/WebKit/public/web",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/memory_pressure_listener.h" #include "base/memory/memory_pressure_listener.h"
#include "chromecast/shell/renderer/key_systems_cast.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "crypto/nss_util.h" #include "crypto/nss_util.h"
...@@ -46,6 +47,8 @@ void CastContentRendererClient::RenderViewCreated( ...@@ -46,6 +47,8 @@ void CastContentRendererClient::RenderViewCreated(
void CastContentRendererClient::AddKeySystems( void CastContentRendererClient::AddKeySystems(
std::vector<content::KeySystemInfo>* key_systems) { std::vector<content::KeySystemInfo>* key_systems) {
AddChromecastKeySystems(key_systems);
AddChromecastPlatformKeySystems(key_systems);
} }
} // namespace shell } // namespace shell
......
// Copyright 2014 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.
#include "chromecast/shell/renderer/key_systems_cast.h"
#include <string>
#include "base/command_line.h"
#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_codec.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
namespace {
#if defined(PLAYREADY_CDM_AVAILABLE)
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;
concrete_key_systems->push_back(info);
}
#endif // defined(PLAYREADY_CDM_AVAILABLE)
} // namespace
namespace chromecast {
namespace shell {
void AddChromecastKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info) {
#if defined(WIDEVINE_CDM_AVAILABLE)
AddWidevineWithCodecs(cdm::WIDEVINE,
content::EME_CODEC_MP4_ALL,
key_systems_info);
#endif
#if defined(PLAYREADY_CDM_AVAILABLE)
AddKeySystemWithCodecs(kChromecastPlayreadyKeySystem, key_systems_info);
#endif
}
} // namespace shell
} // namespace chromecast
// Copyright 2014 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 CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_
#define CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_
#include <vector>
#include "content/public/renderer/key_system_info.h"
namespace chromecast {
namespace shell {
void AddChromecastKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info);
// TODO(gunsch): Remove when prefixed EME is removed.
void AddChromecastPlatformKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info);
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_
// Copyright 2014 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.
#include "chromecast/shell/renderer/key_systems_cast.h"
namespace chromecast {
namespace shell {
void AddChromecastPlatformKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info) {
// Intentional no-op for public build.
}
} // namespace shell
} // namespace chromecast
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment