1 ################################################################################
5 ################################################################################
8 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz
9 FFMPEG_SITE = http://ffmpeg.org/releases
10 FFMPEG_INSTALL_STAGING = YES
12 FFMPEG_LICENSE = LGPLv2.1+, libjpeg license
13 FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1
14 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
15 FFMPEG_LICENSE += and GPLv2+
16 FFMPEG_LICENSE_FILES += COPYING.GPLv2
24 --enable-optimizations \
25 --disable-extra-warnings \
32 --enable-swscale-alpha \
40 --enable-runtime-cpudetect \
41 --disable-hardcoded-tables \
42 --disable-memalign-hack \
52 --disable-libopencore-amrnb \
53 --disable-libopencore-amrwb \
59 --disable-libopenjpeg \
60 --disable-libschroedinger \
61 --disable-libvo-amrwbenc \
65 FFMPEG_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv) host-pkgconf
67 ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
68 FFMPEG_CONF_OPTS += --enable-gpl
70 FFMPEG_CONF_OPTS += --disable-gpl
73 ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
74 FFMPEG_CONF_OPTS += --enable-nonfree
76 FFMPEG_CONF_OPTS += --disable-nonfree
79 ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
80 FFMPEG_CONF_OPTS += --enable-ffmpeg
82 FFMPEG_CONF_OPTS += --disable-ffmpeg
85 ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
86 FFMPEG_DEPENDENCIES += sdl2
87 FFMPEG_CONF_OPTS += --enable-ffplay
88 FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config
90 FFMPEG_CONF_OPTS += --disable-ffplay
93 ifeq ($(BR2_PACKAGE_FFMPEG_FFSERVER),y)
94 FFMPEG_CONF_OPTS += --enable-ffserver
96 FFMPEG_CONF_OPTS += --disable-ffserver
99 ifeq ($(BR2_PACKAGE_FFMPEG_AVRESAMPLE),y)
100 FFMPEG_CONF_OPTS += --enable-avresample
102 FFMPEG_CONF_OPTS += --disable-avresample
105 ifeq ($(BR2_PACKAGE_FFMPEG_FFPROBE),y)
106 FFMPEG_CONF_OPTS += --enable-ffprobe
108 FFMPEG_CONF_OPTS += --disable-ffprobe
111 ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
112 FFMPEG_CONF_OPTS += --enable-postproc
114 FFMPEG_CONF_OPTS += --disable-postproc
117 ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
118 FFMPEG_CONF_OPTS += --enable-swscale
120 FFMPEG_CONF_OPTS += --disable-swscale
123 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
124 FFMPEG_CONF_OPTS += --disable-encoders \
125 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
128 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
129 FFMPEG_CONF_OPTS += --disable-decoders \
130 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
133 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
134 FFMPEG_CONF_OPTS += --disable-muxers \
135 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
138 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
139 FFMPEG_CONF_OPTS += --disable-demuxers \
140 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
143 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
144 FFMPEG_CONF_OPTS += --disable-parsers \
145 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
148 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
149 FFMPEG_CONF_OPTS += --disable-bsfs \
150 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsfs=$(x))
153 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
154 FFMPEG_CONF_OPTS += --disable-protocols \
155 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
158 ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
159 FFMPEG_CONF_OPTS += --disable-filters \
160 $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
163 ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
164 FFMPEG_CONF_OPTS += --enable-indevs
165 ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
166 FFMPEG_DEPENDENCIES += alsa-lib
169 FFMPEG_CONF_OPTS += --disable-indevs
172 ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
173 FFMPEG_CONF_OPTS += --enable-outdevs
174 ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
175 FFMPEG_DEPENDENCIES += alsa-lib
178 FFMPEG_CONF_OPTS += --disable-outdevs
181 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
182 FFMPEG_CONF_OPTS += --enable-pthreads
184 FFMPEG_CONF_OPTS += --disable-pthreads
187 ifeq ($(BR2_PACKAGE_ZLIB),y)
188 FFMPEG_CONF_OPTS += --enable-zlib
189 FFMPEG_DEPENDENCIES += zlib
191 FFMPEG_CONF_OPTS += --disable-zlib
194 ifeq ($(BR2_PACKAGE_BZIP2),y)
195 FFMPEG_CONF_OPTS += --enable-bzlib
196 FFMPEG_DEPENDENCIES += bzip2
198 FFMPEG_CONF_OPTS += --disable-bzlib
201 ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy)
202 FFMPEG_CONF_OPTS += --enable-libfdk-aac
203 FFMPEG_DEPENDENCIES += fdk-aac
205 FFMPEG_CONF_OPTS += --disable-libfdk-aac
208 ifeq ($(BR2_PACKAGE_GNUTLS),y)
209 FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl
210 FFMPEG_DEPENDENCIES += gnutls
212 FFMPEG_CONF_OPTS += --disable-gnutls
213 ifeq ($(BR2_PACKAGE_OPENSSL),y)
214 # openssl isn't license compatible with GPL
215 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
216 FFMPEG_CONF_OPTS += --disable-openssl
218 FFMPEG_CONF_OPTS += --enable-openssl
219 FFMPEG_DEPENDENCIES += openssl
222 FFMPEG_CONF_OPTS += --disable-openssl
226 ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy)
227 FFMPEG_DEPENDENCIES += libebur128
230 ifeq ($(BR2_PACKAGE_LIBOPENH264),y)
231 FFMPEG_CONF_OPTS += --enable-libopenh264
232 FFMPEG_DEPENDENCIES += libopenh264
234 FFMPEG_CONF_OPTS += --disable-libopenh264
237 ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
238 FFMPEG_DEPENDENCIES += libvorbis
239 FFMPEG_CONF_OPTS += \
242 --enable-encoder=libvorbis
245 ifeq ($(BR2_PACKAGE_LIBVA),y)
246 FFMPEG_CONF_OPTS += --enable-vaapi
247 FFMPEG_DEPENDENCIES += libva
249 FFMPEG_CONF_OPTS += --disable-vaapi
252 ifeq ($(BR2_PACKAGE_LIBVDPAU),y)
253 FFMPEG_CONF_OPTS += --enable-vdpau
254 FFMPEG_DEPENDENCIES += libvdpau
256 FFMPEG_CONF_OPTS += --disable-vdpau
259 # To avoid a circular dependency only use opencv if opencv itself does
260 # not depend on ffmpeg.
261 ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx)
262 FFMPEG_CONF_OPTS += --enable-libopencv
263 FFMPEG_DEPENDENCIES += opencv
264 else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx)
265 FFMPEG_CONF_OPTS += --enable-libopencv
266 FFMPEG_DEPENDENCIES += opencv3
268 FFMPEG_CONF_OPTS += --disable-libopencv
271 ifeq ($(BR2_PACKAGE_OPUS),y)
272 FFMPEG_CONF_OPTS += --enable-libopus
273 FFMPEG_DEPENDENCIES += opus
275 FFMPEG_CONF_OPTS += --disable-libopus
278 ifeq ($(BR2_PACKAGE_LIBVPX),y)
279 FFMPEG_CONF_OPTS += --enable-libvpx
280 FFMPEG_DEPENDENCIES += libvpx
282 FFMPEG_CONF_OPTS += --disable-libvpx
285 ifeq ($(BR2_PACKAGE_LIBASS),y)
286 FFMPEG_CONF_OPTS += --enable-libass
287 FFMPEG_DEPENDENCIES += libass
289 FFMPEG_CONF_OPTS += --disable-libass
292 ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
293 FFMPEG_CONF_OPTS += --enable-libbluray
294 FFMPEG_DEPENDENCIES += libbluray
296 FFMPEG_CONF_OPTS += --disable-libbluray
299 ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
300 FFMPEG_CONF_OPTS += --enable-librtmp
301 FFMPEG_DEPENDENCIES += rtmpdump
303 FFMPEG_CONF_OPTS += --disable-librtmp
306 ifeq ($(BR2_PACKAGE_LAME),y)
307 FFMPEG_CONF_OPTS += --enable-libmp3lame
308 FFMPEG_DEPENDENCIES += lame
310 FFMPEG_CONF_OPTS += --disable-libmp3lame
313 ifeq ($(BR2_PACKAGE_LIBMODPLUG),y)
314 FFMPEG_CONF_OPTS += --enable-libmodplug
315 FFMPEG_DEPENDENCIES += libmodplug
317 FFMPEG_CONF_OPTS += --disable-libmodplug
320 ifeq ($(BR2_PACKAGE_SPEEX),y)
321 FFMPEG_CONF_OPTS += --enable-libspeex
322 FFMPEG_DEPENDENCIES += speex
324 FFMPEG_CONF_OPTS += --disable-libspeex
327 ifeq ($(BR2_PACKAGE_LIBTHEORA),y)
328 FFMPEG_CONF_OPTS += --enable-libtheora
329 FFMPEG_DEPENDENCIES += libtheora
331 FFMPEG_CONF_OPTS += --disable-libtheora
334 ifeq ($(BR2_PACKAGE_WAVPACK),y)
335 FFMPEG_CONF_OPTS += --enable-libwavpack
336 FFMPEG_DEPENDENCIES += wavpack
338 FFMPEG_CONF_OPTS += --disable-libwavpack
341 # ffmpeg freetype support require fenv.h which is only
342 # available/working on glibc.
343 # The microblaze variant doesn't provide the needed exceptions
344 ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_TOOLCHAIN_USES_GLIBC)x$(BR2_microblaze),yyx)
345 FFMPEG_CONF_OPTS += --enable-libfreetype
346 FFMPEG_DEPENDENCIES += freetype
348 FFMPEG_CONF_OPTS += --disable-libfreetype
351 ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
352 FFMPEG_CONF_OPTS += --enable-fontconfig
353 FFMPEG_DEPENDENCIES += fontconfig
355 FFMPEG_CONF_OPTS += --disable-fontconfig
358 ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
359 FFMPEG_CONF_OPTS += --enable-libx264
360 FFMPEG_DEPENDENCIES += x264
362 FFMPEG_CONF_OPTS += --disable-libx264
365 ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
366 FFMPEG_CONF_OPTS += --enable-libx265
367 FFMPEG_DEPENDENCIES += x265
369 FFMPEG_CONF_OPTS += --disable-libx265
372 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
373 FFMPEG_CONF_OPTS += --enable-yasm
374 FFMPEG_DEPENDENCIES += host-yasm
376 ifeq ($(BR2_x86_i586),y)
377 # Needed to work around a bug with gcc 5.x:
378 # error: 'asm' operand has impossible constraints
379 FFMPEG_CONF_OPTS += --disable-inline-asm
381 FFMPEG_CONF_OPTS += --disable-yasm
382 FFMPEG_CONF_OPTS += --disable-mmx
385 ifeq ($(BR2_X86_CPU_HAS_SSE),y)
386 FFMPEG_CONF_OPTS += --enable-sse
388 FFMPEG_CONF_OPTS += --disable-sse
391 ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
392 FFMPEG_CONF_OPTS += --enable-sse2
394 FFMPEG_CONF_OPTS += --disable-sse2
397 ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
398 FFMPEG_CONF_OPTS += --enable-sse3
400 FFMPEG_CONF_OPTS += --disable-sse3
403 ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
404 FFMPEG_CONF_OPTS += --enable-ssse3
406 FFMPEG_CONF_OPTS += --disable-ssse3
409 ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
410 FFMPEG_CONF_OPTS += --enable-sse4
412 FFMPEG_CONF_OPTS += --disable-sse4
415 ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
416 FFMPEG_CONF_OPTS += --enable-sse42
418 FFMPEG_CONF_OPTS += --disable-sse42
421 ifeq ($(BR2_X86_CPU_HAS_AVX),y)
422 FFMPEG_CONF_OPTS += --enable-avx
424 FFMPEG_CONF_OPTS += --disable-avx
427 ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
428 FFMPEG_CONF_OPTS += --enable-avx2
430 FFMPEG_CONF_OPTS += --disable-avx2
433 # Explicitly disable everything that doesn't match for ARM
434 # FFMPEG "autodetects" by compiling an extended instruction via AS
435 # This works on compilers that aren't built for generic by default
436 ifeq ($(BR2_ARM_CPU_ARMV4),y)
437 FFMPEG_CONF_OPTS += --disable-armv5te
439 ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
440 FFMPEG_CONF_OPTS += --enable-armv6
442 FFMPEG_CONF_OPTS += --disable-armv6 --disable-armv6t2
444 ifeq ($(BR2_ARM_CPU_HAS_VFPV2),y)
445 FFMPEG_CONF_OPTS += --enable-vfp
447 FFMPEG_CONF_OPTS += --disable-vfp
449 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
450 FFMPEG_CONF_OPTS += --enable-neon
452 FFMPEG_CONF_OPTS += --disable-neon
455 ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
456 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
457 FFMPEG_CONF_OPTS += --disable-mipsfpu
459 FFMPEG_CONF_OPTS += --enable-mipsfpu
463 ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
464 FFMPEG_CONF_OPTS += --enable-altivec
466 FFMPEG_CONF_OPTS += --disable-altivec
469 ifeq ($(BR2_STATIC_LIBS),)
470 FFMPEG_CONF_OPTS += --enable-pic
472 FFMPEG_CONF_OPTS += --disable-pic
475 # Default to --cpu=generic for MIPS architecture, in order to avoid a
476 # warning from ffmpeg's configure script.
477 ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
478 FFMPEG_CONF_OPTS += --cpu=generic
479 else ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
480 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU)
481 else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
482 FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH)
486 FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
488 # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
489 define FFMPEG_CONFIGURE_CMDS
490 (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
491 $(TARGET_CONFIGURE_OPTS) \
492 $(TARGET_CONFIGURE_ARGS) \
495 --enable-cross-compile \
496 --cross-prefix=$(TARGET_CROSS) \
497 --sysroot=$(STAGING_DIR) \
498 --host-cc="$(HOSTCC)" \
500 --target-os="linux" \
501 --disable-stripping \
502 --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
503 $(SHARED_STATIC_LIBS_OPTS) \
504 $(FFMPEG_CONF_OPTS) \
508 $(eval $(autotools-package))