Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [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 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 25 | SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ |
| 26 | file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \ |
| 27 | file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \ |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame^] | 28 | file://ffmpeg-fix-vulkan.patch \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 29 | " |
| 30 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 31 | SRC_URI[sha256sum] = "619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 32 | |
| 33 | # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 |
| 34 | ARM_INSTRUCTION_SET:armv4 = "arm" |
| 35 | ARM_INSTRUCTION_SET:armv5 = "arm" |
| 36 | ARM_INSTRUCTION_SET:armv6 = "arm" |
| 37 | |
| 38 | # Should be API compatible with libav (which was a fork of ffmpeg) |
| 39 | # libpostproc was previously packaged from a separate recipe |
| 40 | PROVIDES = "libav libpostproc" |
| 41 | |
| 42 | DEPENDS = "nasm-native" |
| 43 | |
| 44 | inherit autotools pkgconfig |
| 45 | |
| 46 | PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \ |
| 47 | alsa bzlib lzma pic pthreads shared theora zlib \ |
| 48 | ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ |
| 49 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" |
| 50 | |
| 51 | # libraries to build in addition to avutil |
| 52 | PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" |
| 53 | PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" |
| 54 | PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" |
| 55 | PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" |
| 56 | PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" |
| 57 | PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" |
| 58 | PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" |
| 59 | |
| 60 | # features to support |
| 61 | PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
| 62 | PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
| 63 | PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" |
| 64 | PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" |
| 65 | PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" |
| 66 | PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" |
| 67 | PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" |
| 68 | PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" |
| 69 | PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" |
| 70 | PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" |
| 71 | PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" |
| 72 | PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" |
| 73 | PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" |
| 74 | PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" |
| 75 | PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" |
| 76 | PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" |
| 77 | PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 78 | PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 79 | PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 80 | PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 81 | PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 82 | PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" |
| 83 | PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 84 | PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 85 | PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 86 | |
| 87 | # other configuration options |
| 88 | PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" |
| 89 | PACKAGECONFIG[pic] = "--enable-pic" |
| 90 | PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" |
| 91 | PACKAGECONFIG[shared] = "--enable-shared" |
| 92 | PACKAGECONFIG[strip] = ",--disable-stripping" |
| 93 | |
| 94 | # Check codecs that require --enable-nonfree |
| 95 | USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 96 | |
| 97 | def cpu(d): |
| 98 | for arg in (d.getVar('TUNE_CCARGS') or '').split(): |
| 99 | if arg.startswith('-mcpu='): |
| 100 | return arg[6:] |
| 101 | return 'generic' |
| 102 | |
| 103 | EXTRA_OECONF = " \ |
| 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 | --cpu=${@cpu(d)} \ |
| 122 | --pkg-config=pkg-config \ |
| 123 | " |
| 124 | |
| 125 | EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" |
| 126 | |
| 127 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 128 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 129 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" |
| 130 | EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" |
| 131 | EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ |
| 132 | --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa" |
| 133 | EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic" |
| 134 | EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" |
| 135 | EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" |
| 136 | |
| 137 | # gold crashes on x86, another solution is to --disable-asm but thats more hacky |
| 138 | # ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 |
| 139 | |
| 140 | LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" |
| 141 | |
| 142 | EXTRA_OEMAKE = "V=1" |
| 143 | |
| 144 | do_configure() { |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 145 | export TMPDIR="${B}/tmp" |
| 146 | mkdir -p ${B}/tmp |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 147 | ${S}/configure ${EXTRA_OECONF} |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 148 | sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} --debug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR},g" ${B}/ffbuild/config.mak |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | # patch out build host paths for reproducibility |
| 152 | do_compile:prepend:class-target() { |
| 153 | sed -i -e "s,${WORKDIR},,g" ${B}/config.h |
| 154 | } |
| 155 | |
| 156 | PACKAGES =+ "libavcodec \ |
| 157 | libavdevice \ |
| 158 | libavfilter \ |
| 159 | libavformat \ |
| 160 | libavutil \ |
| 161 | libpostproc \ |
| 162 | libswresample \ |
| 163 | libswscale" |
| 164 | |
| 165 | FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" |
| 166 | FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" |
| 167 | FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" |
| 168 | FILES:libavformat = "${libdir}/libavformat${SOLIBS}" |
| 169 | FILES:libavutil = "${libdir}/libavutil${SOLIBS}" |
| 170 | FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" |
| 171 | FILES:libswresample = "${libdir}/libswresample${SOLIBS}" |
| 172 | FILES:libswscale = "${libdir}/libswscale${SOLIBS}" |
| 173 | |
| 174 | # ffmpeg disables PIC on some platforms (e.g. x86-32) |
| 175 | INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" |
| 176 | INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" |
| 177 | INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" |
| 178 | INSANE_SKIP:${MLPREFIX}libavformat = "textrel" |
| 179 | INSANE_SKIP:${MLPREFIX}libavutil = "textrel" |
| 180 | INSANE_SKIP:${MLPREFIX}libswscale = "textrel" |
| 181 | INSANE_SKIP:${MLPREFIX}libswresample = "textrel" |
| 182 | INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" |