From 7bf522c752431159855bb69d090bc407bb197266 Mon Sep 17 00:00:00 2001 From: Randy MacLeod Date: Wed, 10 Mar 2021 13:54:51 -0500 Subject: ffmpeg: upgrade 4.3.1 -> 4.3.2 Remove 2 patches that are included in the n4.3.2 tag. The commits were cherry-picked back to the 4.3 branch so they have different commit ids than in the patches: 6d886b6586 lavf/srt: fix build fail when used the libsrt 1.4.1 a53ffb15d8 avcodec/exr: Check ymin vs. h 4f0bdff292 avformat/vividas: improve extradata packing checks in track_header() (From OE-Core rev: ffdce193f3ab5b8cb16979ee9ae29322b7294c38) Signed-off-by: Randy MacLeod Signed-off-by: Richard Purdie --- ...fix-build-fail-when-used-the-libsrt-1.4.1.patch | 52 ------- .../ffmpeg/ffmpeg/CVE-2020-35964.patch | 75 --------- .../ffmpeg/ffmpeg/CVE-2020-35965.patch | 35 ----- meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb | 173 --------------------- meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.2.bb | 170 ++++++++++++++++++++ 5 files changed, 170 insertions(+), 335 deletions(-) delete mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch delete mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch delete mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch delete mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.2.bb diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch deleted file mode 100644 index 7635c9196a..0000000000 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch +++ /dev/null @@ -1,52 +0,0 @@ -From aebb72e025cbfbd4a6765354f6f565ad4ac89789 Mon Sep 17 00:00:00 2001 -From: Jun Zhao -Date: Sun, 12 Jul 2020 05:48:48 +0800 -Subject: [PATCH] lavf/srt: fix build fail when used the libsrt 1.4.1 - -lavf/srt: fix build fail when used the libsrt 1.4.1 - -libsrt changed the: -SRTO_SMOOTHER -> SRTO_CONGESTION -SRTO_STRICTENC -> SRTO_ENFORCEDENCRYPTION -and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC) -in the header, it's lead to build fail - -fix #8760 - -Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315] - -Signed-off-by: Jose Quaresma -Signed-off-by: Jun Zhao ---- - libavformat/libsrt.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c -index 4de575b..4719ce0 100644 ---- a/libavformat/libsrt.c -+++ b/libavformat/libsrt.c -@@ -313,8 +313,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd) - (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) || - (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) || - #if SRT_VERSION_VALUE >= 0x010302 -+#if SRT_VERSION_VALUE >= 0x010401 -+ (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) || -+#else - /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for compatibility, we used SRTO_STRICTENC */ - (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) || -+#endif - (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) || - (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) || - #endif -@@ -333,7 +337,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd) - (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, "SRTO_LOSSMAXTTL", &s->lossmaxttl, sizeof(s->lossmaxttl)) < 0) || - (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, "SRTO_MINVERSION", &s->minversion, sizeof(s->minversion)) < 0) || - (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) || -+#if SRT_VERSION_VALUE >= 0x010401 -+ (s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, "SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) || -+#else - (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) || -+#endif - (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) || - (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) || - ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) { diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch deleted file mode 100644 index 6b96bd674f..0000000000 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 27a99e2c7d450fef15594671eef4465c8a166bd7 Mon Sep 17 00:00:00 2001 -From: Michael Niedermayer -Date: Wed, 28 Oct 2020 20:11:54 +0100 -Subject: [PATCH] avformat/vividas: improve extradata packing checks in - track_header() - -Fixes: out of array accesses -Fixes: 26622/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6581200338288640 - -Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg -Signed-off-by: Michael Niedermayer - -Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/27a99e2c7d450fef15594671eef4465c8a166bd7] - -CVE: CVE-2020-35964 - -Signed-off-by: Michael Niedermayer -Signed-off-by: Khairul Rohaizzat Jamaluddin ---- - libavformat/vividas.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/libavformat/vividas.c b/libavformat/vividas.c -index 83d0ed116787..46c66bf9a0ae 100644 ---- a/libavformat/vividas.c -+++ b/libavformat/vividas.c -@@ -28,6 +28,7 @@ - * @sa http://wiki.multimedia.cx/index.php?title=Vividas_VIV - */ - -+#include "libavutil/avassert.h" - #include "libavutil/intreadwrite.h" - #include "avio_internal.h" - #include "avformat.h" -@@ -379,7 +380,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * - - if (avio_tell(pb) < off) { - int num_data; -- int xd_size = 0; -+ int xd_size = 1; - int data_len[256]; - int offset = 1; - uint8_t *p; -@@ -393,10 +394,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * - return AVERROR_INVALIDDATA; - } - data_len[j] = len; -- xd_size += len; -+ xd_size += len + 1 + len/255; - } - -- ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255); -+ ret = ff_alloc_extradata(st->codecpar, xd_size); - if (ret < 0) - return ret; - -@@ -405,9 +406,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * - - for (j = 0; j < num_data - 1; j++) { - unsigned delta = av_xiphlacing(&p[offset], data_len[j]); -- if (delta > data_len[j]) { -- return AVERROR_INVALIDDATA; -- } -+ av_assert0(delta <= xd_size - offset); - offset += delta; - } - -@@ -418,6 +417,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * - av_freep(&st->codecpar->extradata); - break; - } -+ av_assert0(data_len[j] <= xd_size - offset); - offset += data_len[j]; - } - diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch deleted file mode 100644 index ddab8e9aca..0000000000 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 3e5959b3457f7f1856d997261e6ac672bba49e8b Mon Sep 17 00:00:00 2001 -From: Michael Niedermayer -Date: Sat, 24 Oct 2020 22:21:48 +0200 -Subject: [PATCH] avcodec/exr: Check ymin vs. h - -Fixes: out of array access -Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344 -Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136 - -Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg -Signed-off-by: Michael Niedermayer - -Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/3e5959b3457f7f1856d997261e6ac672bba49e8b] - -CVE: CVE-2020-35965 - -Signed-off-by: Michael Niedermayer -Signed-off-by: Khairul Rohaizzat Jamaluddin ---- - libavcodec/exr.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/exr.c b/libavcodec/exr.c -index e907c5c46401..8b701d1cd298 100644 ---- a/libavcodec/exr.c -+++ b/libavcodec/exr.c -@@ -1830,7 +1830,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, - // Zero out the start if ymin is not 0 - for (i = 0; i < planes; i++) { - ptr = picture->data[i]; -- for (y = 0; y < s->ymin; y++) { -+ for (y = 0; y < FFMIN(s->ymin, s->h); y++) { - memset(ptr, 0, out_line_size); - ptr += picture->linesize[i]; - } diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb deleted file mode 100644 index bd21552332..0000000000 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb +++ /dev/null @@ -1,173 +0,0 @@ -SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." -DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \ - mux, demux, stream, filter and play pretty much anything that humans and machines \ - have created. It supports the most obscure ancient formats up to the cutting edge." -HOMEPAGE = "https://www.ffmpeg.org/" -SECTION = "libs" - -LICENSE = "BSD & GPLv2+ & LGPLv2.1+ & MIT" -LICENSE_${PN} = "GPLv2+" -LICENSE_libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libavresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libpostproc = "GPLv2+" -LICENSE_libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" -LICENSE_FLAGS = "commercial" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ - file://mips64_cpu_detection.patch \ - file://0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch \ - file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ - file://CVE-2020-35964.patch \ - file://CVE-2020-35965.patch \ - " -SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb" - -# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 -ARM_INSTRUCTION_SET_armv4 = "arm" -ARM_INSTRUCTION_SET_armv5 = "arm" -ARM_INSTRUCTION_SET_armv6 = "arm" - -# Should be API compatible with libav (which was a fork of ffmpeg) -# libpostproc was previously packaged from a separate recipe -PROVIDES = "libav libpostproc" - -DEPENDS = "nasm-native" - -inherit autotools pkgconfig - -PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \ - alsa bzlib gpl lzma pic pthreads shared theora x264 zlib \ - ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" - -# libraries to build in addition to avutil -PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" -PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" -PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" -PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" -PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" -PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" -PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" -PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" - -# features to support -PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" -PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," -PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" -PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" -PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" -PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" -PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" -PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" -PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" -PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" -PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" -PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" -PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" -PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" -PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" -PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" -PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" -PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" -PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" -PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" -PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" -PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" -PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" -PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" - -# other configuration options -PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" -PACKAGECONFIG[pic] = "--enable-pic" -PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" -PACKAGECONFIG[shared] = "--enable-shared" -PACKAGECONFIG[strip] = ",--disable-stripping" - -# Check codecs that require --enable-nonfree -USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" - -def cpu(d): - for arg in (d.getVar('TUNE_CCARGS') or '').split(): - if arg.startswith('-mcpu='): - return arg[6:] - return 'generic' - -EXTRA_OECONF = " \ - ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ - \ - --cross-prefix=${TARGET_PREFIX} \ - \ - --ld="${CCLD}" \ - --cc="${CC}" \ - --cxx="${CXX}" \ - --arch=${TARGET_ARCH} \ - --target-os="linux" \ - --enable-cross-compile \ - --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ - --extra-ldflags="${LDFLAGS}" \ - --sysroot="${STAGING_DIR_TARGET}" \ - ${EXTRA_FFCONF} \ - --libdir=${libdir} \ - --shlibdir=${libdir} \ - --datadir=${datadir}/ffmpeg \ - --cpu=${@cpu(d)} \ - --pkg-config=pkg-config \ -" - -EXTRA_OECONF_append_linux-gnux32 = " --disable-asm" -# gold crashes on x86, another solution is to --disable-asm but thats more hacky -# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 - -LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" - -EXTRA_OEMAKE = "V=1" - -do_configure() { - ${S}/configure ${EXTRA_OECONF} -} - -# patch out build host paths for reproducibility -do_compile_prepend_class-target() { - sed -i -e "s,${WORKDIR},,g" ${B}/config.h -} - -PACKAGES =+ "libavcodec \ - libavdevice \ - libavfilter \ - libavformat \ - libavresample \ - libavutil \ - libpostproc \ - libswresample \ - libswscale" - -FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}" -FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}" -FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}" -FILES_libavformat = "${libdir}/libavformat${SOLIBS}" -FILES_libavresample = "${libdir}/libavresample${SOLIBS}" -FILES_libavutil = "${libdir}/libavutil${SOLIBS}" -FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}" -FILES_libswresample = "${libdir}/libswresample${SOLIBS}" -FILES_libswscale = "${libdir}/libswscale${SOLIBS}" - -# ffmpeg disables PIC on some platforms (e.g. x86-32) -INSANE_SKIP_${MLPREFIX}libavcodec = "textrel" -INSANE_SKIP_${MLPREFIX}libavdevice = "textrel" -INSANE_SKIP_${MLPREFIX}libavfilter = "textrel" -INSANE_SKIP_${MLPREFIX}libavformat = "textrel" -INSANE_SKIP_${MLPREFIX}libavutil = "textrel" -INSANE_SKIP_${MLPREFIX}libavresample = "textrel" -INSANE_SKIP_${MLPREFIX}libswscale = "textrel" -INSANE_SKIP_${MLPREFIX}libswresample = "textrel" -INSANE_SKIP_${MLPREFIX}libpostproc = "textrel" diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.2.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.2.bb new file mode 100644 index 0000000000..9dd56fbba4 --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.2.bb @@ -0,0 +1,170 @@ +SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." +DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \ + mux, demux, stream, filter and play pretty much anything that humans and machines \ + have created. It supports the most obscure ancient formats up to the cutting edge." +HOMEPAGE = "https://www.ffmpeg.org/" +SECTION = "libs" + +LICENSE = "BSD & GPLv2+ & LGPLv2.1+ & MIT" +LICENSE_${PN} = "GPLv2+" +LICENSE_libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libavresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libpostproc = "GPLv2+" +LICENSE_libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPLv2+', 'LGPLv2.1+', d)}" +LICENSE_FLAGS = "commercial" + +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ + file://mips64_cpu_detection.patch \ + file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ + " +SRC_URI[sha256sum] = "46e4e64f1dd0233cbc0934b9f1c0da676008cad34725113fb7f802cfa84ccddb" + +# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" +ARM_INSTRUCTION_SET_armv6 = "arm" + +# Should be API compatible with libav (which was a fork of ffmpeg) +# libpostproc was previously packaged from a separate recipe +PROVIDES = "libav libpostproc" + +DEPENDS = "nasm-native" + +inherit autotools pkgconfig + +PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \ + alsa bzlib gpl lzma pic pthreads shared theora x264 zlib \ + ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" + +# libraries to build in addition to avutil +PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" +PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" +PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" +PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" +PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" +PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" +PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" +PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" + +# features to support +PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" +PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," +PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" +PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" +PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" +PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" +PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" +PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" +PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" +PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" +PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" +PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" +PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" +PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" +PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" +PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" +PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" +PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" +PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" +PACKAGECONFIG[x265] = "--enable-libx265,--disable-libx265,x265" +PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" +PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" +PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" + +# other configuration options +PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" +PACKAGECONFIG[pic] = "--enable-pic" +PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" +PACKAGECONFIG[shared] = "--enable-shared" +PACKAGECONFIG[strip] = ",--disable-stripping" + +# Check codecs that require --enable-nonfree +USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" + +def cpu(d): + for arg in (d.getVar('TUNE_CCARGS') or '').split(): + if arg.startswith('-mcpu='): + return arg[6:] + return 'generic' + +EXTRA_OECONF = " \ + ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ + \ + --cross-prefix=${TARGET_PREFIX} \ + \ + --ld="${CCLD}" \ + --cc="${CC}" \ + --cxx="${CXX}" \ + --arch=${TARGET_ARCH} \ + --target-os="linux" \ + --enable-cross-compile \ + --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ + --extra-ldflags="${LDFLAGS}" \ + --sysroot="${STAGING_DIR_TARGET}" \ + ${EXTRA_FFCONF} \ + --libdir=${libdir} \ + --shlibdir=${libdir} \ + --datadir=${datadir}/ffmpeg \ + --cpu=${@cpu(d)} \ + --pkg-config=pkg-config \ +" + +EXTRA_OECONF_append_linux-gnux32 = " --disable-asm" +# gold crashes on x86, another solution is to --disable-asm but thats more hacky +# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 + +LDFLAGS_append_x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" + +EXTRA_OEMAKE = "V=1" + +do_configure() { + ${S}/configure ${EXTRA_OECONF} +} + +# patch out build host paths for reproducibility +do_compile_prepend_class-target() { + sed -i -e "s,${WORKDIR},,g" ${B}/config.h +} + +PACKAGES =+ "libavcodec \ + libavdevice \ + libavfilter \ + libavformat \ + libavresample \ + libavutil \ + libpostproc \ + libswresample \ + libswscale" + +FILES_libavcodec = "${libdir}/libavcodec${SOLIBS}" +FILES_libavdevice = "${libdir}/libavdevice${SOLIBS}" +FILES_libavfilter = "${libdir}/libavfilter${SOLIBS}" +FILES_libavformat = "${libdir}/libavformat${SOLIBS}" +FILES_libavresample = "${libdir}/libavresample${SOLIBS}" +FILES_libavutil = "${libdir}/libavutil${SOLIBS}" +FILES_libpostproc = "${libdir}/libpostproc${SOLIBS}" +FILES_libswresample = "${libdir}/libswresample${SOLIBS}" +FILES_libswscale = "${libdir}/libswscale${SOLIBS}" + +# ffmpeg disables PIC on some platforms (e.g. x86-32) +INSANE_SKIP_${MLPREFIX}libavcodec = "textrel" +INSANE_SKIP_${MLPREFIX}libavdevice = "textrel" +INSANE_SKIP_${MLPREFIX}libavfilter = "textrel" +INSANE_SKIP_${MLPREFIX}libavformat = "textrel" +INSANE_SKIP_${MLPREFIX}libavutil = "textrel" +INSANE_SKIP_${MLPREFIX}libavresample = "textrel" +INSANE_SKIP_${MLPREFIX}libswscale = "textrel" +INSANE_SKIP_${MLPREFIX}libswresample = "textrel" +INSANE_SKIP_${MLPREFIX}libpostproc = "textrel" -- cgit v1.2.3-54-g00ecf