]> git.pld-linux.org Git - packages/chromium-browser.git/blame - system-ffmpeg.patch
up to 26.0.1410.28; libvpx patch outdated
[packages/chromium-browser.git] / system-ffmpeg.patch
CommitLineData
108c5f7c
ER
1diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h
2index 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
40a3ea76
ER
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
18@@ -430,6 +430,9 @@
108c5f7c
ER
19 'dependencies': [
20 '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
21 ],
22+ 'export_dependent_settings': [
23+ '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
24+ ],
40a3ea76 25 }, { # media_use_ffmpeg == 0
108c5f7c
ER
26 # Exclude the sources that depend on ffmpeg.
27 'sources!': [
b0ea35e3
ER
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
30@@ -10,6 +10,8 @@
31 #include "media/base/video_frame.h"
32 #include "media/base/video_util.h"
33
34+#undef SampleFormat
35+
36 namespace media {
37
38 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
bdd77e01
ER
39Index: build/common.gypi
40diff --git a/build/common.gypi b/build/common.gypi
41index 34c6a15e0add1001e4a24712c9c809e3b698a390..521decfa19d102263086ebf4de7c8bac74c95e30 100644
42--- a/build/common.gypi
43+++ b/build/common.gypi
44@@ -741,6 +741,9 @@
45 'google_default_client_secret%': '<(google_default_client_secret)',
46 'enable_managed_users%': '<(enable_managed_users)',
47
48+ # Use system ffmpeg instead of bundled one.
49+ 'use_system_ffmpeg%': 0,
50+
51 # Use system mesa instead of bundled one.
52 'use_system_mesa%': 0,
53
54Index: media/ffmpeg/ffmpeg_common.cc
55diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
56index 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) {
b0ea35e3
ER
60 return kCodecGSM_MS;
61 case CODEC_ID_PCM_MULAW:
62 return kCodecPCM_MULAW;
bdd77e01 63+#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
b0ea35e3
ER
64 case CODEC_ID_OPUS:
65 return kCodecOpus;
66+#endif
67 default:
68 DVLOG(1) << "Unknown audio CodecID: " << codec_id;
69 }
bdd77e01 70@@ -129,8 +131,10 @@ static CodecID AudioCodecToCodecID(AudioCodec audio_codec,
b0ea35e3
ER
71 return CODEC_ID_GSM_MS;
72 case kCodecPCM_MULAW:
73 return CODEC_ID_PCM_MULAW;
bdd77e01 74+#ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
b0ea35e3
ER
75 case kCodecOpus:
76 return CODEC_ID_OPUS;
77+#endif
78 default:
79 DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
80 }
bdd77e01 81@@ -147,8 +151,10 @@ VideoCodec CodecIDToVideoCodec(CodecID codec_id) {
b0ea35e3
ER
82 return kCodecMPEG4;
83 case CODEC_ID_VP8:
84 return kCodecVP8;
bdd77e01 85+#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
b0ea35e3
ER
86 case AV_CODEC_ID_VP9:
87 return kCodecVP9;
88+#endif
89 default:
90 DVLOG(1) << "Unknown video CodecID: " << codec_id;
91 }
bdd77e01 92@@ -165,8 +171,10 @@ static CodecID VideoCodecToCodecID(VideoCodec video_codec) {
b0ea35e3
ER
93 return CODEC_ID_MPEG4;
94 case kCodecVP8:
95 return CODEC_ID_VP8;
bdd77e01 96+#ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
b0ea35e3
ER
97 case kCodecVP9:
98 return AV_CODEC_ID_VP9;
99+#endif
100 default:
101 DVLOG(1) << "Unknown VideoCodec: " << video_codec;
102 }
bdd77e01 103@@ -468,8 +476,10 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) {
b0ea35e3
ER
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;
110+#endif
111 case AV_CH_LAYOUT_OCTAGONAL:
112 return CHANNEL_LAYOUT_OCTAGONAL;
113 default:
bdd77e01
ER
114Index: media/media.gyp
115diff --git a/media/media.gyp b/media/media.gyp
116index f514dec48e5cc78567d141f20e2cb970a8707e92..75b62bebb503e2d9488bf0fc5cec3fd0a7e1916d 100644
117--- a/media/media.gyp
118+++ b/media/media.gyp
119@@ -469,6 +469,18 @@
120 'filters/vpx_video_decoder.h',
121 ],
122 }],
123+ ['use_system_ffmpeg == 1', {
124+ 'defines': [
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)',
133+ ],
134+ }],
135 ['OS == "ios"', {
136 'includes': [
137 # For shared_memory_support_sources variable.
138Index: tools/compile_test/compile_test.py
139diff --git a/tools/compile_test/compile_test.py b/tools/compile_test/compile_test.py
140new file mode 100755
141index 0000000000000000000000000000000000000000..a52c0720209142af858d656a071ca43328dd3b16
142--- /dev/null
143+++ b/tools/compile_test/compile_test.py
144@@ -0,0 +1,57 @@
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.
149+
150+"""
151+Tries to compile given code, produces different output depending on success.
152+
153+This is similar to checks done by ./configure scripts.
154+"""
155+
156+
157+import optparse
158+import os
159+import shutil
160+import subprocess
161+import sys
162+import tempfile
163+
164+
165+def DoMain(argv):
166+ parser = optparse.OptionParser()
167+ parser.add_option('--code')
168+ parser.add_option('--on-success', default='')
169+ parser.add_option('--on-failure', default='')
170+
171+ options, args = parser.parse_args(argv)
172+
173+ if not options.code:
174+ parser.error('Missing required --code switch.')
175+
176+ cxx = os.environ.get('CXX', 'g++')
177+
178+ tmpdir = tempfile.mkdtemp()
179+ try:
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'))
183+
184+ o_path = os.path.join(tmpdir, 'test.o')
185+
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
192+ else:
193+ print options.on_failure
194+ finally:
195+ shutil.rmtree(tmpdir)
196+
197+ return 0
198+
199+
200+if __name__ == '__main__':
201+ sys.exit(DoMain(sys.argv[1:]))
This page took 0.050168 seconds and 4 git commands to generate.