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 \ |
| 28 | " |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 29 | SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 30 | |
| 31 | # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 |
| 32 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 33 | ARM_INSTRUCTION_SET_armv5 = "arm" |
| 34 | ARM_INSTRUCTION_SET_armv6 = "arm" |
| 35 | |
| 36 | # Should be API compatible with libav (which was a fork of ffmpeg) |
| 37 | # libpostproc was previously packaged from a separate recipe |
| 38 | PROVIDES = "libav libpostproc" |
| 39 | |
| 40 | DEPENDS = "nasm-native" |
| 41 | |
| 42 | inherit autotools pkgconfig |
| 43 | |
| 44 | PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \ |
| 45 | alsa bzlib gpl lzma theora x264 zlib \ |
| 46 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" |
| 47 | |
| 48 | # libraries to build in addition to avutil |
| 49 | PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" |
| 50 | PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" |
| 51 | PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" |
| 52 | PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" |
| 53 | PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" |
| 54 | PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" |
| 55 | PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" |
| 56 | PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" |
| 57 | |
| 58 | # features to support |
| 59 | PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 60 | PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" |
| 62 | PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" |
| 63 | PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" |
| 64 | PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" |
| 65 | PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" |
| 66 | PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" |
| 67 | PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" |
| 68 | PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" |
| 69 | PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" |
| 70 | PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" |
| 71 | PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" |
| 72 | PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" |
| 73 | PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" |
| 74 | PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" |
| 75 | PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" |
| 76 | PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" |
| 77 | PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" |
| 78 | PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" |
| 79 | PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" |
| 80 | PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" |
| 81 | PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" |
| 82 | |
| 83 | # Check codecs that require --enable-nonfree |
| 84 | USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" |
| 85 | |
| 86 | def cpu(d): |
| 87 | for arg in (d.getVar('TUNE_CCARGS') or '').split(): |
| 88 | if arg.startswith('-mcpu='): |
| 89 | return arg[6:] |
| 90 | return 'generic' |
| 91 | |
| 92 | EXTRA_OECONF = " \ |
| 93 | --disable-stripping \ |
| 94 | --enable-pic \ |
| 95 | --enable-shared \ |
| 96 | --enable-pthreads \ |
| 97 | ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ |
| 98 | \ |
| 99 | --cross-prefix=${TARGET_PREFIX} \ |
| 100 | \ |
| 101 | --ld="${CCLD}" \ |
| 102 | --cc="${CC}" \ |
| 103 | --cxx="${CXX}" \ |
| 104 | --arch=${TARGET_ARCH} \ |
| 105 | --target-os="linux" \ |
| 106 | --enable-cross-compile \ |
| 107 | --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ |
| 108 | --extra-ldflags="${LDFLAGS}" \ |
| 109 | --sysroot="${STAGING_DIR_TARGET}" \ |
| 110 | ${EXTRA_FFCONF} \ |
| 111 | --libdir=${libdir} \ |
| 112 | --shlibdir=${libdir} \ |
| 113 | --datadir=${datadir}/ffmpeg \ |
| 114 | ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \ |
| 115 | --cpu=${@cpu(d)} \ |
| 116 | --pkg-config=pkg-config \ |
| 117 | " |
| 118 | |
| 119 | EXTRA_OECONF_append_linux-gnux32 = " --disable-asm" |
| 120 | # gold crashes on x86, another solution is to --disable-asm but thats more hacky |
| 121 | # ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 |
| 122 | |
| 123 | LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" |
| 124 | |
| 125 | EXTRA_OEMAKE = "V=1" |
| 126 | |
| 127 | do_configure() { |
| 128 | ${S}/configure ${EXTRA_OECONF} |
| 129 | } |
| 130 | |
| 131 | PACKAGES =+ "libavcodec \ |
| 132 | libavdevice \ |
| 133 | libavfilter \ |
| 134 | libavformat \ |
| 135 | libavresample \ |
| 136 | libavutil \ |
| 137 | libpostproc \ |
| 138 | libswresample \ |
| 139 | libswscale" |
| 140 | |
| 141 | FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}" |
| 142 | FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}" |
| 143 | FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}" |
| 144 | FILES_libavformat = "${libdir}/libavformat${SOLIBS}" |
| 145 | FILES_libavresample = "${libdir}/libavresample${SOLIBS}" |
| 146 | FILES_libavutil = "${libdir}/libavutil${SOLIBS}" |
| 147 | FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}" |
| 148 | FILES_libswresample = "${libdir}/libswresample${SOLIBS}" |
| 149 | FILES_libswscale = "${libdir}/libswscale${SOLIBS}" |
| 150 | |
| 151 | # ffmpeg disables PIC on some platforms (e.g. x86-32) |
| 152 | INSANE_SKIP_${MLPREFIX}libavcodec = "textrel" |
| 153 | INSANE_SKIP_${MLPREFIX}libavdevice = "textrel" |
| 154 | INSANE_SKIP_${MLPREFIX}libavfilter = "textrel" |
| 155 | INSANE_SKIP_${MLPREFIX}libavformat = "textrel" |
| 156 | INSANE_SKIP_${MLPREFIX}libavutil = "textrel" |
| 157 | INSANE_SKIP_${MLPREFIX}libavresample = "textrel" |
| 158 | INSANE_SKIP_${MLPREFIX}libswscale = "textrel" |
| 159 | INSANE_SKIP_${MLPREFIX}libswresample = "textrel" |
| 160 | INSANE_SKIP_${MLPREFIX}libpostproc = "textrel" |