codec: videotoolbox: check if H264 needs restart
[vlc.git] / contrib / src / ffmpeg / rules.mak
blob41d16a4fb2674d9278addff8e7aa299dc7a20df0
1 # FFmpeg
3 #Uncomment the one you want
4 #USE_LIBAV ?= 1
5 #USE_FFMPEG ?= 1
7 ifdef USE_FFMPEG
8 FFMPEG_HASH=a82468514048fb87d9bf38689866bc3b9aaccd02
9 FFMPEG_SNAPURL := http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=$(FFMPEG_HASH);sf=tgz
10 FFMPEG_GITURL := http://git.videolan.org/git/ffmpeg.git
11 else
12 FFMPEG_HASH=825e463a170c7004c63030dc484b2b2de869227b
13 FFMPEG_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=$(FFMPEG_HASH);sf=tgz
14 FFMPEG_GITURL := git://git.libav.org/libav.git
15 endif
17 FFMPEG_BASENAME := $(subst .,_,$(subst \,_,$(subst /,_,$(FFMPEG_HASH))))
19 FFMPEGCONF = \
20 --cc="$(CC)" \
21 --pkg-config="$(PKG_CONFIG)" \
22 --disable-doc \
23 --disable-encoder=vorbis \
24 --disable-decoder=opus \
25 --enable-libgsm \
26 --enable-libopenjpeg \
27 --disable-debug \
28 --disable-avdevice \
29 --disable-devices \
30 --disable-avfilter \
31 --disable-filters \
32 --disable-protocol=concat \
33 --disable-bsfs \
34 --disable-bzlib \
35 --disable-avresample
37 ifdef USE_FFMPEG
38 FFMPEGCONF += \
39 --disable-swresample \
40 --disable-iconv \
41 --disable-avisynth \
42 --disable-nvenc
43 ifdef HAVE_DARWIN_OS
44 FFMPEGCONF += \
45 --disable-videotoolbox
46 endif
47 endif
49 DEPS_ffmpeg = zlib gsm openjpeg
51 # Optional dependencies
52 ifndef BUILD_NETWORK
53 FFMPEGCONF += --disable-network
54 endif
55 ifdef BUILD_ENCODERS
56 FFMPEGCONF += --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx_vp8 --disable-decoder=libvpx_vp9
57 ifndef USE_FFMPEG
58 FFMPEGCONF += --disable-decoder=libvpx
59 endif
60 DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
61 else
62 FFMPEGCONF += --disable-encoders --disable-muxers
63 endif
65 # Small size
66 ifdef WITH_OPTIMIZATION
67 ifdef ENABLE_SMALL
68 FFMPEGCONF += --enable-small
69 endif
70 ifeq ($(ARCH),arm)
71 ifdef HAVE_ARMV7A
72 FFMPEGCONF += --enable-thumb
73 endif
74 endif
75 else
76 FFMPEGCONF += --optflags=-O0
77 endif
79 ifdef HAVE_CROSS_COMPILE
80 FFMPEGCONF += --enable-cross-compile --disable-programs
81 ifndef HAVE_DARWIN_OS
82 FFMPEGCONF += --cross-prefix=$(HOST)-
83 endif
84 endif
86 # ARM stuff
87 ifeq ($(ARCH),arm)
88 FFMPEGCONF += --arch=arm
89 ifdef HAVE_NEON
90 FFMPEGCONF += --enable-neon
91 endif
92 ifdef HAVE_ARMV7A
93 FFMPEGCONF += --cpu=cortex-a8
94 endif
95 ifdef HAVE_ARMV6
96 FFMPEGCONF += --cpu=armv6 --disable-neon
97 endif
98 endif
100 # ARM64 stuff
101 ifeq ($(ARCH),aarch64)
102 FFMPEGCONF += --arch=aarch64
103 endif
105 # MIPS stuff
106 ifeq ($(ARCH),mipsel)
107 FFMPEGCONF += --arch=mips
108 endif
109 ifeq ($(ARCH),mips64el)
110 FFMPEGCONF += --arch=mips64
111 endif
113 # x86 stuff
114 ifeq ($(ARCH),i386)
115 ifndef HAVE_DARWIN_OS
116 FFMPEGCONF += --arch=x86
117 endif
118 endif
120 # x86_64 stuff
121 ifeq ($(ARCH),x86_64)
122 ifndef HAVE_DARWIN_OS
123 FFMPEGCONF += --arch=x86_64
124 endif
125 endif
127 # Darwin
128 ifdef HAVE_DARWIN_OS
129 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
130 ifdef USE_FFMPEG
131 FFMPEGCONF += --disable-lzma
132 endif
133 ifeq ($(ARCH),x86_64)
134 FFMPEGCONF += --cpu=core2
135 endif
136 ifdef HAVE_IOS
137 FFMPEGCONF += --enable-pic --extra-ldflags="$(EXTRA_CFLAGS)"
138 ifdef HAVE_NEON
139 FFMPEGCONF += --as="$(AS)"
140 endif
141 endif
142 ifdef HAVE_MACOSX
143 FFMPEGCONF += --enable-vda
144 endif
145 endif
147 # Linux
148 ifdef HAVE_LINUX
149 FFMPEGCONF += --target-os=linux --enable-pic
151 endif
153 ifdef HAVE_ANDROID
154 # broken text relocations
155 ifeq ($(ANDROID_ABI), x86)
156 FFMPEGCONF += --disable-mmx --disable-mmxext --disable-inline-asm
157 endif
158 ifeq ($(ANDROID_ABI), x86_64)
159 FFMPEGCONF += --disable-mmx --disable-mmxext --disable-inline-asm
160 endif
161 ifdef HAVE_NEON
162 ifeq ($(ANDROID_ABI), armeabi-v7a)
163 FFMPEGCONF += --as='gas-preprocessor.pl -as-type clang -arch arm $(CC)'
164 endif
165 endif
166 endif
168 # Windows
169 ifdef HAVE_WIN32
170 ifndef HAVE_VISUALSTUDIO
171 DEPS_ffmpeg += d3d11
172 ifndef HAVE_MINGW_W64
173 DEPS_ffmpeg += directx
174 endif
175 endif
176 FFMPEGCONF += --target-os=mingw32
177 FFMPEGCONF += --enable-w32threads
178 ifndef HAVE_WINSTORE
179 FFMPEGCONF += --enable-dxva2
180 else
181 FFMPEGCONF += --disable-dxva2
182 endif
184 ifdef HAVE_WIN64
185 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
186 else
187 ifeq ($(ARCH),i386) # 32bits intel
188 FFMPEGCONF+= --cpu=i686 --arch=x86
189 else
190 ifdef HAVE_ARMV7A
191 FFMPEGCONF+= --arch=arm
192 endif
193 endif
194 endif
196 else # !Windows
197 FFMPEGCONF += --enable-pthreads
198 endif
200 # Solaris
201 ifdef HAVE_SOLARIS
202 ifeq ($(ARCH),x86_64)
203 FFMPEGCONF += --cpu=core2
204 endif
205 FFMPEGCONF += --target-os=sunos --enable-pic
206 endif
208 # Build
209 PKGS += ffmpeg
210 ifeq ($(call need_pkg,"libavcodec >= 55.0.0 libavformat >= 53.21.0 libswscale"),)
211 PKGS_FOUND += ffmpeg
212 endif
214 FFMPEGCONF += --nm="$(NM)" --ar="$(AR)"
216 $(TARBALLS)/ffmpeg-$(FFMPEG_BASENAME).tar.xz:
217 $(call download_git,$(FFMPEG_GITURL),,$(FFMPEG_HASH))
219 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_BASENAME).tar.xz
220 $(call check_githash,$(FFMPEG_HASH))
221 touch $@
223 ffmpeg: ffmpeg-$(FFMPEG_BASENAME).tar.xz .sum-ffmpeg
224 rm -Rf $@ $@-$(FFMPEG_BASENAME)
225 mkdir -p $@-$(FFMPEG_BASENAME)
226 tar xvJf "$<" --strip-components=1 -C $@-$(FFMPEG_BASENAME)
227 ifdef USE_FFMPEG
228 $(APPLY) $(SRC)/ffmpeg/force-unicode.patch
229 endif
230 $(MOVE)
232 .ffmpeg: ffmpeg
233 cd $< && $(HOSTVARS) ./configure \
234 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
235 --prefix="$(PREFIX)" --enable-static --disable-shared
236 cd $< && $(MAKE) install-libs install-headers
237 touch $@