Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame^] | 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] = "488c76e57dd9b3bee901f71d5c95eaf1db4a5a31fe46a28654e837144207c270" |
| 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 = "nasm-native" |
| 46 | |
| 47 | inherit autotools pkgconfig |
| 48 | |
| 49 | PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \ |
| 50 | alsa bzlib lzma theora zlib \ |
| 51 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" |
| 52 | |
| 53 | # libraries to build in addition to avutil |
| 54 | PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" |
| 55 | PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" |
| 56 | PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" |
| 57 | PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" |
| 58 | PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" |
| 59 | PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" |
| 60 | PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" |
| 61 | |
| 62 | # features to support |
| 63 | PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
| 64 | PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
| 65 | PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" |
| 66 | PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" |
| 67 | PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" |
| 68 | PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" |
| 69 | PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" |
| 70 | PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" |
| 71 | PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" |
| 72 | PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" |
| 73 | PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" |
| 74 | PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" |
| 75 | PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" |
| 76 | PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" |
| 77 | PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" |
| 78 | PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" |
| 79 | PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 80 | PACKAGECONFIG[v4l2] = "--enable-libv4l2,--disable-libv4l2,v4l-utils" |
| 81 | PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 82 | PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 83 | PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 84 | PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 85 | PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" |
| 86 | PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 87 | PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 88 | PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 89 | |
| 90 | # Check codecs that require --enable-nonfree |
| 91 | USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 92 | |
| 93 | def cpu(d): |
| 94 | for arg in (d.getVar('TUNE_CCARGS') or '').split(): |
| 95 | if arg.startswith('-mcpu='): |
| 96 | return arg[6:] |
| 97 | return 'generic' |
| 98 | |
| 99 | EXTRA_OECONF = " \ |
| 100 | --disable-stripping \ |
| 101 | --enable-pic \ |
| 102 | --enable-shared \ |
| 103 | --enable-pthreads \ |
| 104 | ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ |
| 105 | \ |
| 106 | --cross-prefix=${TARGET_PREFIX} \ |
| 107 | \ |
| 108 | --ld='${CCLD}' \ |
| 109 | --cc='${CC}' \ |
| 110 | --cxx='${CXX}' \ |
| 111 | --arch=${TARGET_ARCH} \ |
| 112 | --target-os='linux' \ |
| 113 | --enable-cross-compile \ |
| 114 | --extra-cflags='${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \ |
| 115 | --extra-ldflags='${LDFLAGS}' \ |
| 116 | --sysroot='${STAGING_DIR_TARGET}' \ |
| 117 | ${EXTRA_FFCONF} \ |
| 118 | --libdir=${libdir} \ |
| 119 | --shlibdir=${libdir} \ |
| 120 | --datadir=${datadir}/ffmpeg \ |
| 121 | ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \ |
| 122 | --cpu=${@cpu(d)} \ |
| 123 | --pkg-config=pkg-config \ |
| 124 | " |
| 125 | |
| 126 | EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" |
| 127 | |
| 128 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 129 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 130 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 131 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 132 | EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ |
| 133 | --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa" |
| 134 | EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic --disable-rvv --disable-asm" |
| 135 | EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" |
| 136 | EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" |
| 137 | EXTRA_OECONF:append:armv7a = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}" |
| 138 | EXTRA_OECONF:append:armv7ve = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}" |
| 139 | |
| 140 | # gold crashes on x86, another solution is to --disable-asm but thats more hacky |
| 141 | # ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 |
| 142 | |
| 143 | LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" |
| 144 | LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd ', '', d)}" |
| 145 | |
| 146 | EXTRA_OEMAKE = "V=1" |
| 147 | |
| 148 | do_configure() { |
| 149 | export TMPDIR="${B}/tmp" |
| 150 | mkdir -p ${B}/tmp |
| 151 | ${S}/configure ${EXTRA_OECONF} |
| 152 | sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=${TARGET_DBGSRC_DIR} --debug-prefix-map=${B}=${TARGET_DBGSRC_DIR},g" ${B}/ffbuild/config.mak |
| 153 | } |
| 154 | |
| 155 | # patch out build host paths for reproducibility |
| 156 | do_compile:prepend:class-target() { |
| 157 | sed -i -e "s,${WORKDIR},,g" ${B}/config.h |
| 158 | } |
| 159 | |
| 160 | PACKAGES =+ "libavcodec \ |
| 161 | libavdevice \ |
| 162 | libavfilter \ |
| 163 | libavformat \ |
| 164 | libavutil \ |
| 165 | libpostproc \ |
| 166 | libswresample \ |
| 167 | libswscale" |
| 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 | |
| 178 | # ffmpeg disables PIC on some platforms (e.g. x86-32) |
| 179 | INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" |
| 180 | INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" |
| 181 | INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" |
| 182 | INSANE_SKIP:${MLPREFIX}libavformat = "textrel" |
| 183 | INSANE_SKIP:${MLPREFIX}libavutil = "textrel" |
| 184 | INSANE_SKIP:${MLPREFIX}libswscale = "textrel" |
| 185 | INSANE_SKIP:${MLPREFIX}libswresample = "textrel" |
| 186 | INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" |