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 25# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 26ARM_INSTRUCTION_SET:armv4 = "arm" 27ARM_INSTRUCTION_SET:armv5 = "arm" 28ARM_INSTRUCTION_SET:armv6 = "arm" 29# Should be API compatible with libav (which was a fork of ffmpeg) 30# libpostproc was previously packaged from a separate recipe 31PROVIDES = "ffmpeg libav libpostproc" 32RPROVIDES:${PN} = "${PROVIDES}" 33DEPENDS = "nasm-native" 34 35inherit autotools pkgconfig 36PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample ffplay \ 37 v4l2 drm udev alsa bzlib lzma pic pthreads shared theora zlib libvorbis x264 gpl \ 38 ${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'mmal rpi sand vout-drm', d)} \ 39 ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ 40 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl', '', d)} \ 41 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb vout-egl epoxy', '', d)}" 42 43SRC_URI = "\ 44 git://git@github.com/RPi-Distro/ffmpeg;protocol=https;branch=pios/bullseye \ 45 file://0001-avcodec-arm-sbcenc-avoid-callee-preserved-vfp-regist.patch \ 46 file://0002-Fix-build-on-powerpc-and-ppc64.patch \ 47 file://0003-avcodec-pngenc-remove-monowhite-from-apng-formats.patch \ 48 file://0004-ffmpeg-4.3.4-rpi_14.patch \ 49 file://0005-fix-flags.diff \ 50 file://2001-configure-setup-for-OE-core-usage.patch \ 51 file://2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch \ 52 file://2003-libavcodec-fix-v4l2_req_devscan.patch \ 53 file://2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch \ 54 " 55 56SRCREV = "246e1a55a0eca931537d8706acd8b133c07beb05" 57 58S = "${WORKDIR}/git" 59 60# libraries to build in addition to avutil 61PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" 62PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" 63PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" 64PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" 65PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" 66PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" 67PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" 68PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" 69 70# features to support 71PACKAGECONFIG[ffplay] = "--enable-ffplay,--disable-ffplay" 72PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" 73PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," 74PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" 75PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" 76PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" 77PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,virtual/libgles2" 78PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" 79PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" 80PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" 81PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" 82PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" 83PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" 84PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" 85PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" 86PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" 87PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" 88PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" 89PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" 90PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" 91PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" 92PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" 93PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" 94PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" 95PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" 96PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" 97PACKAGECONFIG[snappy] = "--enable-libsnappy,--disable-libsnappy,snappy" 98PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" 99PACKAGECONFIG[drm] = "--enable-libdrm,--disable-libdrm,libdrm" 100PACKAGECONFIG[epoxy] = "--enable-epoxy,--disable-epoxy,libepoxy" 101PACKAGECONFIG[v4l2] = "--enable-libv4l2 --enable-v4l2-m2m,,v4l-utils" 102PACKAGECONFIG[mmal] = "--enable-omx --enable-omx-rpi --enable-mmal,,userland" 103PACKAGECONFIG[sand] = "--enable-sand,," 104PACKAGECONFIG[rpi] = "--enable-rpi,," 105PACKAGECONFIG[vout-drm] = "--enable-vout-drm,,libdrm" 106PACKAGECONFIG[vout-egl] = "--enable-vout-egl,,virtual/egl" 107 108# other configuration options 109PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" 110PACKAGECONFIG[pic] = "--enable-pic" 111PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" 112PACKAGECONFIG[shared] = "--enable-shared" 113PACKAGECONFIG[strip] = ",--disable-stripping" 114 115# Check codecs that require --enable-nonfree 116USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" 117 118def cpu(d): 119 for arg in (d.getVar('TUNE_CCARGS') or '').split(): 120 if arg.startswith('-mcpu='): 121 return arg[6:] 122 return 'generic' 123 124EXTRA_OECONF = " \ 125 ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ 126 \ 127 --cross-prefix=${TARGET_PREFIX} \ 128 \ 129 --ld="${CCLD}" \ 130 --cc="${CC}" \ 131 --cxx="${CXX}" \ 132 --arch=${TARGET_ARCH} \ 133 --target-os="linux" \ 134 --enable-cross-compile \ 135 --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ 136 --extra-ldflags="${LDFLAGS}" \ 137 --sysroot="${STAGING_DIR_TARGET}" \ 138 ${EXTRA_FFCONF} \ 139 --libdir=${libdir} \ 140 --shlibdir=${libdir} \ 141 --datadir=${datadir}/ffmpeg \ 142 --cpu=${@cpu(d)} \ 143 --pkg-config=pkg-config \ 144" 145EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" 146 147# Some patches introduce assembly files which needs preprocessing with 148# gcc e.g. src/libavutil/aarch64/rpi_sand_neon.S 149TOOLCHAIN = "gcc" 150# gold crashes on x86, another solution is to --disable-asm but thats more hacky 151# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 152LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" 153EXTRA_OEMAKE = "V=1" 154 155do_configure() { 156 ${S}/configure ${EXTRA_OECONF} 157} 158 159# patch out build host paths for reproducibility 160do_compile:prepend:class-target() { 161 sed -i -e "s,${WORKDIR},,g" ${B}/config.h 162} 163 164PACKAGES =+ "libavcodec \ 165 libavdevice \ 166 libavfilter \ 167 libavformat \ 168 libavresample \ 169 libavutil \ 170 libpostproc \ 171 libswresample \ 172 libswscale" 173 174FILES:${PN}:append = " /usr/share/ffmpeg" 175FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" 176FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" 177FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" 178FILES:libavformat = "${libdir}/libavformat${SOLIBS}" 179FILES:libavresample = "${libdir}/libavresample${SOLIBS}" 180FILES:libavutil = "${libdir}/libavutil${SOLIBS}" 181FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" 182FILES:libswresample = "${libdir}/libswresample${SOLIBS}" 183FILES:libswscale = "${libdir}/libswscale${SOLIBS}" 184# ffmpeg disables PIC on some platforms (e.g. x86-32) 185INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" 186INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" 187INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" 188INSANE_SKIP:${MLPREFIX}libavformat = "textrel" 189INSANE_SKIP:${MLPREFIX}libavutil = "textrel" 190INSANE_SKIP:${MLPREFIX}libavresample = "textrel" 191INSANE_SKIP:${MLPREFIX}libswscale = "textrel" 192INSANE_SKIP:${MLPREFIX}libswresample = "textrel" 193INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" 194 195# Only enable it for rpi class of machines 196COMPATIBLE_HOST = "null" 197COMPATIBLE_HOST:rpi = "(.*)" 198 199