Andrew Geissler | 517393d | 2023-01-13 08:55:19 -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 | # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 |
| 26 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 27 | ARM_INSTRUCTION_SET_armv5 = "arm" |
| 28 | ARM_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 |
| 31 | PROVIDES = "ffmpeg libav libpostproc" |
| 32 | RPROVIDES:${PN} = "${PROVIDES}" |
| 33 | DEPENDS = "nasm-native" |
| 34 | |
| 35 | inherit autotools pkgconfig |
| 36 | PACKAGECONFIG ??= "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 | |
| 43 | SRC_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 | |
| 56 | SRCREV = "246e1a55a0eca931537d8706acd8b133c07beb05" |
| 57 | |
| 58 | S = "${WORKDIR}/git" |
| 59 | |
| 60 | # libraries to build in addition to avutil |
| 61 | PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" |
| 62 | PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" |
| 63 | PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" |
| 64 | PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" |
| 65 | PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" |
| 66 | PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" |
| 67 | PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" |
| 68 | PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" |
| 69 | |
| 70 | # features to support |
| 71 | PACKAGECONFIG[ffplay] = "--enable-ffplay,--disable-ffplay" |
| 72 | PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
| 73 | PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
| 74 | PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" |
| 75 | PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" |
| 76 | PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" |
| 77 | PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,virtual/libgles2" |
| 78 | PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" |
| 79 | PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" |
| 80 | PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" |
| 81 | PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" |
| 82 | PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" |
| 83 | PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" |
| 84 | PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" |
| 85 | PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" |
| 86 | PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" |
| 87 | PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" |
| 88 | PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" |
| 89 | PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 90 | PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 91 | PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 92 | PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 93 | PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 94 | PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 95 | PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 96 | PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 97 | PACKAGECONFIG[snappy] = "--enable-libsnappy,--disable-libsnappy,snappy" |
| 98 | PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" |
| 99 | PACKAGECONFIG[drm] = "--enable-libdrm,--disable-libdrm,libdrm" |
| 100 | PACKAGECONFIG[epoxy] = "--enable-epoxy,--disable-epoxy,libepoxy" |
| 101 | PACKAGECONFIG[v4l2] = "--enable-libv4l2 --enable-v4l2-m2m,,v4l-utils" |
| 102 | PACKAGECONFIG[mmal] = "--enable-omx --enable-omx-rpi --enable-mmal,,userland" |
| 103 | PACKAGECONFIG[sand] = "--enable-sand,," |
| 104 | PACKAGECONFIG[rpi] = "--enable-rpi,," |
| 105 | PACKAGECONFIG[vout-drm] = "--enable-vout-drm,,libdrm" |
| 106 | PACKAGECONFIG[vout-egl] = "--enable-vout-egl,,virtual/egl" |
| 107 | |
| 108 | # other configuration options |
| 109 | PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" |
| 110 | PACKAGECONFIG[pic] = "--enable-pic" |
| 111 | PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" |
| 112 | PACKAGECONFIG[shared] = "--enable-shared" |
| 113 | PACKAGECONFIG[strip] = ",--disable-stripping" |
| 114 | |
| 115 | # Check codecs that require --enable-nonfree |
| 116 | USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 117 | |
| 118 | def 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 | |
| 124 | EXTRA_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 | " |
| 145 | EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" |
| 146 | |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 147 | # Some patches introduce assembly files which needs preprocessing with |
| 148 | # gcc e.g. src/libavutil/aarch64/rpi_sand_neon.S |
| 149 | TOOLCHAIN = "gcc" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 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 |
| 152 | LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" |
| 153 | EXTRA_OEMAKE = "V=1" |
| 154 | |
| 155 | do_configure() { |
| 156 | ${S}/configure ${EXTRA_OECONF} |
| 157 | } |
| 158 | |
| 159 | # patch out build host paths for reproducibility |
| 160 | do_compile:prepend:class-target() { |
| 161 | sed -i -e "s,${WORKDIR},,g" ${B}/config.h |
| 162 | } |
| 163 | |
| 164 | PACKAGES =+ "libavcodec \ |
| 165 | libavdevice \ |
| 166 | libavfilter \ |
| 167 | libavformat \ |
| 168 | libavresample \ |
| 169 | libavutil \ |
| 170 | libpostproc \ |
| 171 | libswresample \ |
| 172 | libswscale" |
| 173 | |
| 174 | FILES:${PN}:append = " /usr/share/ffmpeg" |
| 175 | FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" |
| 176 | FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" |
| 177 | FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" |
| 178 | FILES:libavformat = "${libdir}/libavformat${SOLIBS}" |
| 179 | FILES:libavresample = "${libdir}/libavresample${SOLIBS}" |
| 180 | FILES:libavutil = "${libdir}/libavutil${SOLIBS}" |
| 181 | FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" |
| 182 | FILES:libswresample = "${libdir}/libswresample${SOLIBS}" |
| 183 | FILES:libswscale = "${libdir}/libswscale${SOLIBS}" |
| 184 | # ffmpeg disables PIC on some platforms (e.g. x86-32) |
| 185 | INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" |
| 186 | INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" |
| 187 | INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" |
| 188 | INSANE_SKIP:${MLPREFIX}libavformat = "textrel" |
| 189 | INSANE_SKIP:${MLPREFIX}libavutil = "textrel" |
| 190 | INSANE_SKIP:${MLPREFIX}libavresample = "textrel" |
| 191 | INSANE_SKIP:${MLPREFIX}libswscale = "textrel" |
| 192 | INSANE_SKIP:${MLPREFIX}libswresample = "textrel" |
| 193 | INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" |
| 194 | |
| 195 | # Only enable it for rpi class of machines |
| 196 | COMPATIBLE_HOST = "null" |
| 197 | COMPATIBLE_HOST:rpi = "(.*)" |
| 198 | |