Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -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 = "BSD & GPLv2+ & LGPLv2.1+ & MIT" |
| 9 | LICENSE_${PN} = "GPLv2+" |
| 10 | LICENSE_libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 11 | LICENSE_libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 12 | LICENSE_libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 13 | LICENSE_libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 14 | LICENSE_libavresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 15 | LICENSE_libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 16 | LICENSE_libpostproc = "GPLv2+" |
| 17 | LICENSE_libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 18 | LICENSE_libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" |
| 19 | LICENSE_FLAGS = "commercial" |
| 20 | |
| 21 | LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 22 | file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ |
| 23 | file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ |
| 24 | file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" |
| 25 | |
| 26 | SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ |
| 27 | file://mips64_cpu_detection.patch \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 28 | file://0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch \ |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 29 | file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 30 | file://CVE-2020-35964.patch \ |
| 31 | file://CVE-2020-35965.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 32 | " |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 33 | SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 34 | |
| 35 | # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 |
| 36 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 37 | ARM_INSTRUCTION_SET_armv5 = "arm" |
| 38 | ARM_INSTRUCTION_SET_armv6 = "arm" |
| 39 | |
| 40 | # Should be API compatible with libav (which was a fork of ffmpeg) |
| 41 | # libpostproc was previously packaged from a separate recipe |
| 42 | PROVIDES = "libav libpostproc" |
| 43 | |
| 44 | DEPENDS = "nasm-native" |
| 45 | |
| 46 | inherit autotools pkgconfig |
| 47 | |
| 48 | PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \ |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 49 | alsa bzlib gpl lzma pic pthreads shared theora x264 zlib \ |
| 50 | ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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 | PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" |
| 62 | |
| 63 | # features to support |
| 64 | PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 65 | PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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[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" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 78 | PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 79 | PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 80 | PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 81 | PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 82 | PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 83 | PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 84 | PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" |
| 85 | PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 86 | PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 87 | PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 88 | |
Andrew Geissler | 9b4d8b0 | 2021-02-19 12:26:16 -0600 | [diff] [blame] | 89 | # other configuration options |
| 90 | PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" |
| 91 | PACKAGECONFIG[pic] = "--enable-pic" |
| 92 | PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" |
| 93 | PACKAGECONFIG[shared] = "--enable-shared" |
| 94 | PACKAGECONFIG[strip] = ",--disable-stripping" |
| 95 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 96 | # Check codecs that require --enable-nonfree |
| 97 | USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 98 | |
| 99 | def cpu(d): |
| 100 | for arg in (d.getVar('TUNE_CCARGS') or '').split(): |
| 101 | if arg.startswith('-mcpu='): |
| 102 | return arg[6:] |
| 103 | return 'generic' |
| 104 | |
| 105 | EXTRA_OECONF = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 106 | ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ |
| 107 | \ |
| 108 | --cross-prefix=${TARGET_PREFIX} \ |
| 109 | \ |
| 110 | --ld="${CCLD}" \ |
| 111 | --cc="${CC}" \ |
| 112 | --cxx="${CXX}" \ |
| 113 | --arch=${TARGET_ARCH} \ |
| 114 | --target-os="linux" \ |
| 115 | --enable-cross-compile \ |
| 116 | --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ |
| 117 | --extra-ldflags="${LDFLAGS}" \ |
| 118 | --sysroot="${STAGING_DIR_TARGET}" \ |
| 119 | ${EXTRA_FFCONF} \ |
| 120 | --libdir=${libdir} \ |
| 121 | --shlibdir=${libdir} \ |
| 122 | --datadir=${datadir}/ffmpeg \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 123 | --cpu=${@cpu(d)} \ |
| 124 | --pkg-config=pkg-config \ |
| 125 | " |
| 126 | |
| 127 | EXTRA_OECONF_append_linux-gnux32 = " --disable-asm" |
| 128 | # gold crashes on x86, another solution is to --disable-asm but thats more hacky |
| 129 | # ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 |
| 130 | |
| 131 | LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" |
| 132 | |
| 133 | EXTRA_OEMAKE = "V=1" |
| 134 | |
| 135 | do_configure() { |
| 136 | ${S}/configure ${EXTRA_OECONF} |
| 137 | } |
| 138 | |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 139 | # patch out build host paths for reproducibility |
| 140 | do_compile_prepend_class-target() { |
| 141 | sed -i -e "s,${WORKDIR},,g" ${B}/config.h |
| 142 | } |
| 143 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 144 | PACKAGES =+ "libavcodec \ |
| 145 | libavdevice \ |
| 146 | libavfilter \ |
| 147 | libavformat \ |
| 148 | libavresample \ |
| 149 | libavutil \ |
| 150 | libpostproc \ |
| 151 | libswresample \ |
| 152 | libswscale" |
| 153 | |
| 154 | FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}" |
| 155 | FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}" |
| 156 | FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}" |
| 157 | FILES_libavformat = "${libdir}/libavformat${SOLIBS}" |
| 158 | FILES_libavresample = "${libdir}/libavresample${SOLIBS}" |
| 159 | FILES_libavutil = "${libdir}/libavutil${SOLIBS}" |
| 160 | FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}" |
| 161 | FILES_libswresample = "${libdir}/libswresample${SOLIBS}" |
| 162 | FILES_libswscale = "${libdir}/libswscale${SOLIBS}" |
| 163 | |
| 164 | # ffmpeg disables PIC on some platforms (e.g. x86-32) |
| 165 | INSANE_SKIP_${MLPREFIX}libavcodec = "textrel" |
| 166 | INSANE_SKIP_${MLPREFIX}libavdevice = "textrel" |
| 167 | INSANE_SKIP_${MLPREFIX}libavfilter = "textrel" |
| 168 | INSANE_SKIP_${MLPREFIX}libavformat = "textrel" |
| 169 | INSANE_SKIP_${MLPREFIX}libavutil = "textrel" |
| 170 | INSANE_SKIP_${MLPREFIX}libavresample = "textrel" |
| 171 | INSANE_SKIP_${MLPREFIX}libswscale = "textrel" |
| 172 | INSANE_SKIP_${MLPREFIX}libswresample = "textrel" |
| 173 | INSANE_SKIP_${MLPREFIX}libpostproc = "textrel" |