diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h index 17241b9..8a92312 100644 --- a/media/filters/ffmpeg_glue.h +++ b/media/filters/ffmpeg_glue.h @@ -28,9 +28,9 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "media/base/media_export.h" +#include "media/ffmpeg/ffmpeg_common.h" struct AVFormatContext; -struct AVIOContext; namespace media { --- chromium-browser-26.0.1410.28/media/media.gyp~ 2013-03-07 10:20:52.000000000 +0200 +++ chromium-browser-26.0.1410.28/media/media.gyp 2013-03-07 10:22:28.357340017 +0200 @@ -430,6 +430,9 @@ 'dependencies': [ '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', ], + 'export_dependent_settings': [ + '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', + ], }, { # media_use_ffmpeg == 0 # Exclude the sources that depend on ffmpeg. 'sources!': [ --- a/media/ffmpeg/ffmpeg_common.cc.orig 2013-01-17 00:07:51.635057013 +0000 +++ b/media/ffmpeg/ffmpeg_common.cc 2013-01-17 00:15:50.867406811 +0000 @@ -10,6 +10,8 @@ #include "media/base/video_frame.h" #include "media/base/video_util.h" +#undef SampleFormat + namespace media { // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are Index: build/common.gypi diff --git a/build/common.gypi b/build/common.gypi index 34c6a15e0add1001e4a24712c9c809e3b698a390..521decfa19d102263086ebf4de7c8bac74c95e30 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -741,6 +741,9 @@ 'google_default_client_secret%': '<(google_default_client_secret)', 'enable_managed_users%': '<(enable_managed_users)', + # Use system ffmpeg instead of bundled one. + 'use_system_ffmpeg%': 0, + # Use system mesa instead of bundled one. 'use_system_mesa%': 0, Index: media/ffmpeg/ffmpeg_common.cc diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index 26953efc699a0dc1ce9cd951eb47b04713974b44..bf234304aa2b26fb7e0f729a4e75257099c00358 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -84,8 +84,10 @@ AudioCodec CodecIDToAudioCodec(CodecID codec_id) { return kCodecGSM_MS; case CODEC_ID_PCM_MULAW: return kCodecPCM_MULAW; +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS case CODEC_ID_OPUS: return kCodecOpus; +#endif default: DVLOG(1) << "Unknown audio CodecID: " << codec_id; } @@ -129,8 +131,10 @@ static CodecID AudioCodecToCodecID(AudioCodec audio_codec, return CODEC_ID_GSM_MS; case kCodecPCM_MULAW: return CODEC_ID_PCM_MULAW; +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS case kCodecOpus: return CODEC_ID_OPUS; +#endif default: DVLOG(1) << "Unknown AudioCodec: " << audio_codec; } @@ -147,8 +151,10 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) { return kCodecMPEG4; case CODEC_ID_VP8: return kCodecVP8; +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9 case AV_CODEC_ID_VP9: return kCodecVP9; +#endif default: DVLOG(1) << "Unknown video CodecID: " << codec_id; } @@ -165,8 +171,10 @@ static CodecID VideoCodecToCodecID(VideoCodec video_codec) { return CODEC_ID_MPEG4; case kCodecVP8: return CODEC_ID_VP8; +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9 case kCodecVP9: return AV_CODEC_ID_VP9; +#endif default: DVLOG(1) << "Unknown VideoCodec: " << video_codec; } @@ -468,8 +476,10 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) { return CHANNEL_LAYOUT_6_1_FRONT; case AV_CH_LAYOUT_7POINT0_FRONT: return CHANNEL_LAYOUT_7_0_FRONT; +#ifdef AV_CH_LAYOUT_7POINT1_WIDE_BACK case AV_CH_LAYOUT_7POINT1_WIDE_BACK: return CHANNEL_LAYOUT_7_1_WIDE_BACK; +#endif case AV_CH_LAYOUT_OCTAGONAL: return CHANNEL_LAYOUT_OCTAGONAL; default: Index: media/media.gyp diff --git a/media/media.gyp b/media/media.gyp index f514dec48e5cc78567d141f20e2cb970a8707e92..75b62bebb503e2d9488bf0fc5cec3fd0a7e1916d 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -469,6 +469,18 @@ 'filters/vpx_video_decoder.h', ], }], + ['use_system_ffmpeg == 1', { + 'defines': [ + '\n' + 'int test() { return CODEC_ID_OPUS; }" ' + '--on-failure CHROMIUM_OMIT_CODEC_ID_OPUS)', + '\n' + 'int test() { return AV_CODEC_ID_VP9; }" ' + '--on-failure CHROMIUM_OMIT_AV_CODEC_ID_VP9)', + ], + }], ['OS == "ios"', { 'includes': [ # For shared_memory_support_sources variable. Index: tools/compile_test/compile_test.py diff --git a/tools/compile_test/compile_test.py b/tools/compile_test/compile_test.py new file mode 100755 index 0000000000000000000000000000000000000000..a52c0720209142af858d656a071ca43328dd3b16 --- /dev/null +++ b/tools/compile_test/compile_test.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# Copyright (c) 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. + +""" +Tries to compile given code, produces different output depending on success. + +This is similar to checks done by ./configure scripts. +""" + + +import optparse +import os +import shutil +import subprocess +import sys +import tempfile + + +def DoMain(argv): + parser = optparse.OptionParser() + parser.add_option('--code') + parser.add_option('--on-success', default='') + parser.add_option('--on-failure', default='') + + options, args = parser.parse_args(argv) + + if not options.code: + parser.error('Missing required --code switch.') + + cxx = os.environ.get('CXX', 'g++') + + tmpdir = tempfile.mkdtemp() + try: + cxx_path = os.path.join(tmpdir, 'test.cc') + with open(cxx_path, 'w') as f: + f.write(options.code.decode('string-escape')) + + o_path = os.path.join(tmpdir, 'test.o') + + cxx_popen = subprocess.Popen([cxx, cxx_path, '-o', o_path, '-c'], shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + cxx_stdout, cxx_stderr = cxx_popen.communicate() + if cxx_popen.returncode == 0: + print options.on_success + else: + print options.on_failure + finally: + shutil.rmtree(tmpdir) + + return 0 + + +if __name__ == '__main__': + sys.exit(DoMain(sys.argv[1:]))