From 5ecb96d56f698039bbc58519400ef5be0e2cbf22 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 19 Jan 2022 11:41:16 +0100 Subject: ffmpeg: upgrade 4.4.1 -> 5.0 libavresample has been removed; libswresample is the replacement. (From OE-Core rev: 5555bca01750024a786a1f78d573d02f12b45686) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- ...nclude-assembly-with-full-path-from-sourc.patch | 21 +- meta/recipes-multimedia/ffmpeg/ffmpeg_4.4.1.bb | 181 ----------- meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.bb | 176 +++++++++++ ...001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch | 346 +++++++++++++++++++++ .../gstreamer/gstreamer1.0-libav_1.18.5.bb | 4 +- 5 files changed, 543 insertions(+), 185 deletions(-) delete mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg_4.4.1.bb create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.bb create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch (limited to 'meta/recipes-multimedia') diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch index 2b4ca0e9b9..7d0a06f85b 100644 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch @@ -1,4 +1,4 @@ -From 24a58d70cbb3997e471366bd5afe54be9007bfb1 Mon Sep 17 00:00:00 2001 +From 4a891e1eddbf63f32fe769b5bff289f6748abf45 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 10 Nov 2020 15:32:14 +0000 Subject: [PATCH] libavutil: include assembly with full path from source root @@ -6,8 +6,9 @@ Subject: [PATCH] libavutil: include assembly with full path from source root Otherwise nasm writes the full host-specific paths into .o output, which breaks binary reproducibility. -Upstream-Status: Submitted [by email to jamrial@gmail.com,ffmpeg-devel@ffmpeg.org] +Upstream-Status: Submitted [http://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/291781.html] Signed-off-by: Alexander Kanavin + --- libavutil/x86/cpuid.asm | 2 +- libavutil/x86/emms.asm | 2 +- @@ -15,7 +16,8 @@ Signed-off-by: Alexander Kanavin libavutil/x86/float_dsp.asm | 2 +- libavutil/x86/lls.asm | 2 +- libavutil/x86/pixelutils.asm | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) + libavutil/x86/tx_float.asm | 2 +- + 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavutil/x86/cpuid.asm b/libavutil/x86/cpuid.asm index c3f7866..766f77f 100644 @@ -95,3 +97,16 @@ index 36c57c5..8b45ead 100644 SECTION .text +diff --git a/libavutil/x86/tx_float.asm b/libavutil/x86/tx_float.asm +index 4d2283f..ea39f21 100644 +--- a/libavutil/x86/tx_float.asm ++++ b/libavutil/x86/tx_float.asm +@@ -29,7 +29,7 @@ + ; replace some shuffles with vblends? + ; avx512 split-radix + +-%include "x86util.asm" ++%include "libavutil/x86/x86util.asm" + + %if ARCH_X86_64 + %define ptr resq diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.4.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.4.1.bb deleted file mode 100644 index 3ba07c31d6..0000000000 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.4.1.bb +++ /dev/null @@ -1,181 +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 = "GPLv2+ & LGPLv2.1+ & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" -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://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ - " -SRC_URI[sha256sum] = "eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02" - -# 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 lzma pic pthreads shared theora 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[libopus] = "--enable-libopus,--disable-libopus,libopus" -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" - -EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" -EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" -EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" -EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" -EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ - --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa --disable-msa2" -EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic" -EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" -EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" - -# 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_5.0.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.bb new file mode 100644 index 0000000000..4ba5ff4537 --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_5.0.bb @@ -0,0 +1,176 @@ +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 = "GPLv2+ & LGPLv2.1+ & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" +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: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://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ + " +SRC_URI[sha256sum] = "51e919f7d205062c0fd4fae6243a84850391115104ccf1efc451733bc0ac7298" + +# 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 \ + alsa bzlib lzma pic pthreads shared theora 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" + +# 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[libopus] = "--enable-libopus,--disable-libopus,libopus" +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" + +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mipsisa64r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r2', '--disable-mips64r6 --disable-mips32r6', '', d)}" +EXTRA_OECONF += "${@bb.utils.contains('TUNE_FEATURES', 'mips32r6', '--disable-mips64r2 --disable-mips32r2', '', d)}" +EXTRA_OECONF:append:mips = " --extra-libs=-latomic --disable-mips32r5 --disable-mipsdsp --disable-mipsdspr2 \ + --disable-loongson2 --disable-loongson3 --disable-mmi --disable-msa --disable-msa2" +EXTRA_OECONF:append:riscv32 = " --extra-libs=-latomic" +EXTRA_OECONF:append:armv5 = " --extra-libs=-latomic" +EXTRA_OECONF:append:powerpc = " --extra-libs=-latomic" + +# 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 \ + 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: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}libswscale = "textrel" +INSANE_SKIP:${MLPREFIX}libswresample = "textrel" +INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch new file mode 100644 index 0000000000..022ff9af29 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch @@ -0,0 +1,346 @@ +From 38d10ee800e42afeacc6bee714216e4c974c11f5 Mon Sep 17 00:00:00 2001 +From: Xi Ruoyao +Date: Mon, 17 Jan 2022 01:33:47 +0800 +Subject: [PATCH] gst-libav: fix build with ffmpeg-5.0.0 + +Latest ffmpeg has removed avcodec_get_context_defaults(), and its +documentation says a new AVCodecContext should be allocated for this +purpose. The pointer returned by avcodec_find_decoder() is now +const-qualified so we also need to adjust for it. And, AVCOL_RANGE_MPEG +is now rejected with strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL. + +Part-of: +Upstream-Status: Backport +Signed-off-by: Alexander Kanavin +--- + ext/libav/gstavauddec.c | 22 ++++++++------------- + ext/libav/gstavaudenc.c | 40 +++++++++++++++++++-------------------- + ext/libav/gstavcodecmap.c | 7 ++++--- + ext/libav/gstavutils.c | 2 +- + ext/libav/gstavviddec.c | 28 +++++++++++---------------- + ext/libav/gstavvidenc.c | 21 ++++++++++---------- + 6 files changed, 54 insertions(+), 66 deletions(-) + +diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c +index baf7aa5..b03a724 100644 +--- a/ext/libav/gstavauddec.c ++++ b/ext/libav/gstavauddec.c +@@ -168,12 +168,7 @@ gst_ffmpegauddec_finalize (GObject * object) + GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) object; + + av_frame_free (&ffmpegdec->frame); +- +- if (ffmpegdec->context != NULL) { +- gst_ffmpeg_avcodec_close (ffmpegdec->context); +- av_free (ffmpegdec->context); +- ffmpegdec->context = NULL; +- } ++ avcodec_free_context (&ffmpegdec->context); + + G_OBJECT_CLASS (parent_class)->finalize (object); + } +@@ -193,14 +188,12 @@ gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec, gboolean reset) + gst_ffmpeg_avcodec_close (ffmpegdec->context); + ffmpegdec->opened = FALSE; + +- if (ffmpegdec->context->extradata) { +- av_free (ffmpegdec->context->extradata); +- ffmpegdec->context->extradata = NULL; +- } ++ av_freep (&ffmpegdec->context->extradata); + + if (reset) { +- if (avcodec_get_context_defaults3 (ffmpegdec->context, +- oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegdec->context); ++ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegdec->context == NULL) { + GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults"); + return FALSE; + } +@@ -219,8 +212,9 @@ gst_ffmpegauddec_start (GstAudioDecoder * decoder) + oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); + + GST_OBJECT_LOCK (ffmpegdec); +- gst_ffmpeg_avcodec_close (ffmpegdec->context); +- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegdec->context); ++ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegdec->context == NULL) { + GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults"); + GST_OBJECT_UNLOCK (ffmpegdec); + return FALSE; +diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c +index 3ff6432..689982f 100644 +--- a/ext/libav/gstavaudenc.c ++++ b/ext/libav/gstavaudenc.c +@@ -175,10 +175,8 @@ gst_ffmpegaudenc_finalize (GObject * object) + + /* clean up remaining allocated data */ + av_frame_free (&ffmpegaudenc->frame); +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); +- gst_ffmpeg_avcodec_close (ffmpegaudenc->refcontext); +- av_free (ffmpegaudenc->context); +- av_free (ffmpegaudenc->refcontext); ++ avcodec_free_context (&ffmpegaudenc->context); ++ avcodec_free_context (&ffmpegaudenc->refcontext); + + G_OBJECT_CLASS (parent_class)->finalize (object); + } +@@ -193,9 +191,9 @@ gst_ffmpegaudenc_start (GstAudioEncoder * encoder) + ffmpegaudenc->opened = FALSE; + ffmpegaudenc->need_reopen = FALSE; + +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); +- if (avcodec_get_context_defaults3 (ffmpegaudenc->context, +- oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegaudenc->context); ++ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegaudenc->context == NULL) { + GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults"); + return FALSE; + } +@@ -241,10 +239,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) + + /* close old session */ + if (ffmpegaudenc->opened) { +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); ++ avcodec_free_context (&ffmpegaudenc->context); + ffmpegaudenc->opened = FALSE; +- if (avcodec_get_context_defaults3 (ffmpegaudenc->context, +- oclass->in_plugin) < 0) { ++ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegaudenc->context == NULL) { + GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults"); + return FALSE; + } +@@ -286,11 +284,11 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) + /* open codec */ + if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) { + gst_caps_unref (allowed_caps); +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); ++ avcodec_free_context (&ffmpegaudenc->context); + GST_DEBUG_OBJECT (ffmpegaudenc, "avenc_%s: Failed to open FFMPEG codec", + oclass->in_plugin->name); +- if (avcodec_get_context_defaults3 (ffmpegaudenc->context, +- oclass->in_plugin) < 0) ++ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegaudenc->context == NULL) + GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults"); + + if ((oclass->in_plugin->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && +@@ -312,10 +310,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) + + if (!other_caps) { + gst_caps_unref (allowed_caps); +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); ++ avcodec_free_context (&ffmpegaudenc->context); + GST_DEBUG ("Unsupported codec - no caps found"); +- if (avcodec_get_context_defaults3 (ffmpegaudenc->context, +- oclass->in_plugin) < 0) ++ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegaudenc->context == NULL) + GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults"); + return FALSE; + } +@@ -331,10 +329,10 @@ gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) + + if (!gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (ffmpegaudenc), + icaps)) { +- gst_ffmpeg_avcodec_close (ffmpegaudenc->context); ++ avcodec_free_context (&ffmpegaudenc->context); + gst_caps_unref (icaps); +- if (avcodec_get_context_defaults3 (ffmpegaudenc->context, +- oclass->in_plugin) < 0) ++ ffmpegaudenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegaudenc->context == NULL) + GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults"); + return FALSE; + } +@@ -403,8 +401,8 @@ buffer_info_free (void *opaque, guint8 * data) + gst_buffer_unmap (info->buffer, &info->map); + gst_buffer_unref (info->buffer); + } else { +- av_free (info->ext_data); +- av_free (info->ext_data_array); ++ av_freep (&info->ext_data); ++ av_freep (&info->ext_data_array); + } + g_slice_free (BufferInfo, info); + } +diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c +index f58633d..e2a3641 100644 +--- a/ext/libav/gstavcodecmap.c ++++ b/ext/libav/gstavcodecmap.c +@@ -2331,7 +2331,7 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id, + } + + if (buildcaps) { +- AVCodec *codec; ++ const AVCodec *codec; + + if ((codec = avcodec_find_decoder (codec_id)) || + (codec = avcodec_find_encoder (codec_id))) { +@@ -2975,6 +2975,7 @@ gst_ffmpeg_videoinfo_to_context (GstVideoInfo * info, AVCodecContext * context) + context->color_range = AVCOL_RANGE_JPEG; + } else { + context->color_range = AVCOL_RANGE_MPEG; ++ context->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL; + } + } + +@@ -4330,7 +4331,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context) + audio = TRUE; + } else if (!strncmp (mimetype, "audio/x-gst-av-", 15)) { + gchar ext[16]; +- AVCodec *codec; ++ const AVCodec *codec; + + if (strlen (mimetype) <= 30 && + sscanf (mimetype, "audio/x-gst-av-%s", ext) == 1) { +@@ -4342,7 +4343,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context) + } + } else if (!strncmp (mimetype, "video/x-gst-av-", 15)) { + gchar ext[16]; +- AVCodec *codec; ++ const AVCodec *codec; + + if (strlen (mimetype) <= 30 && + sscanf (mimetype, "video/x-gst-av-%s", ext) == 1) { +diff --git a/ext/libav/gstavutils.c b/ext/libav/gstavutils.c +index 3780cff..f3878c3 100644 +--- a/ext/libav/gstavutils.c ++++ b/ext/libav/gstavutils.c +@@ -36,7 +36,7 @@ + const gchar * + gst_ffmpeg_get_codecid_longname (enum AVCodecID codec_id) + { +- AVCodec *codec; ++ const AVCodec *codec; + /* Let's use what ffmpeg can provide us */ + + if ((codec = avcodec_find_decoder (codec_id)) || +diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c +index 7ec5766..5dd207e 100644 +--- a/ext/libav/gstavviddec.c ++++ b/ext/libav/gstavviddec.c +@@ -320,12 +320,7 @@ gst_ffmpegviddec_finalize (GObject * object) + GstFFMpegVidDec *ffmpegdec = (GstFFMpegVidDec *) object; + + av_frame_free (&ffmpegdec->picture); +- +- if (ffmpegdec->context != NULL) { +- gst_ffmpeg_avcodec_close (ffmpegdec->context); +- av_free (ffmpegdec->context); +- ffmpegdec->context = NULL; +- } ++ avcodec_free_context (&ffmpegdec->context); + + G_OBJECT_CLASS (parent_class)->finalize (object); + } +@@ -363,13 +358,11 @@ gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec, gboolean reset) + + gst_buffer_replace (&ffmpegdec->palette, NULL); + +- if (ffmpegdec->context->extradata) { +- av_free (ffmpegdec->context->extradata); +- ffmpegdec->context->extradata = NULL; +- } ++ av_freep (&ffmpegdec->context->extradata); + if (reset) { +- if (avcodec_get_context_defaults3 (ffmpegdec->context, +- oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegdec->context); ++ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegdec->context == NULL) { + GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults"); + return FALSE; + } +@@ -1704,7 +1697,7 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, + if (side_data) { + GST_LOG_OBJECT (ffmpegdec, + "Found CC side data of type AV_FRAME_DATA_A53_CC, size %d", +- side_data->size); ++ (int) side_data->size); + GST_MEMDUMP ("A53 CC", side_data->data, side_data->size); + + /* do not add closed caption meta if it already exists */ +@@ -1966,8 +1959,9 @@ gst_ffmpegviddec_start (GstVideoDecoder * decoder) + oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); + + GST_OBJECT_LOCK (ffmpegdec); +- gst_ffmpeg_avcodec_close (ffmpegdec->context); +- if (avcodec_get_context_defaults3 (ffmpegdec->context, oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegdec->context); ++ ffmpegdec->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegdec->context == NULL) { + GST_DEBUG_OBJECT (ffmpegdec, "Failed to set context defaults"); + GST_OBJECT_UNLOCK (ffmpegdec); + return FALSE; +@@ -2261,10 +2255,10 @@ gst_ffmpegviddec_get_property (GObject * object, + + switch (prop_id) { + case PROP_LOWRES: +- g_value_set_enum (value, ffmpegdec->context->lowres); ++ g_value_set_enum (value, ffmpegdec->lowres); + break; + case PROP_SKIPFRAME: +- g_value_set_enum (value, ffmpegdec->context->skip_frame); ++ g_value_set_enum (value, ffmpegdec->skip_frame); + break; + case PROP_DIRECT_RENDERING: + g_value_set_boolean (value, ffmpegdec->direct_rendering); +diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c +index 0468d88..2ed9e5a 100644 +--- a/ext/libav/gstavvidenc.c ++++ b/ext/libav/gstavvidenc.c +@@ -224,8 +224,8 @@ gst_ffmpegvidenc_finalize (GObject * object) + av_frame_free (&ffmpegenc->picture); + gst_ffmpeg_avcodec_close (ffmpegenc->context); + gst_ffmpeg_avcodec_close (ffmpegenc->refcontext); +- av_free (ffmpegenc->context); +- av_free (ffmpegenc->refcontext); ++ av_freep (&ffmpegenc->context); ++ av_freep (&ffmpegenc->refcontext); + + G_OBJECT_CLASS (parent_class)->finalize (object); + } +@@ -247,10 +247,10 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder, + + /* close old session */ + if (ffmpegenc->opened) { +- gst_ffmpeg_avcodec_close (ffmpegenc->context); ++ avcodec_free_context (&ffmpegenc->context); + ffmpegenc->opened = FALSE; +- if (avcodec_get_context_defaults3 (ffmpegenc->context, +- oclass->in_plugin) < 0) { ++ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegenc->context == NULL) { + GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults"); + return FALSE; + } +@@ -454,9 +454,9 @@ bad_input_fmt: + } + close_codec: + { +- gst_ffmpeg_avcodec_close (ffmpegenc->context); +- if (avcodec_get_context_defaults3 (ffmpegenc->context, +- oclass->in_plugin) < 0) ++ avcodec_free_context (&ffmpegenc->context); ++ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegenc->context == NULL) + GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults"); + goto cleanup_stats_in; + } +@@ -896,8 +896,9 @@ gst_ffmpegvidenc_start (GstVideoEncoder * encoder) + ffmpegenc->need_reopen = FALSE; + + /* close old session */ +- gst_ffmpeg_avcodec_close (ffmpegenc->context); +- if (avcodec_get_context_defaults3 (ffmpegenc->context, oclass->in_plugin) < 0) { ++ avcodec_free_context (&ffmpegenc->context); ++ ffmpegenc->context = avcodec_alloc_context3 (oclass->in_plugin); ++ if (ffmpegenc->context == NULL) { + GST_DEBUG_OBJECT (ffmpegenc, "Failed to set context defaults"); + return FALSE; + } diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb index a77ec62759..64b8bcdb52 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb @@ -11,7 +11,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \ " -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz" +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \ + file://0001-gst-libav-fix-build-with-ffmpeg-5.0.0.patch \ + " SRC_URI[sha256sum] = "822e008a910e9dd13aedbdd8dc63fedef4040c0ee2e927bab3112e9de693a548" S = "${WORKDIR}/gst-libav-${PV}" -- cgit v1.2.3-54-g00ecf