diff options
author | gunsch <gunsch@chromium.org> | 2014-09-16 21:05:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-17 04:05:52 +0000 |
commit | b50a4e3f22e64129176a9dccd4d280b9aba2f700 (patch) | |
tree | 49a68be2a701762b4035ecda98b2dc6b929710b0 /chromecast | |
parent | f79df3346ce523b2c44c7d99e0b819788c432203 (diff) | |
download | chromium_src-b50a4e3f22e64129176a9dccd4d280b9aba2f700.zip chromium_src-b50a4e3f22e64129176a9dccd4d280b9aba2f700.tar.gz chromium_src-b50a4e3f22e64129176a9dccd4d280b9aba2f700.tar.bz2 |
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}
Diffstat (limited to 'chromecast')
-rw-r--r-- | chromecast/chromecast.gyp | 5 | ||||
-rw-r--r-- | chromecast/media/DEPS | 1 | ||||
-rw-r--r-- | chromecast/media/base/key_systems_common.cc | 39 | ||||
-rw-r--r-- | chromecast/media/base/key_systems_common.h | 33 | ||||
-rw-r--r-- | chromecast/media/base/key_systems_common_simple.cc | 15 | ||||
-rw-r--r-- | chromecast/media/media.gyp | 26 | ||||
-rw-r--r-- | chromecast/shell/renderer/DEPS | 1 | ||||
-rw-r--r-- | chromecast/shell/renderer/cast_content_renderer_client.cc | 3 | ||||
-rw-r--r-- | chromecast/shell/renderer/key_systems_cast.cc | 48 | ||||
-rw-r--r-- | chromecast/shell/renderer/key_systems_cast.h | 25 | ||||
-rw-r--r-- | chromecast/shell/renderer/key_systems_cast_simple.cc | 16 |
11 files changed, 212 insertions, 0 deletions
diff --git a/chromecast/chromecast.gyp b/chromecast/chromecast.gyp index 644273e..90c3c87 100644 --- a/chromecast/chromecast.gyp +++ b/chromecast/chromecast.gyp @@ -200,10 +200,12 @@ 'cast_version_header', 'chromecast_locales.gyp:chromecast_locales_pak', 'chromecast_locales.gyp:chromecast_settings', + 'media/media.gyp:media_base', '../components/components.gyp:component_metrics_proto', '../content/content.gyp:content', '../content/content.gyp:content_app_browser', '../skia/skia.gyp:skia', + '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'sources': [ 'shell/app/cast_main_delegate.cc', @@ -231,6 +233,8 @@ 'shell/common/cast_content_client.h', 'shell/renderer/cast_content_renderer_client.cc', 'shell/renderer/cast_content_renderer_client.h', + 'shell/renderer/key_systems_cast.cc', + 'shell/renderer/key_systems_cast.h', ], 'conditions': [ ['chromecast_branding=="Chrome"', { @@ -241,6 +245,7 @@ 'sources': [ 'shell/browser/devtools/remote_debugging_server_simple.cc', 'shell/browser/webui/webui_cast_simple.cc', + 'shell/renderer/key_systems_cast_simple.cc', ], }], ], diff --git a/chromecast/media/DEPS b/chromecast/media/DEPS index cc5cd70..1891d1a 100644 --- a/chromecast/media/DEPS +++ b/chromecast/media/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+media/base", + "+media/cdm", ] diff --git a/chromecast/media/base/key_systems_common.cc b/chromecast/media/base/key_systems_common.cc new file mode 100644 index 0000000..8925719 --- /dev/null +++ b/chromecast/media/base/key_systems_common.cc @@ -0,0 +1,39 @@ +// 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 diff --git a/chromecast/media/base/key_systems_common.h b/chromecast/media/base/key_systems_common.h new file mode 100644 index 0000000..9c0906b --- /dev/null +++ b/chromecast/media/base/key_systems_common.h @@ -0,0 +1,33 @@ +// 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_ diff --git a/chromecast/media/base/key_systems_common_simple.cc b/chromecast/media/base/key_systems_common_simple.cc new file mode 100644 index 0000000..e6dbd02 --- /dev/null +++ b/chromecast/media/base/key_systems_common_simple.cc @@ -0,0 +1,15 @@ +// 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 diff --git a/chromecast/media/media.gyp b/chromecast/media/media.gyp index 0674a9e..3cebc65 100644 --- a/chromecast/media/media.gyp +++ b/chromecast/media/media.gyp @@ -3,8 +3,34 @@ # found in the LICENSE file. { + 'variables': { + 'chromecast_branding%': 'Chromium', + }, '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', 'type': '<(component)', 'dependencies': [ diff --git a/chromecast/shell/renderer/DEPS b/chromecast/shell/renderer/DEPS index ad0391c..161949b 100644 --- a/chromecast/shell/renderer/DEPS +++ b/chromecast/shell/renderer/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+components/cdm/renderer", "+content/public/renderer", "+third_party/WebKit/public/platform", "+third_party/WebKit/public/web", diff --git a/chromecast/shell/renderer/cast_content_renderer_client.cc b/chromecast/shell/renderer/cast_content_renderer_client.cc index e07e227..7d278ee 100644 --- a/chromecast/shell/renderer/cast_content_renderer_client.cc +++ b/chromecast/shell/renderer/cast_content_renderer_client.cc @@ -8,6 +8,7 @@ #include "base/command_line.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/renderer/render_view.h" #include "crypto/nss_util.h" @@ -46,6 +47,8 @@ void CastContentRendererClient::RenderViewCreated( void CastContentRendererClient::AddKeySystems( std::vector<content::KeySystemInfo>* key_systems) { + AddChromecastKeySystems(key_systems); + AddChromecastPlatformKeySystems(key_systems); } } // namespace shell diff --git a/chromecast/shell/renderer/key_systems_cast.cc b/chromecast/shell/renderer/key_systems_cast.cc new file mode 100644 index 0000000..8e9fe4d --- /dev/null +++ b/chromecast/shell/renderer/key_systems_cast.cc @@ -0,0 +1,48 @@ +// 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 diff --git a/chromecast/shell/renderer/key_systems_cast.h b/chromecast/shell/renderer/key_systems_cast.h new file mode 100644 index 0000000..7b0a9eb --- /dev/null +++ b/chromecast/shell/renderer/key_systems_cast.h @@ -0,0 +1,25 @@ +// 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_ diff --git a/chromecast/shell/renderer/key_systems_cast_simple.cc b/chromecast/shell/renderer/key_systems_cast_simple.cc new file mode 100644 index 0000000..752669f --- /dev/null +++ b/chromecast/shell/renderer/key_systems_cast_simple.cc @@ -0,0 +1,16 @@ +// 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 |