Skip to content

Commit

Permalink
Add media_cdm_adapter.gyp: a common base for all CDM adapters.
Browse files Browse the repository at this point in the history
This removes duplicate code in CDM adapter gyp targets.

Also move more code under the condition enable_pepper_cdms==1 so that when enable_pepper_cdms==0, clearkeycdm, clearkeycdmadapter and widevinecdmadapter targets won't exist.

BUG=329097
TEST=Widevine and ClearKey CDM adapters still work.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241736 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
xhwang@chromium.org committed Dec 19, 2013
1 parent 6ad3689 commit 8e0f4b4
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 148 deletions.
2 changes: 1 addition & 1 deletion chrome/chrome_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@
['exclude', '^browser/ui/webui/app_list/'],
],
}],
['enable_plugins==1', {
['enable_pepper_cdms==1', {
'dependencies': [
# Runtime dependencies.
'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',
Expand Down
201 changes: 86 additions & 115 deletions media/media_cdm.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -18,129 +18,100 @@
# Set |use_libvpx| to 1 to use libvpx for VP8 decoding in |clearkeycdm|.
'use_libvpx%': 0,
},
'targets': [
{
'target_name': 'clearkeycdm',
'type': 'none',
# TODO(tomfinegan): Simplify this by unconditionally including all the
# decoders, and changing clearkeycdm to select which decoder to use
# based on environment variables.
'conditions': [
['use_fake_video_decoder == 1' , {
'defines': ['CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER'],
'sources': [
'cdm/ppapi/fake_cdm_video_decoder.cc',
'cdm/ppapi/fake_cdm_video_decoder.h',
'conditions': [
['enable_pepper_cdms==1', {
'targets': [
{
'target_name': 'clearkeycdm',
'type': 'none',
# TODO(tomfinegan): Simplify this by unconditionally including all the
# decoders, and changing clearkeycdm to select which decoder to use
# based on environment variables.
'conditions': [
['use_fake_video_decoder == 1' , {
'defines': ['CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER'],
'sources': [
'cdm/ppapi/fake_cdm_video_decoder.cc',
'cdm/ppapi/fake_cdm_video_decoder.h',
],
}],
['use_ffmpeg == 1' , {
'defines': ['CLEAR_KEY_CDM_USE_FFMPEG_DECODER'],
'dependencies': [
'<(DEPTH)/third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
'sources': [
'cdm/ppapi/ffmpeg_cdm_audio_decoder.cc',
'cdm/ppapi/ffmpeg_cdm_audio_decoder.h',
],
}],
['use_ffmpeg == 1 and use_fake_video_decoder == 0' , {
'sources': [
'cdm/ppapi/ffmpeg_cdm_video_decoder.cc',
'cdm/ppapi/ffmpeg_cdm_video_decoder.h',
],
}],
['use_libvpx == 1 and use_fake_video_decoder == 0' , {
'defines': ['CLEAR_KEY_CDM_USE_LIBVPX_DECODER'],
'dependencies': [
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
'sources': [
'cdm/ppapi/libvpx_cdm_video_decoder.cc',
'cdm/ppapi/libvpx_cdm_video_decoder.h',
],
}],
['os_posix == 1 and OS != "mac" and enable_pepper_cdms==1', {
'type': 'loadable_module', # Must be in PRODUCT_DIR for ASAN bot.
}],
['(OS == "mac" or OS == "win") and enable_pepper_cdms==1', {
'type': 'shared_library',
}],
['OS == "mac"', {
'xcode_settings': {
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
},
}]
],
}],
['use_ffmpeg == 1' , {
'defines': ['CLEAR_KEY_CDM_USE_FFMPEG_DECODER'],
'defines': ['CDM_IMPLEMENTATION'],
'dependencies': [
'<(DEPTH)/third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
'sources': [
'cdm/ppapi/ffmpeg_cdm_audio_decoder.cc',
'cdm/ppapi/ffmpeg_cdm_audio_decoder.h',
'media',
# Include the following for media::AudioBus.
'shared_memory_support',
'<(DEPTH)/base/base.gyp:base',
],
}],
['use_ffmpeg == 1 and use_fake_video_decoder == 0' , {
'sources': [
'cdm/ppapi/ffmpeg_cdm_video_decoder.cc',
'cdm/ppapi/ffmpeg_cdm_video_decoder.h',
'cdm/ppapi/cdm_video_decoder.cc',
'cdm/ppapi/cdm_video_decoder.h',
'cdm/ppapi/clear_key_cdm.cc',
'cdm/ppapi/clear_key_cdm.h',
'cdm/ppapi/clear_key_cdm_common.h',
],
}],
['use_libvpx == 1 and use_fake_video_decoder == 0' , {
'defines': ['CLEAR_KEY_CDM_USE_LIBVPX_DECODER'],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
{
'target_name': 'clearkeycdmadapter',
'type': 'none',
# Check whether the plugin's origin URL is valid.
'defines': ['CHECK_DOCUMENT_URL'],
'dependencies': [
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
'sources': [
'cdm/ppapi/libvpx_cdm_video_decoder.cc',
'cdm/ppapi/libvpx_cdm_video_decoder.h',
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
'media_cdm_adapter.gyp:cdmadapter',
'clearkeycdm',
],
}],
['os_posix == 1 and OS != "mac" and enable_pepper_cdms==1', {
'type': 'loadable_module', # Must be in PRODUCT_DIR for ASAN bots.
}],
['(OS == "mac" or OS == "win") and enable_pepper_cdms==1', {
'type': 'shared_library',
}],
['OS == "mac"', {
'xcode_settings': {
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
},
}]
],
'defines': ['CDM_IMPLEMENTATION'],
'dependencies': [
'media',
# Include the following for media::AudioBus.
'shared_memory_support',
'<(DEPTH)/base/base.gyp:base',
],
'sources': [
'cdm/ppapi/cdm_video_decoder.cc',
'cdm/ppapi/cdm_video_decoder.h',
'cdm/ppapi/clear_key_cdm.cc',
'cdm/ppapi/clear_key_cdm.h',
'cdm/ppapi/clear_key_cdm_common.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
{
'target_name': 'clearkeycdmadapter',
'type': 'none',
# Check whether the plugin's origin URL is valid.
'defines': ['CHECK_DOCUMENT_URL'],
'dependencies': [
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
'clearkeycdm',
],
'sources': [
'cdm/ppapi/api/content_decryption_module.h',
'cdm/ppapi/cdm_adapter.cc',
'cdm/ppapi/cdm_adapter.h',
'cdm/ppapi/cdm_file_io_impl.cc',
'cdm/ppapi/cdm_file_io_impl.h',
'cdm/ppapi/cdm_helpers.cc',
'cdm/ppapi/cdm_helpers.h',
'cdm/ppapi/cdm_logging.cc',
'cdm/ppapi/cdm_logging.h',
'cdm/ppapi/cdm_wrapper.h',
'cdm/ppapi/linked_ptr.h',
'cdm/ppapi/supported_cdm_versions.h',
],
'conditions': [
['os_posix == 1 and OS != "mac" and enable_pepper_cdms==1', {
'cflags': ['-fvisibility=hidden'],
'type': 'loadable_module',
# Allow the plugin adapter to find the CDM in the same directory.
'ldflags': ['-Wl,-rpath=\$$ORIGIN'],
'libraries': [
# Built by clearkeycdm.
'<(PRODUCT_DIR)/libclearkeycdm.so',
'conditions': [
['os_posix == 1 and OS != "mac" and enable_pepper_cdms==1', {
# Because clearkeycdm has type 'loadable_module' (see comments),
# we must explicitly specify this dependency.
'libraries': [
# Built by clearkeycdm.
'<(PRODUCT_DIR)/libclearkeycdm.so',
],
}],
],
}],
['OS == "win" and enable_pepper_cdms==1', {
'type': 'shared_library',
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
}],
['OS == "mac" and enable_pepper_cdms==1', {
'type': 'loadable_module',
'product_extension': 'plugin',
'xcode_settings': {
'OTHER_LDFLAGS': [
# Not to strip important symbols by -Wl,-dead_strip.
'-Wl,-exported_symbol,_PPP_GetInterface',
'-Wl,-exported_symbol,_PPP_InitializeModule',
'-Wl,-exported_symbol,_PPP_ShutdownModule'
],
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
},
}],
},
],
}
}],
],
}
67 changes: 67 additions & 0 deletions media/media_cdm_adapter.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2013 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.

# This file defines a common base target for all CDM adapter implementations.
# We use 'direct_dependent_settings' to override target type and settings so
# that all CDM adapter implementations have the correct type and settings
# automatically.
#
# WARNING: Keep 'cdmadapter' target out of media.gyp. /build/all.gyp:All depends
# directly on media.gyp:*. If 'cdmadapter' is defined in media.gyp, then
# 'direct_dependent_settings' will be applied to 'All' target and bad
# things happen, e.g. the type of 'All' target becomes a plugin on Mac.
{
'conditions': [
['enable_pepper_cdms==1', {
'targets': [
{
'target_name': 'cdmadapter',
'type': 'none',
'direct_dependent_settings': {
'sources': [
'cdm/ppapi/api/content_decryption_module.h',
'cdm/ppapi/cdm_adapter.cc',
'cdm/ppapi/cdm_adapter.h',
'cdm/ppapi/cdm_file_io_impl.cc',
'cdm/ppapi/cdm_file_io_impl.h',
'cdm/ppapi/cdm_helpers.cc',
'cdm/ppapi/cdm_helpers.h',
'cdm/ppapi/cdm_logging.cc',
'cdm/ppapi/cdm_logging.h',
'cdm/ppapi/cdm_wrapper.h',
'cdm/ppapi/linked_ptr.h',
'cdm/ppapi/supported_cdm_versions.h',
],
'conditions': [
['os_posix == 1 and OS != "mac"', {
'cflags': ['-fvisibility=hidden'],
'type': 'loadable_module',
# Allow the adapter to find the CDM in the same directory.
'ldflags': ['-Wl,-rpath=\$$ORIGIN'],
}],
['OS == "win"', {
'type': 'shared_library',
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
}],
['OS == "mac"', {
'type': 'loadable_module',
'product_extension': 'plugin',
'xcode_settings': {
'OTHER_LDFLAGS': [
# Not to strip important symbols by -Wl,-dead_strip.
'-Wl,-exported_symbol,_PPP_GetInterface',
'-Wl,-exported_symbol,_PPP_InitializeModule',
'-Wl,-exported_symbol,_PPP_ShutdownModule'
],
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
},
}],
],
},
},
],
}],
],
}
33 changes: 1 addition & 32 deletions third_party/widevine/cdm/widevine_cdm.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -56,59 +56,28 @@
[ 'branding == "Chrome" and enable_pepper_cdms==1', {
'dependencies': [
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
'<(DEPTH)/media/media_cdm_adapter.gyp:cdmadapter',
'widevine_cdm_version_h',
'widevine_cdm_binaries',
],
'sources': [
'<(DEPTH)/media/cdm/ppapi/api/content_decryption_module.h',
'<(DEPTH)/media/cdm/ppapi/cdm_adapter.cc',
'<(DEPTH)/media/cdm/ppapi/cdm_adapter.h',
'<(DEPTH)/media/cdm/ppapi/cdm_file_io_impl.cc',
'<(DEPTH)/media/cdm/ppapi/cdm_file_io_impl.h',
'<(DEPTH)/media/cdm/ppapi/cdm_helpers.cc',
'<(DEPTH)/media/cdm/ppapi/cdm_helpers.h',
'<(DEPTH)/media/cdm/ppapi/cdm_logging.cc',
'<(DEPTH)/media/cdm/ppapi/cdm_logging.h',
'<(DEPTH)/media/cdm/ppapi/cdm_wrapper.h',
'<(DEPTH)/media/cdm/ppapi/linked_ptr.h',
'<(DEPTH)/media/cdm/ppapi/supported_cdm_versions.h',
],
'conditions': [
[ 'os_posix == 1 and OS != "mac"', {
'cflags': ['-fvisibility=hidden'],
'type': 'loadable_module',
# Allow the plugin adapter to find the CDM in the same directory.
'ldflags': ['-Wl,-rpath=\$$ORIGIN'],
'libraries': [
# Copied by widevine_cdm_binaries.
'<(PRODUCT_DIR)/libwidevinecdm.so',
],
}],
[ 'OS == "win"', {
'type': 'shared_library',
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
'libraries': [
# Copied by widevine_cdm_binaries.
'<(PRODUCT_DIR)/widevinecdm.dll.lib',
],
}],
[ 'OS == "mac"', {
'type': 'loadable_module',
'product_extension': 'plugin',
'libraries': [
# Copied by widevine_cdm_binaries.
'<(PRODUCT_DIR)/libwidevinecdm.dylib',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
# Not to strip important symbols by -Wl,-dead_strip.
'-Wl,-exported_symbol,_PPP_GetInterface',
'-Wl,-exported_symbol,_PPP_InitializeModule',
'-Wl,-exported_symbol,_PPP_ShutdownModule',
],
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
},
}],
],
}],
Expand Down

0 comments on commit 8e0f4b4

Please sign in to comment.