summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:33:16 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:33:16 +0000
commit808663e89da849cd5192bf04b1757975b7fba0f2 (patch)
tree2b357127fbda563822764371ed98236eb01d60bd /third_party
parent1082b1dd85c92e5260911989d8022988bacb676e (diff)
downloadchromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.zip
chromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.tar.gz
chromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.tar.bz2
Fix use_system_ffmpeg and clean up ffmpeg.gyp
To make use_system_ffmpeg work more correctly, we now use the system include path for headers and make use of the version number macros to determine the shared library names. Also removed a bunch of cruft without breaking anything on Windows, Mac or Linux. BUG=23602, 39430 TEST=ffmpeg should still work both with and without use_system_ffmpeg Review URL: http://codereview.chromium.org/1503002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/ffmpeg/ffmpeg.gyp354
-rw-r--r--third_party/ffmpeg/ffmpeg_stub_headers.fragment4
2 files changed, 160 insertions, 198 deletions
diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp
index e111887..40873e8 100644
--- a/third_party/ffmpeg/ffmpeg.gyp
+++ b/third_party/ffmpeg/ffmpeg.gyp
@@ -38,6 +38,12 @@
}, {
'ffmpeg_config%': '<(target_arch)',
}],
+ ['target_arch=="x64" or target_arch=="ia32"', {
+ 'ffmpeg_asm_lib': 1,
+ }],
+ ['target_arch=="arm"', {
+ 'ffmpeg_asm_lib': 0,
+ }],
],
'ffmpeg_variant%': '<(target_arch)',
@@ -49,30 +55,7 @@
'asm_library': 'ffmpegasm',
},
'conditions': [
- # This condition is for migrating from pre-built binaries to an in-tree
- # source build. Most of these should be removed once FFmpeg is built on
- # mac and linux. Windows will take more work.
- #
- # TODO(ajwong): Per the comment above, reduce this conditional's size and
- # determine if in-tree build in Windows is tractable.
- ['(OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="solaris" and OS!="mac") or use_system_ffmpeg!=0', {
- 'variables': {
- 'target_for_binaries': 'ffmpeg_binaries',
- 'ffmpeg_include_root': 'source/patched-ffmpeg-mt',
- },
- },{ # else OS=="linux"
- 'variables': {
- 'target_for_binaries': 'ffmpegsumo_nolink',
- 'ffmpeg_include_root': 'source/patched-ffmpeg-mt',
- 'conditions': [
- ['target_arch=="x64" or target_arch=="ia32"', {
- 'ffmpeg_asm_lib': 1,
- }],
- ['target_arch=="arm"', {
- 'ffmpeg_asm_lib': 0,
- }],
- ],
- },
+ ['OS!="win" and use_system_ffmpeg==0', {
'targets': [
{
'target_name': 'ffmpegsumo',
@@ -597,7 +580,7 @@
},
],
}],
- ],
+ ], # conditions
'targets': [
{
'variables': {
@@ -611,28 +594,10 @@
],
'extra_header': 'ffmpeg_stub_headers.fragment',
},
+
'target_name': 'ffmpeg',
'msvs_guid': 'D7A94F58-576A-45D9-A45F-EB87C63ABBB0',
- 'dependencies': [
- '<(target_for_binaries)',
- 'ffmpeg_binaries',
- ],
'sources': [
- '<(ffmpeg_include_root)/libavcodec/avcodec.h',
- '<(ffmpeg_include_root)/libavcodec/opt.h',
- '<(ffmpeg_include_root)/libavcodec/vdpau.h',
- '<(ffmpeg_include_root)/libavcodec/xvmc.h',
- '<(ffmpeg_include_root)/libavformat/avformat.h',
- '<(ffmpeg_include_root)/libavformat/avio.h',
- '<(ffmpeg_include_root)/libavutil/avstring.h',
- '<(ffmpeg_include_root)/libavutil/crc.h',
- '<(ffmpeg_include_root)/libavutil/intfloat_readwrite.h',
- '<(ffmpeg_include_root)/libavutil/log.h',
- '<(ffmpeg_include_root)/libavutil/mathematics.h',
- '<(ffmpeg_include_root)/libavutil/mem.h',
- '<(ffmpeg_include_root)/libavutil/pixfmt.h',
- '<(ffmpeg_include_root)/libavutil/rational.h',
-
# Hacks to introduce C99 types into Visual Studio.
'include/win/inttypes.h',
'include/win/stdint.h',
@@ -642,178 +607,175 @@
'<(extra_header)'
],
'hard_dependency': 1,
- 'direct_dependent_settings': {
- 'include_dirs': [
- 'source/patched-ffmpeg-mt',
- 'source/config',
- ],
- },
+
+ # Do not fear the massive conditional blocks! They do the following:
+ # 1) Use the Window stub generator on Windows
+ # 2) Else, use the POSIX stub generator on non-Windows
+ # a) Use system includes when use_system_ffmpeg!=0
+ # b) Else, use our local copy in source/patched-ffmpeg-mt
'conditions': [
- ['OS=="win"',
- {
- 'variables': {
- 'outfile_type': 'windows_lib',
- 'output_dir': '<(PRODUCT_DIR)/lib',
- 'intermediate_dir': '<(INTERMEDIATE_DIR)',
- },
- 'type': 'none',
- 'sources!': [
- '<(extra_header)',
+ ['OS=="win"', {
+ 'variables': {
+ 'outfile_type': 'windows_lib',
+ 'output_dir': '<(PRODUCT_DIR)/lib',
+ 'intermediate_dir': '<(INTERMEDIATE_DIR)',
+ # TODO(scherkus): Change Windows DEPS directory so we don't need
+ # this conditional.
+ 'conditions': [
+ [ 'ffmpeg_branding=="Chrome"', {
+ 'ffmpeg_bin_dir': 'chrome/<(OS)/<(ffmpeg_variant)',
+ }, { # else ffmpeg_branding!="Chrome", assume chromium.
+ 'ffmpeg_bin_dir': 'chromium/<(OS)/<(ffmpeg_variant)',
+ }],
],
- 'direct_dependent_settings': {
- 'include_dirs': [
- 'include/win',
- ],
- 'link_settings': {
- 'libraries': [
- '<(output_dir)/avcodec-52.lib',
- '<(output_dir)/avformat-52.lib',
- '<(output_dir)/avutil-50.lib',
- ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'DelayLoadDLLs': [
- 'avcodec-52.dll',
- 'avformat-52.dll',
- 'avutil-50.dll',
- ],
- },
+ },
+ 'type': 'none',
+ 'sources!': [
+ '<(extra_header)',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ 'include/win',
+ 'source/config',
+ 'source/patched-ffmpeg-mt',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '<(output_dir)/avcodec-52.lib',
+ '<(output_dir)/avformat-52.lib',
+ '<(output_dir)/avutil-50.lib',
+ ],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'DelayLoadDLLs': [
+ 'avcodec-52.dll',
+ 'avformat-52.dll',
+ 'avutil-50.dll',
+ ],
},
},
},
- 'rules': [
- {
- 'rule_name': 'generate_libs',
- 'extension': 'sigs',
- 'inputs': [
- '<(generate_stubs_script)',
- '<@(sig_files)',
- ],
- 'outputs': [
- '<(output_dir)/<(RULE_INPUT_ROOT).lib',
- ],
- 'action': ['python', '<(generate_stubs_script)',
- '-i', '<(intermediate_dir)',
- '-o', '<(output_dir)',
- '-t', '<(outfile_type)',
- '<@(RULE_INPUT_PATH)',
- ],
- 'message': 'Generating FFmpeg import libraries.',
- },
- ],
- }, { # else OS!="win"
- 'variables': {
- 'outfile_type': 'posix_stubs',
- 'stubs_filename_root': 'ffmpeg_stubs',
- 'project_path': 'third_party/ffmpeg',
- 'intermediate_dir': '<(INTERMEDIATE_DIR)',
- 'output_root': '<(SHARED_INTERMEDIATE_DIR)/ffmpeg',
+ },
+ 'rules': [
+ {
+ 'rule_name': 'generate_libs',
+ 'extension': 'sigs',
+ 'inputs': [
+ '<(generate_stubs_script)',
+ '<@(sig_files)',
+ ],
+ 'outputs': [
+ '<(output_dir)/<(RULE_INPUT_ROOT).lib',
+ ],
+ 'action': ['python', '<(generate_stubs_script)',
+ '-i', '<(intermediate_dir)',
+ '-o', '<(output_dir)',
+ '-t', '<(outfile_type)',
+ '<@(RULE_INPUT_PATH)',
+ ],
+ 'message': 'Generating FFmpeg import libraries.',
},
- 'type': '<(library)',
+ ],
+
+ # Copy prebuilt binaries to build directory.
+ 'dependencies': ['../../build/win/system.gyp:cygwin'],
+ 'copies': [{
+ 'destination': '<(PRODUCT_DIR)/',
+ 'files': [
+ 'binaries/<(ffmpeg_bin_dir)/avcodec-52.dll',
+ 'binaries/<(ffmpeg_bin_dir)/avformat-52.dll',
+ 'binaries/<(ffmpeg_bin_dir)/avutil-50.dll',
+ ],
+ }],
+ }, { # else OS!="win", use POSIX stub generator
+ 'variables': {
+ 'outfile_type': 'posix_stubs',
+ 'stubs_filename_root': 'ffmpeg_stubs',
+ 'project_path': 'third_party/ffmpeg',
+ 'intermediate_dir': '<(INTERMEDIATE_DIR)',
+ 'output_root': '<(SHARED_INTERMEDIATE_DIR)/ffmpeg',
+ },
+ 'type': '<(library)',
+ 'include_dirs': [
+ '<(output_root)',
+ '../..', # The chromium 'src' directory.
+ ],
+ 'direct_dependent_settings': {
+ 'defines': [
+ '__STDC_CONSTANT_MACROS', # FFmpeg uses INT64_C.
+ ],
'include_dirs': [
- 'source/patched-ffmpeg-mt',
- 'source/config',
'<(output_root)',
'../..', # The chromium 'src' directory.
],
- 'direct_dependent_settings': {
- 'defines': [
- '__STDC_CONSTANT_MACROS', # FFmpeg uses INT64_C.
- ],
- 'include_dirs': [
- '<(output_root)',
- '../..', # The chromium 'src' directory.
+ },
+ 'actions': [
+ {
+ 'action_name': 'generate_stubs',
+ 'inputs': [
+ '<(generate_stubs_script)',
+ '<(extra_header)',
+ '<@(sig_files)',
],
+ 'outputs': [
+ '<(intermediate_dir)/<(stubs_filename_root).cc',
+ '<(output_root)/<(project_path)/<(stubs_filename_root).h',
+ ],
+ 'action': ['python',
+ '<(generate_stubs_script)',
+ '-i', '<(intermediate_dir)',
+ '-o', '<(output_root)/<(project_path)',
+ '-t', '<(outfile_type)',
+ '-e', '<(extra_header)',
+ '-s', '<(stubs_filename_root)',
+ '-p', '<(project_path)',
+ '<@(_inputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ 'message': 'Generating FFmpeg stubs for dynamic loading.',
},
- 'actions': [
- {
- 'action_name': 'generate_stubs',
- 'inputs': [
- '<(generate_stubs_script)',
- '<(extra_header)',
- '<@(sig_files)',
- ],
- 'outputs': [
- '<(intermediate_dir)/<(stubs_filename_root).cc',
- '<(output_root)/<(project_path)/<(stubs_filename_root).h',
- ],
- 'action': ['python',
- '<(generate_stubs_script)',
- '-i', '<(intermediate_dir)',
- '-o', '<(output_root)/<(project_path)',
- '-t', '<(outfile_type)',
- '-e', '<(extra_header)',
- '-s', '<(stubs_filename_root)',
- '-p', '<(project_path)',
- '<@(_inputs)',
+ ],
+
+ 'conditions': [
+ # Non-Mac platforms need libdl for dlopen() and friends.
+ ['OS!="mac"', {
+ 'link_settings': {
+ 'libraries': [
+ '-ldl',
],
- 'process_outputs_as_sources': 1,
- 'message': 'Generating FFmpeg stubs for dynamic loading.',
},
- ],
- },
- ],
- ['OS=="linux" or OS=="freebsd" or OS=="solaris"', {
- 'link_settings': {
- 'libraries': [
- # We need dl for dlopen() and friends.
- '-ldl',
- ],
- },
- }],
- ], # conditions
- },
- {
- 'target_name': 'ffmpeg_binaries',
- 'type': 'none',
- 'msvs_guid': '4E4070E1-EFD9-4EF1-8634-3960956F6F10',
- 'variables': {
- 'conditions': [
- [ 'ffmpeg_branding=="Chrome"', {
- 'ffmpeg_bin_dir': 'chrome/<(OS)/<(ffmpeg_variant)',
- }, { # else ffmpeg_branding!="Chrome", assume chromium.
- 'ffmpeg_bin_dir': 'chromium/<(OS)/<(ffmpeg_variant)',
- }],
- ],
- },
- 'conditions': [
- ['OS=="win"', {
- 'variables': {
- 'source_files': [
- 'binaries/<(ffmpeg_bin_dir)/avcodec-52.dll',
- 'binaries/<(ffmpeg_bin_dir)/avformat-52.dll',
- 'binaries/<(ffmpeg_bin_dir)/avutil-50.dll',
- ],
- },
- 'dependencies': ['../../build/win/system.gyp:cygwin'],
- }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
- 'variables': {
- # TODO(ajwong): Clean this up after we've finished
- # migrating to in-tree build.
- 'source_files': [
+ }],
+
+ # Add pkg-config result to include path when use_system_ffmpeg!=0
+ ['use_system_ffmpeg!=0', {
+ 'cflags': [
+ '<!@(pkg-config --cflags libavcodec libavformat libavutil)',
+ ],
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(pkg-config --cflags libavcodec libavformat libavutil)',
],
},
- }], ['OS=="mac"', {
- # TODO(ajwong): These files are also copied in:
- # webkit/tools/test_shell/test_shell.gypi and
- # chrome/chrome.gyp
- # Need to consolidate the copies in one place. (BUG=23602)
- 'variables': {
- 'source_files': [
+ }, { # else use_system_ffmpeg==0, add local copy to include path
+ 'include_dirs': [
+ 'source/config',
+ 'source/patched-ffmpeg-mt',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ 'source/config',
+ 'source/patched-ffmpeg-mt',
],
},
+ 'dependencies': [
+ 'ffmpegsumo_nolink',
+ ],
+ }],
+ ], # conditions
}],
- ],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)/',
- 'files': [
- '<@(source_files)',
- ]
- },
- ],
+ ], # conditions
},
- ],
+ ], # targets
}
# Local Variables:
diff --git a/third_party/ffmpeg/ffmpeg_stub_headers.fragment b/third_party/ffmpeg/ffmpeg_stub_headers.fragment
index a40cac9..b171690 100644
--- a/third_party/ffmpeg/ffmpeg_stub_headers.fragment
+++ b/third_party/ffmpeg/ffmpeg_stub_headers.fragment
@@ -3,8 +3,8 @@
extern "C" {
-#include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavcodec/avcodec.h"
-#include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavformat/avformat.h"
+#include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
typedef int (*AVLockMgrOperation)(void**, enum AVLockOp);