]>
Commit | Line | Data |
---|---|---|
108c5f7c ER |
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 | |
5 | @@ -28,9 +28,9 @@ | |
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" | |
10 | ||
11 | struct AVFormatContext; | |
12 | -struct AVIOContext; | |
13 | ||
14 | namespace media { | |
15 | ||
16 | diff --git a/media/media.gyp b/media/media.gyp | |
17 | index df217d2..fde3830 100644 | |
18 | --- a/media/media.gyp | |
19 | +++ b/media/media.gyp | |
20 | @@ -363,6 +363,9 @@ | |
21 | 'dependencies': [ | |
22 | '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', | |
23 | ], | |
24 | + 'export_dependent_settings': [ | |
25 | + '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', | |
26 | + ], | |
27 | }, { # use_ffmpeg == 0 | |
28 | # Exclude the sources that depend on ffmpeg. | |
29 | 'sources!': [ | |
b0ea35e3 ER |
30 | --- a/media/ffmpeg/ffmpeg_common.cc.orig 2013-01-17 00:07:51.635057013 +0000 |
31 | +++ b/media/ffmpeg/ffmpeg_common.cc 2013-01-17 00:15:50.867406811 +0000 | |
32 | @@ -10,6 +10,8 @@ | |
33 | #include "media/base/video_frame.h" | |
34 | #include "media/base/video_util.h" | |
35 | ||
36 | +#undef SampleFormat | |
37 | + | |
38 | namespace media { | |
39 | ||
40 | // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are | |
bdd77e01 ER |
41 | Index: build/common.gypi |
42 | diff --git a/build/common.gypi b/build/common.gypi | |
43 | index 34c6a15e0add1001e4a24712c9c809e3b698a390..521decfa19d102263086ebf4de7c8bac74c95e30 100644 | |
44 | --- a/build/common.gypi | |
45 | +++ b/build/common.gypi | |
46 | @@ -741,6 +741,9 @@ | |
47 | 'google_default_client_secret%': '<(google_default_client_secret)', | |
48 | 'enable_managed_users%': '<(enable_managed_users)', | |
49 | ||
50 | + # Use system ffmpeg instead of bundled one. | |
51 | + 'use_system_ffmpeg%': 0, | |
52 | + | |
53 | # Use system mesa instead of bundled one. | |
54 | 'use_system_mesa%': 0, | |
55 | ||
56 | Index: media/ffmpeg/ffmpeg_common.cc | |
57 | diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc | |
58 | index 26953efc699a0dc1ce9cd951eb47b04713974b44..bf234304aa2b26fb7e0f729a4e75257099c00358 100644 | |
59 | --- a/media/ffmpeg/ffmpeg_common.cc | |
60 | +++ b/media/ffmpeg/ffmpeg_common.cc | |
61 | @@ -84,8 +84,10 @@ AudioCodec CodecIDToAudioCodec(CodecID codec_id) { | |
b0ea35e3 ER |
62 | return kCodecGSM_MS; |
63 | case CODEC_ID_PCM_MULAW: | |
64 | return kCodecPCM_MULAW; | |
bdd77e01 | 65 | +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS |
b0ea35e3 ER |
66 | case CODEC_ID_OPUS: |
67 | return kCodecOpus; | |
68 | +#endif | |
69 | default: | |
70 | DVLOG(1) << "Unknown audio CodecID: " << codec_id; | |
71 | } | |
bdd77e01 | 72 | @@ -129,8 +131,10 @@ static CodecID AudioCodecToCodecID(AudioCodec audio_codec, |
b0ea35e3 ER |
73 | return CODEC_ID_GSM_MS; |
74 | case kCodecPCM_MULAW: | |
75 | return CODEC_ID_PCM_MULAW; | |
bdd77e01 | 76 | +#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS |
b0ea35e3 ER |
77 | case kCodecOpus: |
78 | return CODEC_ID_OPUS; | |
79 | +#endif | |
80 | default: | |
81 | DVLOG(1) << "Unknown AudioCodec: " << audio_codec; | |
82 | } | |
bdd77e01 | 83 | @@ -147,8 +151,10 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) { |
b0ea35e3 ER |
84 | return kCodecMPEG4; |
85 | case CODEC_ID_VP8: | |
86 | return kCodecVP8; | |
bdd77e01 | 87 | +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9 |
b0ea35e3 ER |
88 | case AV_CODEC_ID_VP9: |
89 | return kCodecVP9; | |
90 | +#endif | |
91 | default: | |
92 | DVLOG(1) << "Unknown video CodecID: " << codec_id; | |
93 | } | |
bdd77e01 | 94 | @@ -165,8 +171,10 @@ static CodecID VideoCodecToCodecID(VideoCodec video_codec) { |
b0ea35e3 ER |
95 | return CODEC_ID_MPEG4; |
96 | case kCodecVP8: | |
97 | return CODEC_ID_VP8; | |
bdd77e01 | 98 | +#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9 |
b0ea35e3 ER |
99 | case kCodecVP9: |
100 | return AV_CODEC_ID_VP9; | |
101 | +#endif | |
102 | default: | |
103 | DVLOG(1) << "Unknown VideoCodec: " << video_codec; | |
104 | } | |
bdd77e01 | 105 | @@ -468,8 +476,10 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) { |
b0ea35e3 ER |
106 | return CHANNEL_LAYOUT_6_1_FRONT; |
107 | case AV_CH_LAYOUT_7POINT0_FRONT: | |
108 | return CHANNEL_LAYOUT_7_0_FRONT; | |
109 | +#ifdef AV_CH_LAYOUT_7POINT1_WIDE_BACK | |
110 | case AV_CH_LAYOUT_7POINT1_WIDE_BACK: | |
111 | return CHANNEL_LAYOUT_7_1_WIDE_BACK; | |
112 | +#endif | |
113 | case AV_CH_LAYOUT_OCTAGONAL: | |
114 | return CHANNEL_LAYOUT_OCTAGONAL; | |
115 | default: | |
bdd77e01 ER |
116 | Index: media/media.gyp |
117 | diff --git a/media/media.gyp b/media/media.gyp | |
118 | index f514dec48e5cc78567d141f20e2cb970a8707e92..75b62bebb503e2d9488bf0fc5cec3fd0a7e1916d 100644 | |
119 | --- a/media/media.gyp | |
120 | +++ b/media/media.gyp | |
121 | @@ -469,6 +469,18 @@ | |
122 | 'filters/vpx_video_decoder.h', | |
123 | ], | |
124 | }], | |
125 | + ['use_system_ffmpeg == 1', { | |
126 | + 'defines': [ | |
127 | + '<!(python <(DEPTH)/tools/compile_test/compile_test.py ' | |
128 | + '--code "#include <libavcodec/avcodec.h>\n' | |
129 | + 'int test() { return CODEC_ID_OPUS; }" ' | |
130 | + '--on-failure CHROMIUM_OMIT_CODEC_ID_OPUS)', | |
131 | + '<!(python <(DEPTH)/tools/compile_test/compile_test.py ' | |
132 | + '--code "#include <libavcodec/avcodec.h>\n' | |
133 | + 'int test() { return AV_CODEC_ID_VP9; }" ' | |
134 | + '--on-failure CHROMIUM_OMIT_AV_CODEC_ID_VP9)', | |
135 | + ], | |
136 | + }], | |
137 | ['OS == "ios"', { | |
138 | 'includes': [ | |
139 | # For shared_memory_support_sources variable. | |
140 | Index: tools/compile_test/compile_test.py | |
141 | diff --git a/tools/compile_test/compile_test.py b/tools/compile_test/compile_test.py | |
142 | new file mode 100755 | |
143 | index 0000000000000000000000000000000000000000..a52c0720209142af858d656a071ca43328dd3b16 | |
144 | --- /dev/null | |
145 | +++ b/tools/compile_test/compile_test.py | |
146 | @@ -0,0 +1,57 @@ | |
147 | +#!/usr/bin/env python | |
148 | +# Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
149 | +# Use of this source code is governed by a BSD-style license that can be | |
150 | +# found in the LICENSE file. | |
151 | + | |
152 | +""" | |
153 | +Tries to compile given code, produces different output depending on success. | |
154 | + | |
155 | +This is similar to checks done by ./configure scripts. | |
156 | +""" | |
157 | + | |
158 | + | |
159 | +import optparse | |
160 | +import os | |
161 | +import shutil | |
162 | +import subprocess | |
163 | +import sys | |
164 | +import tempfile | |
165 | + | |
166 | + | |
167 | +def DoMain(argv): | |
168 | + parser = optparse.OptionParser() | |
169 | + parser.add_option('--code') | |
170 | + parser.add_option('--on-success', default='') | |
171 | + parser.add_option('--on-failure', default='') | |
172 | + | |
173 | + options, args = parser.parse_args(argv) | |
174 | + | |
175 | + if not options.code: | |
176 | + parser.error('Missing required --code switch.') | |
177 | + | |
178 | + cxx = os.environ.get('CXX', 'g++') | |
179 | + | |
180 | + tmpdir = tempfile.mkdtemp() | |
181 | + try: | |
182 | + cxx_path = os.path.join(tmpdir, 'test.cc') | |
183 | + with open(cxx_path, 'w') as f: | |
184 | + f.write(options.code.decode('string-escape')) | |
185 | + | |
186 | + o_path = os.path.join(tmpdir, 'test.o') | |
187 | + | |
188 | + cxx_popen = subprocess.Popen([cxx, cxx_path, '-o', o_path, '-c'], shell=True, | |
189 | + stdout=subprocess.PIPE, | |
190 | + stderr=subprocess.PIPE) | |
191 | + cxx_stdout, cxx_stderr = cxx_popen.communicate() | |
192 | + if cxx_popen.returncode == 0: | |
193 | + print options.on_success | |
194 | + else: | |
195 | + print options.on_failure | |
196 | + finally: | |
197 | + shutil.rmtree(tmpdir) | |
198 | + | |
199 | + return 0 | |
200 | + | |
201 | + | |
202 | +if __name__ == '__main__': | |
203 | + sys.exit(DoMain(sys.argv[1:])) |