|
| 1 | +SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." |
| 2 | +DESCRIPTION = "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." |
| 5 | +HOMEPAGE = "https://www.ffmpeg.org/" |
| 6 | +SECTION = "libs" |
| 7 | + |
| 8 | +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" |
| 9 | +LICENSE:${PN} = "GPL-2.0-or-later" |
| 10 | +LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 11 | +LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 12 | +LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 13 | +LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 14 | +LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 15 | +LICENSE:libpostproc = "GPL-2.0-or-later" |
| 16 | +LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 17 | +LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" |
| 18 | +LICENSE_FLAGS = "commercial" |
| 19 | + |
| 20 | +LIC_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 | +SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz" |
| 26 | + |
| 27 | +SRC_URI[sha256sum] = "733984395e0dbbe5c046abda2dc49a5544e7e0e1e2366bba849222ae9e3a03b1" |
| 28 | + |
| 29 | +# https://nvd.nist.gov/vuln/detail/CVE-2023-39018 |
| 30 | +# https://github.com/bramp/ffmpeg-cli-wrapper/issues/291 |
| 31 | +# https://security-tracker.debian.org/tracker/CVE-2023-39018 |
| 32 | +# https://bugzilla.suse.com/show_bug.cgi?id=CVE-2023-39018 |
| 33 | +CVE_STATUS[CVE-2023-39018] = "cpe-incorrect: This issue belongs to ffmpeg-cli-wrapper \ |
| 34 | +(Java wrapper around the FFmpeg CLI) and not ffmepg itself." |
| 35 | + |
| 36 | +# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 |
| 37 | +ARM_INSTRUCTION_SET:armv4 = "arm" |
| 38 | +ARM_INSTRUCTION_SET:armv5 = "arm" |
| 39 | +ARM_INSTRUCTION_SET:armv6 = "arm" |
| 40 | + |
| 41 | +# Should be API compatible with libav (which was a fork of ffmpeg) |
| 42 | +# libpostproc was previously packaged from a separate recipe |
| 43 | +PROVIDES = "libav libpostproc" |
| 44 | + |
| 45 | +DEPENDS:append:x86 = " nasm-native" |
| 46 | +DEPENDS:append:x86-64 = " nasm-native" |
| 47 | + |
| 48 | +inherit autotools pkgconfig |
| 49 | + |
| 50 | +PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \ |
| 51 | + alsa bzlib lzma theora zlib \ |
| 52 | + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" |
| 53 | + |
| 54 | +# libraries to build in addition to avutil |
| 55 | +PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" |
| 56 | +PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" |
| 57 | +PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" |
| 58 | +PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" |
| 59 | +PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" |
| 60 | +PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" |
| 61 | +PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" |
| 62 | + |
| 63 | +# features to support |
| 64 | +PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
| 65 | +PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
| 66 | +PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" |
| 67 | +PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" |
| 68 | +PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" |
| 69 | +PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" |
| 70 | +PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" |
| 71 | +PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" |
| 72 | +PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" |
| 73 | +PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" |
| 74 | +PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" |
| 75 | +PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" |
| 76 | +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" |
| 77 | +PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" |
| 78 | +PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" |
| 79 | +PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" |
| 80 | +PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 81 | +PACKAGECONFIG[v4l2] = "--enable-libv4l2,--disable-libv4l2,v4l-utils" |
| 82 | +PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 83 | +PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 84 | +PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 85 | +PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 86 | +PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" |
| 87 | +PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 88 | +PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 89 | +PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 90 | + |
| 91 | +# Check codecs that require --enable-nonfree |
| 92 | +USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 93 | + |
| 94 | +def cpu(d): |
| 95 | + for arg in (d.getVar('TUNE_CCARGS') or '').split(): |
| 96 | + if arg.startswith('-mcpu='): |
| 97 | + return arg[6:] |
| 98 | + return 'generic' |
| 99 | + |
| 100 | +EXTRA_OECONF = " \ |
| 101 | + --disable-stripping \ |
| 102 | + --enable-pic \ |
| 103 | + --enable-shared \ |
| 104 | + --enable-pthreads \ |
| 105 | + ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ |
| 106 | + \ |
| 107 | + --cross-prefix=${TARGET_PREFIX} \ |
| 108 | + \ |
| 109 | + --ld='${CCLD}' \ |
| 110 | + --cc='${CC}' \ |
| 111 | + --cxx='${CXX}' \ |
| 112 | + --arch=${TARGET_ARCH} \ |
| 113 | + --target-os='linux' \ |
| 114 | + --enable-cross-compile \ |
| 115 | + --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \ |
| 116 | + --extra-ldflags='${LDFLAGS}' \ |
| 117 | + --sysroot='${STAGING_DIR_TARGET}' \ |
| 118 | + ${EXTRA_FFCONF} \ |
| 119 | + --libdir=${libdir} \ |
| 120 | + --shlibdir=${libdir} \ |
| 121 | + --datadir=${datadir}/ffmpeg \ |
| 122 | + ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \ |
| 123 | + --cpu=${@cpu(d)} \ |
| 124 | + --pkg-config=pkg-config \ |
| 125 | +" |
| 126 | + |
| 127 | +EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" |
| 128 | +# --enable-pic is used and x86 assembly is not PIC on x86 |
| 129 | +EXTRA_OECONF:append:x86 = " --disable-asm" |
| 130 | + |
| 131 | +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 132 | +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 133 | +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 134 | +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 135 | +EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ |
| 136 | + --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa" |
| 137 | +EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic --disable-rvv --disable-asm" |
| 138 | +EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" |
| 139 | +EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" |
| 140 | +EXTRA_OECONF:append:armv7a = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}" |
| 141 | +EXTRA_OECONF:append:armv7ve = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}" |
| 142 | + |
| 143 | +LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd ', '', d)}" |
| 144 | + |
| 145 | +EXTRA_OEMAKE = "V=1" |
| 146 | + |
| 147 | +do_configure() { |
| 148 | + export TMPDIR="${B}/tmp" |
| 149 | + mkdir -p ${B}/tmp |
| 150 | + ${S}/configure ${EXTRA_OECONF} |
| 151 | + sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=${TARGET_DBGSRC_DIR} --debug-prefix-map=${B}=${TARGET_DBGSRC_DIR},g" ${B}/ffbuild/config.mak |
| 152 | +} |
| 153 | + |
| 154 | +# patch out build host paths for reproducibility |
| 155 | +do_compile:prepend:class-target() { |
| 156 | + sed -i -e "s,${WORKDIR},,g" ${B}/config.h |
| 157 | +} |
| 158 | + |
| 159 | +PACKAGES =+ "libavcodec \ |
| 160 | + libavdevice \ |
| 161 | + libavfilter \ |
| 162 | + libavformat \ |
| 163 | + libavutil \ |
| 164 | + libpostproc \ |
| 165 | + libswresample \ |
| 166 | + libswscale \ |
| 167 | + ${PN}-examples" |
| 168 | + |
| 169 | +FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" |
| 170 | +FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" |
| 171 | +FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" |
| 172 | +FILES:libavformat = "${libdir}/libavformat${SOLIBS}" |
| 173 | +FILES:libavutil = "${libdir}/libavutil${SOLIBS}" |
| 174 | +FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" |
| 175 | +FILES:libswresample = "${libdir}/libswresample${SOLIBS}" |
| 176 | +FILES:libswscale = "${libdir}/libswscale${SOLIBS}" |
| 177 | +FILES:${PN}-examples = "${datadir}/${BPN}/examples" |
| 178 | + |
| 179 | +CVE_PRODUCT = "ffmpeg libswresample libavcodec" |
0 commit comments