1SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." 2DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \ 3 mux, demux, stream, filter and play pretty much anything that humans and machines \ 4 have created. It supports the most obscure ancient formats up to the cutting edge." 5HOMEPAGE = "https://www.ffmpeg.org/" 6SECTION = "libs" 7 8LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" 9LICENSE:${PN} = "GPL-2.0-or-later" 10LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 11LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 12LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 13LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 14LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 15LICENSE:libpostproc = "GPL-2.0-or-later" 16LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 17LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" 18LICENSE_FLAGS = "commercial" 19 20LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 21 file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ 22 file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ 23 file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" 24 25SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ 26 file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ 27 file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \ 28 file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \ 29 file://0001-avcodec-vp3-Add-missing-check-for-av_malloc.patch \ 30 file://0001-avformat-nutdec-Add-check-for-avformat_new_stream.patch \ 31 " 32 33SRC_URI[sha256sum] = "ef2efae259ce80a240de48ec85ecb062cecca26e4352ffb3fda562c21a93007b" 34 35# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 36ARM_INSTRUCTION_SET:armv4 = "arm" 37ARM_INSTRUCTION_SET:armv5 = "arm" 38ARM_INSTRUCTION_SET:armv6 = "arm" 39 40# Should be API compatible with libav (which was a fork of ffmpeg) 41# libpostproc was previously packaged from a separate recipe 42PROVIDES = "libav libpostproc" 43 44DEPENDS = "nasm-native" 45 46inherit autotools pkgconfig 47 48PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \ 49 alsa bzlib lzma pic pthreads shared theora zlib \ 50 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ 51 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" 52 53# libraries to build in addition to avutil 54PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" 55PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" 56PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" 57PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" 58PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" 59PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" 60PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" 61 62# features to support 63PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" 64PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," 65PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" 66PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" 67PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" 68PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" 69PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" 70PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" 71PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" 72PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" 73PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" 74PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" 75PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" 76PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" 77PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" 78PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" 79PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" 80PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" 81PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" 82PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" 83PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" 84PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" 85PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" 86PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" 87PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" 88 89# other configuration options 90PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" 91PACKAGECONFIG[pic] = "--enable-pic" 92PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" 93PACKAGECONFIG[shared] = "--enable-shared" 94PACKAGECONFIG[strip] = ",--disable-stripping" 95 96# Check codecs that require --enable-nonfree 97USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" 98 99def cpu(d): 100 for arg in (d.getVar('TUNE_CCARGS') or '').split(): 101 if arg.startswith('-mcpu='): 102 return arg[6:] 103 return 'generic' 104 105EXTRA_OECONF = " \ 106 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ 107 \ 108 --cross-prefix=${TARGET_PREFIX} \ 109 \ 110 --ld='${CCLD}' \ 111 --cc='${CC}' \ 112 --cxx='${CXX}' \ 113 --arch=${TARGET_ARCH} \ 114 --target-os='linux' \ 115 --enable-cross-compile \ 116 --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \ 117 --extra-ldflags='${LDFLAGS}' \ 118 --sysroot='${STAGING_DIR_TARGET}' \ 119 ${EXTRA_FFCONF} \ 120 --libdir=${libdir} \ 121 --shlibdir=${libdir} \ 122 --datadir=${datadir}/ffmpeg \ 123 --cpu=${@cpu(d)} \ 124 --pkg-config=pkg-config \ 125" 126 127EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" 128 129EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" 130EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" 131EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" 132EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" 133EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ 134 --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa" 135EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic" 136EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" 137EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" 138 139# gold crashes on x86, another solution is to --disable-asm but thats more hacky 140# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 141 142LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" 143 144EXTRA_OEMAKE = "V=1" 145 146do_configure() { 147 ${S}/configure ${EXTRA_OECONF} 148} 149 150# patch out build host paths for reproducibility 151do_compile:prepend:class-target() { 152 sed -i -e "s,${WORKDIR},,g" ${B}/config.h 153} 154 155PACKAGES =+ "libavcodec \ 156 libavdevice \ 157 libavfilter \ 158 libavformat \ 159 libavutil \ 160 libpostproc \ 161 libswresample \ 162 libswscale" 163 164FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" 165FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" 166FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" 167FILES:libavformat = "${libdir}/libavformat${SOLIBS}" 168FILES:libavutil = "${libdir}/libavutil${SOLIBS}" 169FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" 170FILES:libswresample = "${libdir}/libswresample${SOLIBS}" 171FILES:libswscale = "${libdir}/libswscale${SOLIBS}" 172 173# ffmpeg disables PIC on some platforms (e.g. x86-32) 174INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" 175INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" 176INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" 177INSANE_SKIP:${MLPREFIX}libavformat = "textrel" 178INSANE_SKIP:${MLPREFIX}libavutil = "textrel" 179INSANE_SKIP:${MLPREFIX}libswscale = "textrel" 180INSANE_SKIP:${MLPREFIX}libswresample = "textrel" 181INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" 182