1 diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h
2 index 17241b9..8a92312 100644
3 --- a/media/filters/ffmpeg_glue.h
4 +++ b/media/filters/ffmpeg_glue.h
6 #include "base/basictypes.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "media/base/media_export.h"
9 +#include "media/ffmpeg/ffmpeg_common.h"
11 struct AVFormatContext;
16 --- chromium-browser-26.0.1410.28/media/media.gyp~ 2013-03-07 10:20:52.000000000 +0200
17 +++ chromium-browser-26.0.1410.28/media/media.gyp 2013-03-07 10:22:28.357340017 +0200
20 '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
22 + 'export_dependent_settings': [
23 + '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
25 }, { # media_use_ffmpeg == 0
26 # Exclude the sources that depend on ffmpeg.
28 --- a/media/ffmpeg/ffmpeg_common.cc.orig 2013-01-17 00:07:51.635057013 +0000
29 +++ b/media/ffmpeg/ffmpeg_common.cc 2013-01-17 00:15:50.867406811 +0000
31 #include "media/base/video_frame.h"
32 #include "media/base/video_util.h"
38 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
39 Index: build/common.gypi
40 diff --git a/build/common.gypi b/build/common.gypi
41 index 34c6a15e0add1001e4a24712c9c809e3b698a390..521decfa19d102263086ebf4de7c8bac74c95e30 100644
42 --- a/build/common.gypi
43 +++ b/build/common.gypi
45 'google_default_client_secret%': '<(google_default_client_secret)',
46 'enable_managed_users%': '<(enable_managed_users)',
48 + # Use system ffmpeg instead of bundled one.
49 + 'use_system_ffmpeg%': 0,
51 # Use system mesa instead of bundled one.
52 'use_system_mesa%': 0,
54 Index: media/ffmpeg/ffmpeg_common.cc
55 diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
56 index 26953efc699a0dc1ce9cd951eb47b04713974b44..bf234304aa2b26fb7e0f729a4e75257099c00358 100644
57 --- a/media/ffmpeg/ffmpeg_common.cc
58 +++ b/media/ffmpeg/ffmpeg_common.cc
59 @@ -84,8 +84,10 @@ AudioCodec CodecIDToAudioCodec(CodecID codec_id) {
61 case CODEC_ID_PCM_MULAW:
62 return kCodecPCM_MULAW;
63 +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
68 DVLOG(1) << "Unknown audio CodecID: " << codec_id;
70 @@ -129,8 +131,10 @@ static CodecID AudioCodecToCodecID(AudioCodec audio_codec,
71 return CODEC_ID_GSM_MS;
73 return CODEC_ID_PCM_MULAW;
74 +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
79 DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
81 @@ -147,8 +151,10 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) {
85 +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
90 DVLOG(1) << "Unknown video CodecID: " << codec_id;
92 @@ -165,8 +171,10 @@ static CodecID VideoCodecToCodecID(VideoCodec video_codec) {
93 return CODEC_ID_MPEG4;
96 +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
98 return AV_CODEC_ID_VP9;
101 DVLOG(1) << "Unknown VideoCodec: " << video_codec;
103 @@ -468,8 +476,10 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) {
104 return CHANNEL_LAYOUT_6_1_FRONT;
105 case AV_CH_LAYOUT_7POINT0_FRONT:
106 return CHANNEL_LAYOUT_7_0_FRONT;
107 +#ifdef AV_CH_LAYOUT_7POINT1_WIDE_BACK
108 case AV_CH_LAYOUT_7POINT1_WIDE_BACK:
109 return CHANNEL_LAYOUT_7_1_WIDE_BACK;
111 case AV_CH_LAYOUT_OCTAGONAL:
112 return CHANNEL_LAYOUT_OCTAGONAL;
114 Index: media/media.gyp
115 diff --git a/media/media.gyp b/media/media.gyp
116 index f514dec48e5cc78567d141f20e2cb970a8707e92..75b62bebb503e2d9488bf0fc5cec3fd0a7e1916d 100644
117 --- a/media/media.gyp
118 +++ b/media/media.gyp
120 'filters/vpx_video_decoder.h',
123 + ['use_system_ffmpeg == 1', {
125 + '<!(python <(DEPTH)/tools/compile_test/compile_test.py '
126 + '--code "#include <libavcodec/avcodec.h>\n'
127 + 'int test() { return CODEC_ID_OPUS; }" '
128 + '--on-failure CHROMIUM_OMIT_CODEC_ID_OPUS)',
129 + '<!(python <(DEPTH)/tools/compile_test/compile_test.py '
130 + '--code "#include <libavcodec/avcodec.h>\n'
131 + 'int test() { return AV_CODEC_ID_VP9; }" '
132 + '--on-failure CHROMIUM_OMIT_AV_CODEC_ID_VP9)',
137 # For shared_memory_support_sources variable.
138 Index: tools/compile_test/compile_test.py
139 diff --git a/tools/compile_test/compile_test.py b/tools/compile_test/compile_test.py
141 index 0000000000000000000000000000000000000000..a52c0720209142af858d656a071ca43328dd3b16
143 +++ b/tools/compile_test/compile_test.py
145 +#!/usr/bin/env python
146 +# Copyright (c) 2013 The Chromium Authors. All rights reserved.
147 +# Use of this source code is governed by a BSD-style license that can be
148 +# found in the LICENSE file.
151 +Tries to compile given code, produces different output depending on success.
153 +This is similar to checks done by ./configure scripts.
166 + parser = optparse.OptionParser()
167 + parser.add_option('--code')
168 + parser.add_option('--on-success', default='')
169 + parser.add_option('--on-failure', default='')
171 + options, args = parser.parse_args(argv)
173 + if not options.code:
174 + parser.error('Missing required --code switch.')
176 + cxx = os.environ.get('CXX', 'g++')
178 + tmpdir = tempfile.mkdtemp()
180 + cxx_path = os.path.join(tmpdir, 'test.cc')
181 + with open(cxx_path, 'w') as f:
182 + f.write(options.code.decode('string-escape'))
184 + o_path = os.path.join(tmpdir, 'test.o')
186 + cxx_popen = subprocess.Popen([cxx, cxx_path, '-o', o_path, '-c'], shell=True,
187 + stdout=subprocess.PIPE,
188 + stderr=subprocess.PIPE)
189 + cxx_stdout, cxx_stderr = cxx_popen.communicate()
190 + if cxx_popen.returncode == 0:
191 + print options.on_success
193 + print options.on_failure
195 + shutil.rmtree(tmpdir)
200 +if __name__ == '__main__':
201 + sys.exit(DoMain(sys.argv[1:]))