commit 763d5a7382ce7b713511fb4b0ac1ce097508e8f6 parent 1c7977bb95a42b7792fb8b7b4a11c0afe4697a01 Author: Shokara Kou <kou@13f0.net> Date: Mon, 4 Mar 2024 17:07:52 -0500 import graphics/ffmpeg Diffstat:
35 files changed, 2635 insertions(+), 0 deletions(-)
diff --git a/graphics/ffmpeg/CVS/Entries b/graphics/ffmpeg/CVS/Entries @@ -0,0 +1,4 @@ +D/patches//// +D/pkg//// +/distinfo/1.66/Sun Apr 30 07:19:22 2023// +/Makefile/1.237/Mon Dec 18 18:19:44 2023// diff --git a/graphics/ffmpeg/CVS/Repository b/graphics/ffmpeg/CVS/Repository @@ -0,0 +1 @@ +ports/graphics/ffmpeg diff --git a/graphics/ffmpeg/Makefile b/graphics/ffmpeg/Makefile @@ -0,0 +1,215 @@ +COMMENT= audio/video converter and streamer + +V= 4.4.4 +DISTNAME= ffmpeg-${V} +EPOCH= 1 +REVISION= 3 +CATEGORIES= graphics multimedia +SITES= https://ffmpeg.org/releases/ +EXTRACT_SUFX= .tar.xz + +USE_NOBTCFI-amd64= Yes + +SHARED_LIBS= avcodec 25.0 \ + avdevice 13.0 \ + avfilter 11.0 \ + avformat 22.0 \ + avutil 15.0 \ + postproc 19.0 \ + swresample 4.0 \ + swscale 7.0 + +HOMEPAGE= https://ffmpeg.org/ + +MAINTAINER= Brad Smith <brad@comstyle.com> + +# LGPLv2.1 and GPLv2 +PERMIT_PACKAGE= Yes + +WANTLIB+= SDL2 X11 Xext Xv aom ass bz2 c crypto dav1d fontconfig +WANTLIB+= freetype fribidi gsm iconv lzma m mp3lame opus +WANTLIB+= pthread sndio speex ssl theoradec theoraenc v4l2 +WANTLIB+= vorbis vorbisenc vpx x264 x265 xcb xcb-shape xcb-shm +WANTLIB+= xcb-xfixes xml2 xvidcore vidstab z zimg + +COMPILER= base-clang ports-gcc +COMPILER_LANGS= c + +DEBUG_PACKAGES= ${BUILD_PACKAGES} + +BUILD_DEPENDS= audio/ladspa \ + textproc/texi2html \ + multimedia/frei0r-plugins +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +BUILD_DEPENDS+= devel/nasm +.endif +LIB_DEPENDS= archivers/bzip2 \ + archivers/xz \ + audio/lame \ + audio/libvorbis \ + audio/opus \ + audio/speex \ + audio/gsm \ + converters/libiconv \ + devel/sdl2 \ + graphics/zimg \ + multimedia/aom \ + multimedia/dav1d \ + multimedia/libass \ + multimedia/libtheora \ + multimedia/libv4l \ + multimedia/libvidstab \ + multimedia/libvpx \ + multimedia/x264 \ + multimedia/x265 \ + multimedia/xvidcore \ + textproc/libxml + +# inter-library dependencies for the current configuration +LIBavcodec_EXTRALIBS=-L${LOCALBASE}/lib -laom -ldav1d -lgsm -liconv -llzma -lmp3lame -lopus -lspeex -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx -lx264 -lx265 -lxvidcore -lm -lz -pthread +LIBavdevice_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lX11 -lXext -lXv -lxcb-shape -lxcb-shm -lxcb-xfixes -lxcb -lsndio -lv4l2 -lm +LIBavfilter_EXTRALIBS=-L${LOCALBASE}/lib -L${X11BASE}/lib -lass -lfontconfig -lfreetype -lfribidi -lvidstab -lm -lz -lzimg -pthread +LIBavformat_EXTRALIBS=-L${LOCALBASE}/lib -lbz2 -lxml2 -lssl -lcrypto -lm -lz +LIBavutil_EXTRALIBS=-lm -pthread +LIBpostproc_EXTRALIBS=-lm +LIBswresample_EXTRALIBS=-lm +LIBswscale_EXTRALIBS=-lm + +.if ${MACHINE_ARCH} == i386 +LDLIBFLAGS+= -Wl,-znotext +.endif + +OPTFLAGS= ${CFLAGS} + +# until the system headers are fixed properly. +OPTFLAGS+= -Wno-redundant-decls + +FIX_EXTRACT_PERMISSIONS= Yes +SEPARATE_BUILD= Yes +USE_GMAKE= Yes +CONFIGURE_STYLE= simple +CONFIGURE_ARGS+=--enable-shared \ + --arch=${MACHINE_ARCH} \ + --cc=${CC} \ + --enable-debug \ + --disable-stripping \ + --disable-indev=jack \ + --disable-outdev=sdl2 \ + --enable-fontconfig \ + --enable-frei0r \ + --enable-gpl \ + --enable-ladspa \ + --enable-libaom \ + --enable-libass \ + --enable-libdav1d \ + --enable-libfreetype \ + --enable-libfribidi \ + --enable-libgsm \ + --enable-libmp3lame \ + --enable-libopus \ + --enable-libspeex \ + --enable-libtheora \ + --enable-libv4l2 \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxml2 \ + --enable-libxvid \ + --enable-libzimg \ + --enable-nonfree \ + --enable-openssl \ + --enable-libvidstab \ + --extra-cflags="-I${LOCALBASE}/include -I${X11BASE}/include" \ + --extra-libs="-L${LOCALBASE}/lib -L${X11BASE}/lib" \ + --extra-ldsoflags="${LDLIBFLAGS}" \ + --mandir=${PREFIX}/man \ + --objcc="/usr/bin/false" \ + --optflags="${OPTFLAGS}" + +.if ${MACHINE_ARCH} == "arm" +CONFIGURE_ARGS+=--disable-asm +.endif +.if ${MACHINE_ARCH} == "powerpc" +CONFIGURE_ARGS+=--disable-altivec +.endif +.if ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" +CONFIGURE_ARGS+=--disable-mipsdsp \ + --disable-mipsdspr2 \ + --disable-mipsfpu \ + --disable-mmi \ + --disable-msa +.endif + +CONFIGURE_ENV+= TERM=${TERM} \ + TMPDIR=${WRKBUILD} \ + X86ASMFLAGS="${DEBUG}" + +MAKE_ENV+= V=1 \ + libavcodec_extralibs="${LIBavcodec_EXTRALIBS}" \ + libavdevice_extralibs="${LIBavdevice_EXTRALIBS}" \ + libavfilter_extralibs="${LIBavfilter_EXTRALIBS}" \ + libavformat_extralibs="${LIBavformat_EXTRALIBS}" \ + libavutil_extralibs="${LIBavutil_EXTRALIBS}" \ + libpostproc_extralibs="${LIBpostproc_EXTRALIBS}" \ + libswresample_extralibs="${LIBswresample_EXTRALIBS}" \ + libswscale_extralibs="${LIBswscale_EXTRALIBS}" \ + libavcodec_linkflags="-Wl,-rpath-link,${LOCALBASE}/lib" \ + libavdevice_linkflags="-Wl,-rpath-link,${LOCALBASE}/lib:${X11BASE}/lib" \ + libavfilter_linkflags="-Wl,-rpath-link,${LOCALBASE}/lib:${X11BASE}/lib" \ + libavformat_linkflags="-Wl,-rpath-link,${LOCALBASE}/lib" \ + libavutil_linkflags="" \ + libpostproc_linkflags="" \ + libswresample_linkflags="" \ + libswscale_linkflags="" \ + libavcodec_requires="libswresample libavutil" \ + libavdevice_requires="libavfilter libswscale libpostproc libavformat libavcodec libswresample libavutil" \ + libavfilter_requires="libswscale libpostproc libavformat libavcodec libswresample libavutil" \ + libavformat_requires="libavcodec libswresample libavutil" \ + libavutil_requires="" \ + libpostproc_requires="libavutil" \ + libswresample_requires="libavutil" \ + libswscale_requires="libavutil" + +VERSION_FLAGS= libavcodec_VERSION=${LIBavcodec_VERSION} \ + libavdevice_VERSION=${LIBavdevice_VERSION} \ + libavfilter_VERSION=${LIBavfilter_VERSION} \ + libavformat_VERSION=${LIBavformat_VERSION} \ + libavutil_VERSION=${LIBavutil_VERSION} \ + libpostproc_VERSION=${LIBpostproc_VERSION} \ + libswresample_VERSION=${LIBswresample_VERSION} \ + libswscale_VERSION=${LIBswscale_VERSION} + +MAKE_FLAGS= ${VERSION_FLAGS} \ + LIBavcodec_EXTRALIBS="-lswresample -lavutil ${LIBavcodec_EXTRALIBS}" \ + LIBavdevice_EXTRALIBS="-lavfilter -lswscale -lpostproc -lavformat -lavcodec -lswresample -lavutil ${LIBavdevice_EXTRALIBS}" \ + LIBavfilter_EXTRALIBS="-lswscale -lpostproc -lavformat -lavcodec -lswresample -lavutil ${LIBavfilter_EXTRALIBS}" \ + LIBavformat_EXTRALIBS="-lavcodec -lswresample -lavutil ${LIBavformat_EXTRALIBS}" \ + LIBavutil_EXTRALIBS="${LIBavutil_EXTRALIBS}" \ + LIBpostproc_EXTRALIBS="-lavutil ${LIBpostproc_EXTRALIBS}" \ + LIBswresample_EXTRALIBS="-lavutil ${LIBswresample_EXTRALIBS}" \ + LIBswscale_EXTRALIBS="-lavutil ${LIBswscale_EXTRALIBS}" +FAKE_FLAGS= ${VERSION_FLAGS} \ + LDCONFIG=true + +ALL_TARGET= all tools/qt-faststart +TEST_TARGET= check + +.for _l in avutil avfilter avcodec avformat avdevice swscale swresample postproc +TEST_LIB_PATH:= ${TEST_LIB_PATH}:${WRKBUILD}/lib${_l} +.endfor +TEST_ENV+= LD_LIBRARY_PATH=${TEST_LIB_PATH:C/^://} + +HTML_DOCS= developer faq ffmpeg ffplay ffprobe general libavfilter + +post-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/ffmpeg + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/ffmpeg + ${INSTALL_PROGRAM} ${WRKBUILD}/tools/qt-faststart ${PREFIX}/bin +.for doc in ${HTML_DOCS} + ${INSTALL_DATA} ${WRKBUILD}/doc/${doc}.html ${PREFIX}/share/doc/ffmpeg +.endfor + mv -f ${PREFIX}/share/ffmpeg/examples/* ${PREFIX}/share/examples/ffmpeg + -rmdir ${PREFIX}/share/ffmpeg/examples + +.include <bsd.port.mk> diff --git a/graphics/ffmpeg/distinfo b/graphics/ffmpeg/distinfo @@ -0,0 +1,2 @@ +SHA256 (ffmpeg-4.4.4.tar.xz) = 6As4DVlcgJBg9m+WpdhJUR70p2omt26s9XeLlMNXAwk= +SIZE (ffmpeg-4.4.4.tar.xz) = 9565584 diff --git a/graphics/ffmpeg/patches/CVS/Entries b/graphics/ffmpeg/patches/CVS/Entries @@ -0,0 +1,25 @@ +/patch-ffbuild_library_mak/1.2/Sat Mar 12 08:16:31 2022// +/patch-ffbuild_pkgconfig_generate_sh/1.2/Sat Mar 12 08:16:31 2022// +/patch-libavcodec_aacenc_c/1.25/Sat Mar 12 08:16:31 2022// +/patch-libavformat_rtpproto_c/1.2/Sat Mar 12 08:16:31 2022// +/patch-libavformat_udp_c/1.2/Sat Mar 12 08:16:31 2022// +/patch-libswscale_ppc_yuv2rgb_altivec_c/1.2/Sat Mar 12 08:16:31 2022// +/patch-doc_encoders_texi/1.7/Fri May 13 17:17:34 2022// +/patch-libavcodec_version_h/1.1/Fri May 13 12:56:19 2022// +/patch-libavcodec_libaomenc_c/1.5/Sat Aug 20 17:16:46 2022// +/patch-configure/1.72/Mon Dec 5 08:18:47 2022// +/patch-libavcodec_libsvtav1_c/1.3/Mon Dec 5 18:17:28 2022// +/patch-libavcodec_aarch64_fft_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_h264idct_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_mdct_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_simple_idct_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_synth_filter_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_vp9itxfm_16bpp_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_vp9itxfm_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_vp9lpf_16bpp_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_aarch64_vp9lpf_neon_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavutil_aarch64_asm_S/1.1/Sat Jun 17 22:19:43 2023// +/patch-libavcodec_x86_fft_asm/1.2/Wed Jun 21 17:19:19 2023// +/patch-libavutil_x86_x86inc_asm/1.3/Wed Jun 21 12:58:18 2023// +/patch-libavformat_utils_c/1.7/Tue Dec 19 18:19:46 2023// +D diff --git a/graphics/ffmpeg/patches/CVS/Repository b/graphics/ffmpeg/patches/CVS/Repository @@ -0,0 +1 @@ +ports/graphics/ffmpeg/patches diff --git a/graphics/ffmpeg/patches/patch-configure b/graphics/ffmpeg/patches/patch-configure @@ -0,0 +1,81 @@ +- configure: use pkg-config for sndio +- configure: add initial RISC-V support +- Fix broken libatomic test + +Index: configure +--- configure.orig ++++ configure +@@ -1992,6 +1992,7 @@ ARCH_LIST=" + parisc + ppc + ppc64 ++ riscv + s390 + sh4 + sparc +@@ -2601,7 +2602,7 @@ for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); + done + + aligned_stack_if_any="aarch64 ppc x86" +-fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" ++fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 riscv64 sparc64 x86_64" + fast_clz_if_any="aarch64 alpha avr32 mips ppc x86" + fast_unaligned_if_any="aarch64 ppc x86" + simd_align_16_if_any="altivec neon sse" +@@ -4915,6 +4916,9 @@ case "$arch" in + "Power Macintosh"|ppc*|powerpc*) + arch="ppc" + ;; ++ riscv*) ++ arch="riscv" ++ ;; + s390|s390x) + arch="s390" + ;; +@@ -5306,6 +5310,10 @@ case "$arch" in + check_64bit ppc ppc64 + enabled shared && enable_weak pic + ;; ++ riscv) ++ check_64bit riscv32 riscv64 ++ enabled shared && enable_weak pic ++ ;; + s390) + check_64bit s390 s390x + enabled shared && enable_weak pic +@@ -5378,7 +5386,6 @@ case $target_os in + enable section_data_rel_ro + striptype="" + SHFLAGS='-shared' +- SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)' + SLIB_INSTALL_LINKS= + oss_indev_extralibs="-lossaudio" + oss_outdev_extralibs="-lossaudio" +@@ -5734,7 +5741,7 @@ set_default libdir + set_default $PATHS_LIST + set_default nm + +-disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer ++enabled x86_32 && check_cflags -fomit-frame-pointer + + enable_weak_pic() { + disabled pic && return +@@ -6189,7 +6196,7 @@ check_headers asm/types.h + # + # some configurations also require linking to libatomic, so try + # both with -latomic and without +-for LATOMIC in "-latomic" ""; do ++for LATOMIC in "" "-latomic"; do + check_builtin stdatomic stdatomic.h \ + "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar" \ + $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break +@@ -6657,7 +6664,8 @@ enabled alsa && { check_pkg_config alsa alsa "alsa/aso + enabled libjack && + require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range + +-enabled sndio && check_lib sndio sndio.h sio_open -lsndio ++enabled sndio && { check_pkg_config sndio sndio "sndio.h" sio_open || ++ check_lib sndio sndio.h sio_open -lsndio; } + + if enabled libcdio; then + check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open || diff --git a/graphics/ffmpeg/patches/patch-doc_encoders_texi b/graphics/ffmpeg/patches/patch-doc_encoders_texi @@ -0,0 +1,103 @@ +- doc/encoders: update default coder for aac +- doc/encoders: add available values for libsvtav1 options +- avcodec/libsvtav1: add a svtav1-params option to pass a list of key=value + parameters +- avcodec/libsvtav1: update some options and defaults + +Index: doc/encoders.texi +--- doc/encoders.texi.orig ++++ doc/encoders.texi +@@ -53,7 +53,7 @@ Set AAC encoder coding method. Possible values: + + @table @samp + @item twoloop +-Two loop searching (TLS) method. ++Two loop searching (TLS) method. This is the default method. + + This method first sets quantizers depending on band thresholds and then tries + to find an optimal combination by adding or subtracting a specific value from +@@ -75,7 +75,6 @@ Constant quantizer method. + Uses a cheaper version of twoloop algorithm that doesn't try to do as many + clever adjustments. Worse with low bitrates (less than 64kbps), but is better + and much faster at higher bitrates. +-This is the default choice for a coder + + @end table + +@@ -1747,27 +1746,29 @@ You need to explicitly configure the build with @code{ + @table @option + @item profile + Set the encoding profile. ++@table @samp ++@item main ++@item high ++@item professional ++@end table + + @item level +-Set the operating point level. ++Set the operating point level. For example: '4.0' + ++@item hielevel ++Set the Hierarchical prediction levels. ++@table @samp ++@item 3level ++@item 4level ++This is the default. ++@end table ++ + @item tier + Set the operating point tier. +- +-@item rc +-Set the rate control mode to use. +- +-Possible modes: +-@table @option +-@item cqp +-Constant quantizer: use fixed values of qindex (dependent on the frame type) +-throughout the stream. This mode is the default. +- +-@item vbr +-Variable bitrate: use a target bitrate for the whole stream. +- +-@item cvbr +-Constrained variable bitrate: use a target bitrate for each GOP. ++@table @samp ++@item main ++This is the default. ++@item high + @end table + + @item qmax +@@ -1776,6 +1777,9 @@ Set the maximum quantizer to use when using a bitrate + @item qmin + Set the minimum quantizer to use when using a bitrate mode. + ++@item crf ++Constant rate factor value used in crf rate control mode (0-63). ++ + @item qp + Set the quantizer used in cqp rate control mode (0-63). + +@@ -1786,14 +1790,18 @@ Enable scene change detection. + Set number of frames to look ahead (0-120). + + @item preset +-Set the quality-speed tradeoff, in the range 0 to 8. Higher values are +-faster but lower quality. Defaults to 8 (highest speed). ++Set the quality-speed tradeoff, in the range 0 to 13. Higher values are ++faster but lower quality. + + @item tile_rows + Set log2 of the number of rows of tiles to use (0-6). + + @item tile_columns + Set log2 of the number of columns of tiles to use (0-4). ++ ++@item svtav1-params ++Set SVT-AV1 options using a list of @var{key}=@var{value} pairs separated ++by ":". See the SVT-AV1 encoder user guide for a list of accepted parameters. + + @end table + diff --git a/graphics/ffmpeg/patches/patch-ffbuild_library_mak b/graphics/ffmpeg/patches/patch-ffbuild_library_mak @@ -0,0 +1,21 @@ +Index: ffbuild/library.mak +--- ffbuild/library.mak.orig ++++ ffbuild/library.mak +@@ -50,7 +50,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) + + $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver + $(SLIB_CREATE_DEF_CMD) +- $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS) ++ $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(LIB$(NAME)_EXTRALIBS) + $(SLIB_EXTRA_CMD) + + ifdef SUBDIR +@@ -64,8 +64,6 @@ clean:: + install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME) + $(Q)mkdir -p "$(SHLIBDIR)" + $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)" +- $$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)" +- $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),(cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F));) + $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)") + $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)") + $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)") diff --git a/graphics/ffmpeg/patches/patch-ffbuild_pkgconfig_generate_sh b/graphics/ffmpeg/patches/patch-ffbuild_pkgconfig_generate_sh @@ -0,0 +1,33 @@ +Index: ffbuild/pkgconfig_generate.sh +--- ffbuild/pkgconfig_generate.sh.orig ++++ ffbuild/pkgconfig_generate.sh +@@ -12,7 +12,7 @@ shortname=$1 + name=lib${shortname} + fullname=${name}${build_suffix} + comment=$2 +-libs=$(eval echo \$extralibs_${shortname}) ++libs=$(eval echo \$${name}_extralibs) + deps=$(eval echo \$${shortname}_deps) + + for dep in $deps; do +@@ -20,9 +20,9 @@ for dep in $deps; do + fulldepname=${depname}${build_suffix} + . ${depname}/${depname}.version + depversion=$(eval echo \$${depname}_VERSION) +- requires="$requires ${fulldepname} >= ${depversion}, " + done +-requires=${requires%, } ++requires=$(eval echo \$${name}_requires) ++linkflags=$(eval echo \$${name}_linkflags) + + version=$(grep ${name}_VERSION= $name/${name}.version | cut -d= -f2) + +@@ -38,7 +38,7 @@ Version: $version + Requires: $($shared || echo $requires) + Requires.private: $($shared && echo $requires) + Conflicts: +-Libs: -L\${libdir} $rpath -l${fullname#lib} $($shared || echo $libs) ++Libs: -L\${libdir} $rpath -l${fullname#lib} $($shared || echo $libs) $linkflags + Libs.private: $($shared && echo $libs) + Cflags: -I\${includedir} + EOF diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aacenc_c b/graphics/ffmpeg/patches/patch-libavcodec_aacenc_c @@ -0,0 +1,14 @@ +aacenc: make the twoloop coder the default + +Index: libavcodec/aacenc.c +--- libavcodec/aacenc.c.orig ++++ libavcodec/aacenc.c +@@ -1104,7 +1104,7 @@ static av_cold int aac_encode_init(AVCodecContext *avc + + #define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM + static const AVOption aacenc_options[] = { +- {"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_FAST}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"}, ++ {"aac_coder", "Coding algorithm", offsetof(AACEncContext, options.coder), AV_OPT_TYPE_INT, {.i64 = AAC_CODER_TWOLOOP}, 0, AAC_CODER_NB-1, AACENC_FLAGS, "coder"}, + {"anmr", "ANMR method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_ANMR}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, + {"twoloop", "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, + {"fast", "Default fast search", 0, AV_OPT_TYPE_CONST, {.i64 = AAC_CODER_FAST}, INT_MIN, INT_MAX, AACENC_FLAGS, "coder"}, diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_fft_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_fft_neon_S @@ -0,0 +1,44 @@ +Index: libavcodec/aarch64/fft_neon.S +--- libavcodec/aarch64/fft_neon.S.orig ++++ libavcodec/aarch64/fft_neon.S +@@ -36,6 +36,7 @@ + + + function fft4_neon ++ AARCH64_VALID_JUMP_TARGET + ld1 {v0.2s,v1.2s,v2.2s,v3.2s}, [x0] + + fadd v4.2s, v0.2s, v1.2s // r0+r1,i0+i1 +@@ -58,6 +59,7 @@ function fft4_neon + endfunc + + function fft8_neon ++ AARCH64_VALID_JUMP_TARGET + mov x1, x0 + ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32 + ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0] +@@ -108,6 +110,7 @@ function fft8_neon + endfunc + + function fft16_neon ++ AARCH64_VALID_JUMP_TARGET + mov x1, x0 + ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32 + ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0], #32 +@@ -337,6 +340,8 @@ endfunc + + .macro def_fft n, n2, n4 + function fft\n\()_neon, align=6 ++ AARCH64_VALID_JUMP_TARGET ++ AARCH64_SIGN_LINK_REGISTER + sub sp, sp, #16 + stp x28, x30, [sp] + add x28, x0, #\n4*2*8 +@@ -347,6 +352,7 @@ function fft\n\()_neon, align=6 + bl fft\n4\()_neon + sub x0, x28, #\n4*2*8 + ldp x28, x30, [sp], #16 ++ AARCH64_VALIDATE_LINK_REGISTER + movrel x4, X(ff_cos_\n) + mov x2, #\n4>>1 + b fft_pass_neon diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_h264idct_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_h264idct_neon_S @@ -0,0 +1,35 @@ +Index: libavcodec/aarch64/h264idct_neon.S +--- libavcodec/aarch64/h264idct_neon.S.orig ++++ libavcodec/aarch64/h264idct_neon.S +@@ -24,6 +24,7 @@ + + function ff_h264_idct_add_neon, export=1 + .L_ff_h264_idct_add_neon: ++ AARCH64_VALID_CALL_TARGET + ld1 {v0.4H, v1.4H, v2.4H, v3.4H}, [x1] + sxtw x2, w2 + movi v30.8H, #0 +@@ -79,6 +80,7 @@ endfunc + + function ff_h264_idct_dc_add_neon, export=1 + .L_ff_h264_idct_dc_add_neon: ++ AARCH64_VALID_CALL_TARGET + sxtw x2, w2 + mov w3, #0 + ld1r {v2.8H}, [x1] +@@ -266,6 +268,7 @@ endfunc + + function ff_h264_idct8_add_neon, export=1 + .L_ff_h264_idct8_add_neon: ++ AARCH64_VALID_CALL_TARGET + movi v19.8H, #0 + sxtw x2, w2 + ld1 {v24.8H, v25.8H}, [x1] +@@ -330,6 +333,7 @@ endfunc + + function ff_h264_idct8_dc_add_neon, export=1 + .L_ff_h264_idct8_dc_add_neon: ++ AARCH64_VALID_CALL_TARGET + mov w3, #0 + sxtw x2, w2 + ld1r {v31.8H}, [x1] diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_mdct_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_mdct_neon_S @@ -0,0 +1,61 @@ +Index: libavcodec/aarch64/mdct_neon.S +--- libavcodec/aarch64/mdct_neon.S.orig ++++ libavcodec/aarch64/mdct_neon.S +@@ -25,6 +25,7 @@ + function ff_imdct_half_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] ++ AARCH64_SIGN_LINK_REGISTER + str x30, [sp, #16] + mov x12, #1 + ldr w14, [x0, #28] // mdct_bits +@@ -121,6 +122,7 @@ function ff_imdct_half_neon, export=1 + + ldp x19, x20, [sp] + ldr x30, [sp, #16] ++ AARCH64_VALIDATE_LINK_REGISTER + add sp, sp, #32 + + ret +@@ -129,6 +131,7 @@ endfunc + function ff_imdct_calc_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] ++ AARCH64_SIGN_LINK_REGISTER + str x30, [sp, #16] + ldr w3, [x0, #28] // mdct_bits + mov x19, #1 +@@ -160,8 +163,10 @@ function ff_imdct_calc_neon, export=1 + subs x19, x19, #16 + b.gt 1b + +- ldp x19, x20, [sp], #16 +- ldr x30, [sp], #16 ++ ldp x19, x20, [sp] ++ ldr x30, [sp, #16] ++ AARCH64_VALIDATE_LINK_REGISTER ++ add sp, sp, #32 + + ret + endfunc +@@ -170,6 +175,7 @@ endfunc + function ff_mdct_calc_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] ++ AARCH64_SIGN_LINK_REGISTER + str x30, [sp, #16] + + mov x12, #1 +@@ -317,7 +323,10 @@ function ff_mdct_calc_neon, export=1 + st2 {v4.2s,v5.2s}, [x0] + st2 {v6.2s,v7.2s}, [x8] + +- ldp x19, x20, [sp], #16 +- ldr x30, [sp], #16 ++ ldp x19, x20, [sp] ++ ldr x30, [sp, #16] ++ AARCH64_VALIDATE_LINK_REGISTER ++ add sp, sp, #32 ++ + ret + endfunc diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_simple_idct_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_simple_idct_neon_S @@ -0,0 +1,12 @@ +Index: libavcodec/aarch64/simple_idct_neon.S +--- libavcodec/aarch64/simple_idct_neon.S.orig ++++ libavcodec/aarch64/simple_idct_neon.S +@@ -58,7 +58,7 @@ endconst + .endm + + .macro idct_end +- br x10 ++ ret x10 + .endm + + .macro smull1 a, b, c diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_synth_filter_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_synth_filter_neon_S @@ -0,0 +1,19 @@ +Index: libavcodec/aarch64/synth_filter_neon.S +--- libavcodec/aarch64/synth_filter_neon.S.orig ++++ libavcodec/aarch64/synth_filter_neon.S +@@ -52,6 +52,7 @@ function ff_synth_filter_float_neon, export=1 + stp x5, x1, [sp, #16] + and x7, x7, #~63 + and w8, w8, #511 ++ AARCH64_SIGN_LINK_REGISTER + stp x7, x30, [sp, #32] + str w8, [x2] + str s0, [sp, #48] +@@ -63,6 +64,7 @@ function ff_synth_filter_float_neon, export=1 + ldp x2, x4, [sp] // synct_buf_2, window + ldp x13, x9, [sp, #16] // out, synth_buf + ldp x0, x30, [sp, #32] // *synth_buf_offset ++ AARCH64_VALIDATE_LINK_REGISTER + ldr s0, [sp, #48] + + add x3, x2, #16*4 // synct_buf_2 + 16 diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9itxfm_16bpp_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9itxfm_16bpp_neon_S @@ -0,0 +1,129 @@ +Index: libavcodec/aarch64/vp9itxfm_16bpp_neon.S +--- libavcodec/aarch64/vp9itxfm_16bpp_neon.S.orig ++++ libavcodec/aarch64/vp9itxfm_16bpp_neon.S +@@ -1040,7 +1040,7 @@ function \txfm\()16_1d_4x16_pass1_neon + .irp i, 16, 20, 24, 28, 17, 21, 25, 29, 18, 22, 26, 30, 19, 23, 27, 31 + store \i, x0, #16 + .endr +- br x14 ++ ret x14 + 1: + // Special case: For the last input column (x1 == 12), + // which would be stored as the last row in the temp buffer, +@@ -1068,7 +1068,7 @@ function \txfm\()16_1d_4x16_pass1_neon + mov v29.16b, v17.16b + mov v30.16b, v18.16b + mov v31.16b, v19.16b +- br x14 ++ ret x14 + endfunc + + // Read a vertical 4x16 slice out of a 16x16 matrix, do a transform on it, +@@ -1098,7 +1098,7 @@ function \txfm\()16_1d_4x16_pass2_neon + load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s + load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s + +- br x14 ++ ret x14 + endfunc + .endm + +@@ -1208,7 +1208,7 @@ function vp9_\txfm1\()_\txfm2\()_16x16_add_16_neon + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 + .endif +- br x15 ++ ret x15 + endfunc + + function ff_vp9_\txfm1\()_\txfm2\()_16x16_add_10_neon, export=1 +@@ -1264,7 +1264,7 @@ function idct16_1d_4x16_pass1_quarter_neon + st1 {v23.4s}, [x0], #16 + st1 {v27.4s}, [x0], #16 + st1 {v31.4s}, [x0], #16 +- br x14 ++ ret x14 + endfunc + + function idct16_1d_4x16_pass2_quarter_neon +@@ -1286,7 +1286,7 @@ function idct16_1d_4x16_pass2_quarter_neon + load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s + load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s + +- br x14 ++ ret x14 + endfunc + + function idct16_1d_4x16_pass1_half_neon +@@ -1313,7 +1313,7 @@ function idct16_1d_4x16_pass1_half_neon + .irp i, 16, 20, 24, 28, 17, 21, 25, 29, 18, 22, 26, 30, 19, 23, 27, 31 + store \i, x0, #16 + .endr +- br x14 ++ ret x14 + 1: + // Special case: For the second input column (r1 == 4), + // which would be stored as the second row in the temp buffer, +@@ -1341,7 +1341,7 @@ function idct16_1d_4x16_pass1_half_neon + mov v21.16b, v17.16b + mov v22.16b, v18.16b + mov v23.16b, v19.16b +- br x14 ++ ret x14 + endfunc + + function idct16_1d_4x16_pass2_half_neon +@@ -1364,7 +1364,7 @@ function idct16_1d_4x16_pass2_half_neon + load_add_store v16.4s, v17.4s, v18.4s, v19.4s, v20.4s, v21.4s, v22.4s, v23.4s + load_add_store v24.4s, v25.4s, v26.4s, v27.4s, v28.4s, v29.4s, v30.4s, v31.4s + +- br x14 ++ ret x14 + endfunc + + .macro idct16_partial size +@@ -1390,7 +1390,7 @@ function idct16x16_\size\()_add_16_neon + + add sp, sp, #1024 + ldp d8, d9, [sp], 0x10 +- br x15 ++ ret x15 + endfunc + .endm + +@@ -1729,7 +1729,7 @@ function idct32_1d_4x32_pass1\suffix\()_neon + store_rev v29.4s, v25.4s, v21.4s, v17.4s, v29.16b, v25.16b + store_rev v28.4s, v24.4s, v20.4s, v16.4s, v28.16b, v24.16b + .purgem store_rev +- br x14 ++ ret x14 + endfunc + + // This is mostly the same as 4x32_pass1, but without the transpose, +@@ -1849,7 +1849,7 @@ function idct32_1d_4x32_pass2\suffix\()_neon + load_acc_store v24.4s, v25.4s, v26.4s, v27.4s, 1 + load_acc_store v28.4s, v29.4s, v30.4s, v31.4s, 1 + .purgem load_acc_store +- br x14 ++ ret x14 + endfunc + .endm + +@@ -1943,7 +1943,7 @@ function vp9_idct_idct_32x32_add_16_neon + ldp d10, d11, [sp], 0x10 + ldp d8, d9, [sp], 0x10 + +- br x15 ++ ret x15 + endfunc + + function ff_vp9_idct_idct_32x32_add_10_neon, export=1 +@@ -2009,7 +2009,7 @@ function idct32x32_\size\()_add_16_neon + ldp d10, d11, [sp], 0x10 + ldp d8, d9, [sp], 0x10 + +- br x15 ++ ret x15 + endfunc + .endm + diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9itxfm_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9itxfm_neon_S @@ -0,0 +1,120 @@ +Index: libavcodec/aarch64/vp9itxfm_neon.S +--- libavcodec/aarch64/vp9itxfm_neon.S.orig ++++ libavcodec/aarch64/vp9itxfm_neon.S +@@ -787,7 +787,7 @@ function \txfm\()16_1d_8x16_pass1_neon + .irp i, 16, 24, 17, 25, 18, 26, 19, 27, 20, 28, 21, 29, 22, 30, 23, 31 + store \i, x0, #16 + .endr +- br x14 ++ ret x14 + 1: + // Special case: For the last input column (x1 == 8), + // which would be stored as the last row in the temp buffer, +@@ -806,7 +806,7 @@ function \txfm\()16_1d_8x16_pass1_neon + mov v29.16b, v21.16b + mov v30.16b, v22.16b + mov v31.16b, v23.16b +- br x14 ++ ret x14 + endfunc + + // Read a vertical 8x16 slice out of a 16x16 matrix, do a transform on it, +@@ -834,7 +834,7 @@ function \txfm\()16_1d_8x16_pass2_neon + load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b + load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b + +- br x14 ++ ret x14 + endfunc + .endm + +@@ -925,7 +925,7 @@ function ff_vp9_\txfm1\()_\txfm2\()_16x16_add_neon, ex + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 + .endif +- br x15 ++ ret x15 + endfunc + .endm + +@@ -960,7 +960,7 @@ function idct16_1d_8x16_pass1_quarter_neon + .irp i, 24, 25, 26, 27 + store \i, x0, x9 + .endr +- br x14 ++ ret x14 + endfunc + + function idct16_1d_8x16_pass2_quarter_neon +@@ -978,7 +978,7 @@ function idct16_1d_8x16_pass2_quarter_neon + load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b + load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b + +- br x14 ++ ret x14 + endfunc + + function idct16_1d_8x16_pass1_half_neon +@@ -1003,7 +1003,7 @@ function idct16_1d_8x16_pass1_half_neon + .irp i, 24, 25, 26, 27, 28, 29, 30, 31 + store \i, x0, x9 + .endr +- br x14 ++ ret x14 + endfunc + + function idct16_1d_8x16_pass2_half_neon +@@ -1021,7 +1021,7 @@ function idct16_1d_8x16_pass2_half_neon + load_add_store v16.8h, v17.8h, v18.8h, v19.8h, v20.8h, v21.8h, v22.8h, v23.8h, v16.8b, v17.8b + load_add_store v24.8h, v25.8h, v26.8h, v27.8h, v28.8h, v29.8h, v30.8h, v31.8h, v16.8b, v17.8b + +- br x14 ++ ret x14 + endfunc + + .macro idct16_partial size +@@ -1038,7 +1038,7 @@ function idct16x16_\size\()_add_neon + .endr + + add sp, sp, #512 +- br x15 ++ ret x15 + endfunc + .endm + +@@ -1349,7 +1349,7 @@ function idct32_1d_8x32_pass1\suffix\()_neon + store_rev v25.8h, v17.8h + store_rev v24.8h, v16.8h + .purgem store_rev +- br x14 ++ ret x14 + endfunc + + // This is mostly the same as 8x32_pass1, but without the transpose, +@@ -1466,7 +1466,7 @@ function idct32_1d_8x32_pass2\suffix\()_neon + load_acc_store v24.8h, v25.8h, v26.8h, v27.8h, 1 + load_acc_store v28.8h, v29.8h, v30.8h, v31.8h, 1 + .purgem load_acc_store +- br x14 ++ ret x14 + endfunc + .endm + +@@ -1547,7 +1547,7 @@ function ff_vp9_idct_idct_32x32_add_neon, export=1 + ldp d8, d9, [sp], 0x10 + ldp d10, d11, [sp], 0x10 + +- br x15 ++ ret x15 + endfunc + + .macro idct32_partial size +@@ -1572,7 +1572,7 @@ function idct32x32_\size\()_add_neon + ldp d8, d9, [sp], 0x10 + ldp d10, d11, [sp], 0x10 + +- br x15 ++ ret x15 + endfunc + .endm + diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9lpf_16bpp_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9lpf_16bpp_neon_S @@ -0,0 +1,174 @@ +Index: libavcodec/aarch64/vp9lpf_16bpp_neon.S +--- libavcodec/aarch64/vp9lpf_16bpp_neon.S.orig ++++ libavcodec/aarch64/vp9lpf_16bpp_neon.S +@@ -69,7 +69,7 @@ + mov x12, v4.d[1] + adds x11, x11, x12 + b.ne 1f +- br x10 ++ ret x10 + 1: + + .if \wd >= 8 +@@ -205,7 +205,7 @@ + b.eq 6f + .else + b.ne 1f +- br x13 ++ ret x13 + 1: + .endif + +@@ -264,7 +264,7 @@ + b.ne 1f + // If no pixels needed flat8in nor flat8out, jump to a + // writeout of the inner 4 pixels +- br x14 ++ ret x14 + 1: + + mov x11, v7.d[0] +@@ -272,7 +272,7 @@ + adds x11, x11, x12 + b.ne 1f + // If no pixels need flat8out, jump to a writeout of the inner 6 pixels +- br x15 ++ ret x15 + + 1: + // flat8out +@@ -446,7 +446,7 @@ function ff_\func\()_\bpp\()_neon, export=1 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x16 ++ ret x16 + .else + b \func\()_16_neon + .endif +@@ -486,7 +486,7 @@ function ff_\func\()_\suffix\()_\bpp\()_neon, export=1 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 + .endif +- br x16 ++ ret x16 + endfunc + .endm + +@@ -520,7 +520,7 @@ function ff_vp9_loop_filter_\dir\()_\wd1\()\wd2\()_16_ + lsl w3, w14, #\bpp - 8 + lsl w4, w15, #\bpp - 8 + bl vp9_loop_filter_\dir\()_\wd2\()_8_16_neon +- br x16 ++ ret x16 + endfunc + .endm + +@@ -553,7 +553,7 @@ function vp9_loop_filter_v_4_8_16_neon + st1 {v25.8h}, [x0], x1 + sub x0, x0, x1, lsl #1 + +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_v_4_8 +@@ -601,7 +601,7 @@ function vp9_loop_filter_h_4_8_16_neon + sub x0, x0, x1, lsl #3 + add x0, x0, #4 + +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_h_4_8 +@@ -632,7 +632,7 @@ function vp9_loop_filter_v_8_8_16_neon + sub x0, x0, x1, lsl #1 + sub x0, x0, x1 + +- br x10 ++ ret x10 + 6: + sub x9, x0, x1, lsl #1 + st1 {v22.8h}, [x9], x1 +@@ -640,7 +640,7 @@ function vp9_loop_filter_v_8_8_16_neon + st1 {v23.8h}, [x9], x1 + st1 {v25.8h}, [x0], x1 + sub x0, x0, x1, lsl #1 +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_v_8_8 +@@ -683,7 +683,7 @@ function vp9_loop_filter_h_8_8_16_neon + sub x0, x0, x1, lsl #3 + add x0, x0, #8 + +- br x10 ++ ret x10 + 6: + // If we didn't need to do the flat8in part, we use the same writeback + // as in loop_filter_h_4_8. +@@ -700,7 +700,7 @@ function vp9_loop_filter_h_8_8_16_neon + st1 {v25.d}[1], [x0], x1 + sub x0, x0, x1, lsl #3 + add x0, x0, #4 +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_h_8_8 +@@ -755,7 +755,7 @@ function vp9_loop_filter_v_16_8_16_neon + sub x0, x0, x1, lsl #3 + add x0, x0, x1 + +- br x10 ++ ret x10 + 8: + add x9, x9, x1, lsl #2 + // If we didn't do the flat8out part, the output is left in the +@@ -768,7 +768,7 @@ function vp9_loop_filter_v_16_8_16_neon + st1 {v26.8h}, [x0], x1 + sub x0, x0, x1, lsl #1 + sub x0, x0, x1 +- br x10 ++ ret x10 + 7: + sub x9, x0, x1, lsl #1 + st1 {v22.8h}, [x9], x1 +@@ -776,7 +776,7 @@ function vp9_loop_filter_v_16_8_16_neon + st1 {v23.8h}, [x9], x1 + st1 {v25.8h}, [x0], x1 + sub x0, x0, x1, lsl #1 +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_v_16_8, push=1 +@@ -833,7 +833,7 @@ function vp9_loop_filter_h_16_8_16_neon + st1 {v31.8h}, [x0], x1 + sub x0, x0, x1, lsl #3 + +- br x10 ++ ret x10 + 8: + // The same writeback as in loop_filter_h_8_8 + sub x9, x0, #8 +@@ -850,7 +850,7 @@ function vp9_loop_filter_h_16_8_16_neon + st1 {v27.8h}, [x0], x1 + sub x0, x0, x1, lsl #3 + add x0, x0, #8 +- br x10 ++ ret x10 + 7: + // The same writeback as in loop_filter_h_4_8 + sub x9, x0, #4 +@@ -866,7 +866,7 @@ function vp9_loop_filter_h_16_8_16_neon + st1 {v25.d}[1], [x0], x1 + sub x0, x0, x1, lsl #3 + add x0, x0, #4 +- br x10 ++ ret x10 + endfunc + + bpp_frontends vp9_loop_filter_h_16_8, push=1 diff --git a/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9lpf_neon_S b/graphics/ffmpeg/patches/patch-libavcodec_aarch64_vp9lpf_neon_S @@ -0,0 +1,220 @@ +Index: libavcodec/aarch64/vp9lpf_neon.S +--- libavcodec/aarch64/vp9lpf_neon.S.orig ++++ libavcodec/aarch64/vp9lpf_neon.S +@@ -399,7 +399,7 @@ + .endif + // If no pixels needed flat8in nor flat8out, jump to a + // writeout of the inner 4 pixels +- br x14 ++ ret x14 + 1: + + mov x5, v7.d[0] +@@ -411,7 +411,7 @@ + cbnz x5, 1f + .endif + // If no pixels need flat8out, jump to a writeout of the inner 6 pixels +- br x15 ++ ret x15 + + 1: + // flat8out +@@ -532,32 +532,32 @@ function vp9_loop_filter_4 + loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31 + ret + 9: +- br x10 ++ ret x10 + endfunc + + function vp9_loop_filter_4_16b_mix_44 + loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31 + ret + 9: +- br x10 ++ ret x10 + endfunc + + function vp9_loop_filter_8 + loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31 + ret + 6: +- br x13 ++ ret x13 + 9: +- br x10 ++ ret x10 + endfunc + + function vp9_loop_filter_8_16b_mix + loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31 + ret + 6: +- br x13 ++ ret x13 + 9: +- br x10 ++ ret x10 + endfunc + + function vp9_loop_filter_16 +@@ -568,7 +568,7 @@ function vp9_loop_filter_16 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + endfunc + + function vp9_loop_filter_16_16b +@@ -579,7 +579,7 @@ function vp9_loop_filter_16_16b + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + endfunc + + .macro loop_filter_4 +@@ -648,7 +648,7 @@ function ff_vp9_loop_filter_v_4_8_neon, export=1 + st1 {v23.8b}, [x9], x1 + st1 {v25.8b}, [x0], x1 + +- br x10 ++ ret x10 + endfunc + + function ff_vp9_loop_filter_v_44_16_neon, export=1 +@@ -672,7 +672,7 @@ function ff_vp9_loop_filter_v_44_16_neon, export=1 + st1 {v23.16b}, [x9], x1 + st1 {v25.16b}, [x0], x1 + +- br x10 ++ ret x10 + endfunc + + function ff_vp9_loop_filter_h_4_8_neon, export=1 +@@ -714,7 +714,7 @@ function ff_vp9_loop_filter_h_4_8_neon, export=1 + st1 {v25.s}[0], [x9], x1 + st1 {v25.s}[1], [x0], x1 + +- br x10 ++ ret x10 + endfunc + + function ff_vp9_loop_filter_h_44_16_neon, export=1 +@@ -766,7 +766,7 @@ function ff_vp9_loop_filter_h_44_16_neon, export=1 + st1 {v25.s}[1], [x9], x1 + st1 {v25.s}[3], [x0], x1 + +- br x10 ++ ret x10 + endfunc + + function ff_vp9_loop_filter_v_8_8_neon, export=1 +@@ -793,14 +793,14 @@ function ff_vp9_loop_filter_v_8_8_neon, export=1 + st1 {v23.8b}, [x9], x1 + st1 {v26.8b}, [x0], x1 + +- br x10 ++ ret x10 + 6: + sub x9, x0, x1, lsl #1 + st1 {v22.8b}, [x9], x1 + st1 {v24.8b}, [x0], x1 + st1 {v23.8b}, [x9], x1 + st1 {v25.8b}, [x0], x1 +- br x10 ++ ret x10 + endfunc + + .macro mix_v_16 mix +@@ -828,14 +828,14 @@ function ff_vp9_loop_filter_v_\mix\()_16_neon, export= + st1 {v23.16b}, [x9], x1 + st1 {v26.16b}, [x0], x1 + +- br x10 ++ ret x10 + 6: + sub x9, x0, x1, lsl #1 + st1 {v22.16b}, [x9], x1 + st1 {v24.16b}, [x0], x1 + st1 {v23.16b}, [x9], x1 + st1 {v25.16b}, [x0], x1 +- br x10 ++ ret x10 + endfunc + .endm + +@@ -876,7 +876,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1 + st1 {v23.8b}, [x9], x1 + st1 {v27.8b}, [x0], x1 + +- br x10 ++ ret x10 + 6: + // If we didn't need to do the flat8in part, we use the same writeback + // as in loop_filter_h_4_8. +@@ -891,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1 + st1 {v24.s}[1], [x0], x1 + st1 {v25.s}[0], [x9], x1 + st1 {v25.s}[1], [x0], x1 +- br x10 ++ ret x10 + endfunc + + .macro mix_h_16 mix +@@ -942,7 +942,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export= + st1 {v27.8b}, [x9], x1 + st1 {v27.d}[1], [x0], x1 + +- br x10 ++ ret x10 + 6: + add x9, x9, #2 + add x0, x0, #2 +@@ -963,7 +963,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export= + st1 {v24.s}[3], [x0], x1 + st1 {v25.s}[1], [x9], x1 + st1 {v25.s}[3], [x0], x1 +- br x10 ++ ret x10 + endfunc + .endm + +@@ -1022,7 +1022,7 @@ function ff_vp9_loop_filter_v_16_8_neon, export=1 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + 8: + add x9, x9, x1, lsl #2 + // If we didn't do the flat8out part, the output is left in the +@@ -1091,7 +1091,7 @@ function ff_vp9_loop_filter_v_16_16_neon, export=1 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + 8: + add x9, x9, x1, lsl #2 + st1 {v21.16b}, [x9], x1 +@@ -1168,7 +1168,7 @@ function ff_vp9_loop_filter_h_16_8_neon, export=1 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + 8: + // The same writeback as in loop_filter_h_8_8 + sub x9, x0, #4 +@@ -1287,7 +1287,7 @@ function ff_vp9_loop_filter_h_16_16_neon, export=1 + ldp d10, d11, [sp], 0x10 + ldp d12, d13, [sp], 0x10 + ldp d14, d15, [sp], 0x10 +- br x10 ++ ret x10 + 8: + sub x9, x0, #4 + add x0, x9, x1, lsl #3 diff --git a/graphics/ffmpeg/patches/patch-libavcodec_libaomenc_c b/graphics/ffmpeg/patches/patch-libavcodec_libaomenc_c @@ -0,0 +1,218 @@ +- lavc/aomenc: Force default qmax of 0 if crf was set to 0 +- avcodec/libaomenc: Avoid copying data, allow user-supplied buffers +- lavc/libaomenc: Show encoder config as a warning in case of failed initialization +- avcodec/libaomenc: use ctx->usage to get default cfg +- avcodec/libaomenc: remove the redundant initialization +- avcodec/libaomenc: Add unmet target level warning +- avcodec/libaomenc: Expose the allintra usage mode +- avcodec/libaomenc: Get number of operating points + +Index: libavcodec/libaomenc.c +--- libavcodec/libaomenc.c.orig ++++ libavcodec/libaomenc.c +@@ -36,6 +36,7 @@ + + #include "av1.h" + #include "avcodec.h" ++#include "encode.h" + #include "internal.h" + #include "packet_internal.h" + #include "profiles.h" +@@ -194,6 +195,15 @@ static const char *const ctlidstr[] = { + [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA", + [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS", + #endif ++#ifdef AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS ++ [AV1E_GET_NUM_OPERATING_POINTS] = "AV1E_GET_NUM_OPERATING_POINTS", ++#endif ++#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX ++ [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX", ++#endif ++#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX ++ [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX", ++#endif + }; + + static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) +@@ -208,10 +218,10 @@ static av_cold void log_encoder_error(AVCodecContext * + } + + static av_cold void dump_enc_cfg(AVCodecContext *avctx, +- const struct aom_codec_enc_cfg *cfg) ++ const struct aom_codec_enc_cfg *cfg, ++ int level) + { + int width = -30; +- int level = AV_LOG_DEBUG; + + av_log(avctx, level, "aom_codec_enc_cfg\n"); + av_log(avctx, level, "generic settings\n" +@@ -319,10 +329,73 @@ static av_cold int codecctl_int(AVCodecContext *avctx, + return 0; + } + ++#if defined(AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS) && \ ++ defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \ ++ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX) ++static av_cold int codecctl_intp(AVCodecContext *avctx, ++#ifdef UENUM1BYTE ++ aome_enc_control_id id, ++#else ++ enum aome_enc_control_id id, ++#endif ++ int* ptr) ++{ ++ AOMContext *ctx = avctx->priv_data; ++ char buf[80]; ++ int width = -30; ++ int res; ++ ++ snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]); ++ av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr); ++ ++ res = aom_codec_control(&ctx->encoder, id, ptr); ++ if (res != AOM_CODEC_OK) { ++ snprintf(buf, sizeof(buf), "Failed to set %s codec control", ++ ctlidstr[id]); ++ log_encoder_error(avctx, buf); ++ return AVERROR(EINVAL); ++ } ++ ++ return 0; ++} ++#endif ++ + static av_cold int aom_free(AVCodecContext *avctx) + { + AOMContext *ctx = avctx->priv_data; + ++#if defined(AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS) && \ ++ defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \ ++ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX) ++ if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) { ++ int num_operating_points; ++ int levels[32]; ++ int target_levels[32]; ++ ++ if (!codecctl_intp(avctx, AV1E_GET_NUM_OPERATING_POINTS, ++ &num_operating_points) && ++ !codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) && ++ !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX, ++ target_levels)) { ++ for (int i = 0; i < num_operating_points; i++) { ++ if (levels[i] > target_levels[i]) { ++ // Warn when the target level was not met ++ av_log(avctx, AV_LOG_WARNING, ++ "Could not encode to target level %d.%d for " ++ "operating point %d. The output level is %d.%d.\n", ++ 2 + (target_levels[i] >> 2), target_levels[i] & 3, ++ i, 2 + (levels[i] >> 2), levels[i] & 3); ++ } else if (target_levels[i] < 31) { ++ // Log the encoded level if a target level was given ++ av_log(avctx, AV_LOG_INFO, ++ "Output level for operating point %d is %d.%d.\n", ++ i, 2 + (levels[i] >> 2), levels[i] & 3); ++ } ++ } ++ } ++ } ++#endif ++ + aom_codec_destroy(&ctx->encoder); + av_freep(&ctx->twopass_stats.buf); + av_freep(&avctx->stats_out); +@@ -596,7 +669,7 @@ static av_cold int aom_init(AVCodecContext *avctx, + av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); + av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config()); + +- if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != AOM_CODEC_OK) { ++ if ((res = aom_codec_enc_config_default(iface, &enccfg, ctx->usage)) != AOM_CODEC_OK) { + av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", + aom_codec_err_to_string(res)); + return AVERROR(EINVAL); +@@ -611,7 +684,7 @@ static av_cold int aom_init(AVCodecContext *avctx, + return AVERROR(EINVAL); + } + +- dump_enc_cfg(avctx, &enccfg); ++ dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG); + + enccfg.g_w = avctx->width; + enccfg.g_h = avctx->height; +@@ -620,8 +693,6 @@ static av_cold int aom_init(AVCodecContext *avctx, + enccfg.g_threads = + FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64); + +- enccfg.g_usage = ctx->usage; +- + if (ctx->lag_in_frames >= 0) + enccfg.g_lag_in_frames = ctx->lag_in_frames; + +@@ -654,8 +725,11 @@ static av_cold int aom_init(AVCodecContext *avctx, + + if (avctx->qmin >= 0) + enccfg.rc_min_quantizer = avctx->qmin; +- if (avctx->qmax >= 0) ++ if (avctx->qmax >= 0) { + enccfg.rc_max_quantizer = avctx->qmax; ++ } else if (!ctx->crf) { ++ enccfg.rc_max_quantizer = 0; ++ } + + if (enccfg.rc_end_usage == AOM_CQ || enccfg.rc_end_usage == AOM_Q) { + if (ctx->crf < enccfg.rc_min_quantizer || ctx->crf > enccfg.rc_max_quantizer) { +@@ -742,13 +816,14 @@ static av_cold int aom_init(AVCodecContext *avctx, + if (res < 0) + return res; + +- dump_enc_cfg(avctx, &enccfg); + /* Construct Encoder Context */ + res = aom_codec_enc_init(&ctx->encoder, iface, &enccfg, flags); + if (res != AOM_CODEC_OK) { ++ dump_enc_cfg(avctx, &enccfg, AV_LOG_WARNING); + log_encoder_error(avctx, "Failed to initialize encoder"); + return AVERROR(EINVAL); + } ++ dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG); + + // codec control failures are currently treated only as warnings + av_log(avctx, AV_LOG_DEBUG, "aom_codec_control\n"); +@@ -943,7 +1018,6 @@ static inline void cx_pktcpy(AOMContext *ctx, + dst->sz = src->data.frame.sz; + dst->buf = src->data.frame.buf; + #ifdef AOM_FRAME_IS_INTRAONLY +- dst->have_sse = 0; + dst->frame_number = ++ctx->frame_number; + dst->have_sse = ctx->have_sse; + if (ctx->have_sse) { +@@ -967,7 +1041,7 @@ static int storeframe(AVCodecContext *avctx, struct Fr + { + AOMContext *ctx = avctx->priv_data; + int av_unused pict_type; +- int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, 0); ++ int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, + "Error getting output packet of size %"SIZE_SPECIFIER".\n", cx_frame->sz); +@@ -1282,6 +1356,7 @@ static const AVOption options[] = { + { "usage", "Quality and compression efficiency vs speed trade-off", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "usage"}, + { "good", "Good quality", 0, AV_OPT_TYPE_CONST, {.i64 = 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"}, + { "realtime", "Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"}, ++ { "allintra", "All Intra encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 2 /* AOM_USAGE_ALL_INTRA */}, 0, 0, VE, "usage"}, + { "tune", "The metric that the encoder tunes for. Automatically chosen by the encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, AOM_TUNE_SSIM, VE, "tune"}, + { "psnr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"}, + { "ssim", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"}, +@@ -1341,11 +1416,12 @@ AVCodec ff_libaom_av1_encoder = { + .long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_AV1, ++ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | ++ AV_CODEC_CAP_OTHER_THREADS, + .priv_data_size = sizeof(AOMContext), + .init = av1_init, + .encode2 = aom_encode, + .close = aom_free, +- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, + .caps_internal = FF_CODEC_CAP_AUTO_THREADS, + .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), + .priv_class = &class_aom, diff --git a/graphics/ffmpeg/patches/patch-libavcodec_libsvtav1_c b/graphics/ffmpeg/patches/patch-libavcodec_libsvtav1_c @@ -0,0 +1,389 @@ +- avcodec/libsvtav1: Fix duplicate definition of caps_internal +- avcodec/libsvtav1: make coded GOP type configurable +- avcodec/libsvtav1: Fix value range for rc mode +- avcodec/libsvtav1: properly enforce CQP mode when set in wrapper +- avcodec/libsvtav1: add a svtav1-params option to pass a list of key=value parameters +- avcodec/libsvtav1: update some options and defaults +- avcodec/libsvtav1: deprecate some options +- avcodec/libsvtav1: fine tune qp mode settings +- avcodec/libsvtav1: pass color description info +- avcodec/libsvtav1: give svtav1-params priority over avctx values +- avcodec/libsvtav1: pass pict_type to library +- avcodec/libsvtav1: add support for setting chroma sample location +- avcodec/libsvtav1: update avctx bit rate according to RC mode +- avcodec/libsvtav1: signal CPB properties through side data +- avcodec/libsvtav1: properly initialize the flush EbBufferHeaderType struct +- avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer +- avcodec/libsvtav1: replace vbv_bufsize with maximum_buffer_size_ms +- avcodec/libsvtav1: only set max_buf_sz if both bitrate and rc_buf_sz is set +- avcodec/libsvtav1: don't force a default value for deprecated options + +Index: libavcodec/libsvtav1.c +--- libavcodec/libsvtav1.c.orig ++++ libavcodec/libsvtav1.c +@@ -60,17 +60,20 @@ typedef struct SvtContext { + EOS_STATUS eos_flag; + + // User options. ++ AVDictionary *svtav1_opts; ++#if FF_API_SVTAV1_OPTS + int hierarchical_level; + int la_depth; +- int enc_mode; +- int rc_mode; + int scd; +- int qp; + + int tier; + + int tile_columns; + int tile_rows; ++#endif ++ int enc_mode; ++ int crf; ++ int qp; + } SvtContext; + + static const struct { +@@ -120,16 +123,12 @@ static int svt_print_error(void *log_ctx, EbErrorType + + static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc) + { +- const int pack_mode_10bit = +- (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0; +- const size_t luma_size_8bit = +- config->source_width * config->source_height * (1 << pack_mode_10bit); +- const size_t luma_size_10bit = +- (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0; ++ const size_t luma_size = config->source_width * config->source_height * ++ (config->encoder_bit_depth > 8 ? 2 : 1); + + EbSvtIOFormat *in_data; + +- svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2; ++ svt_enc->raw_size = luma_size * 3 / 2; + + // allocate buffer for in and out + svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf)); +@@ -151,11 +150,132 @@ static int config_enc_params(EbSvtAv1EncConfiguration + { + SvtContext *svt_enc = avctx->priv_data; + const AVPixFmtDescriptor *desc; ++ AVDictionaryEntry *en = NULL; + ++ // Update param from options ++#if FF_API_SVTAV1_OPTS ++ if (svt_enc->hierarchical_level >= 0) ++ param->hierarchical_levels = svt_enc->hierarchical_level; ++ if (svt_enc->tier >= 0) ++ param->tier = svt_enc->tier; ++ if (svt_enc->scd >= 0) ++ param->scene_change_detection = svt_enc->scd; ++ if (svt_enc->tile_columns >= 0) ++ param->tile_columns = svt_enc->tile_columns; ++ if (svt_enc->tile_rows >= 0) ++ param->tile_rows = svt_enc->tile_rows; ++ ++ if (svt_enc->la_depth >= 0) ++ param->look_ahead_distance = svt_enc->la_depth; ++#endif ++ ++ if (svt_enc->enc_mode >= 0) ++ param->enc_mode = svt_enc->enc_mode; ++ ++ if (avctx->bit_rate) { ++ param->target_bit_rate = avctx->bit_rate; ++ if (avctx->rc_max_rate != avctx->bit_rate) ++ param->rate_control_mode = 1; ++ else ++ param->rate_control_mode = 2; ++ ++ param->max_qp_allowed = avctx->qmax; ++ param->min_qp_allowed = avctx->qmin; ++ } ++ param->max_bit_rate = avctx->rc_max_rate; ++ if (avctx->bit_rate && avctx->rc_buffer_size) ++ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; ++ ++ if (svt_enc->crf > 0) { ++ param->qp = svt_enc->crf; ++ param->rate_control_mode = 0; ++ } else if (svt_enc->qp > 0) { ++ param->qp = svt_enc->qp; ++ param->rate_control_mode = 0; ++ param->enable_adaptive_quantization = 0; ++ } ++ ++ desc = av_pix_fmt_desc_get(avctx->pix_fmt); ++ param->color_primaries = avctx->color_primaries; ++ param->matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ++ AVCOL_SPC_RGB : avctx->colorspace; ++ param->transfer_characteristics = avctx->color_trc; ++ ++ if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) ++ param->color_range = avctx->color_range == AVCOL_RANGE_JPEG; ++ else ++ param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); ++ ++#if SVT_AV1_CHECK_VERSION(1, 0, 0) ++ if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) { ++ const char *name = ++ av_chroma_location_name(avctx->chroma_sample_location); ++ ++ switch (avctx->chroma_sample_location) { ++ case AVCHROMA_LOC_LEFT: ++ param->chroma_sample_position = EB_CSP_VERTICAL; ++ break; ++ case AVCHROMA_LOC_TOPLEFT: ++ param->chroma_sample_position = EB_CSP_COLOCATED; ++ break; ++ default: ++ if (!name) ++ break; ++ ++ av_log(avctx, AV_LOG_WARNING, ++ "Specified chroma sample location %s is unsupported " ++ "on the AV1 bit stream level. Usage of a container that " ++ "allows passing this information - such as Matroska - " ++ "is recommended.\n", ++ name); ++ break; ++ } ++ } ++#endif ++ ++ if (avctx->profile != FF_PROFILE_UNKNOWN) ++ param->profile = avctx->profile; ++ ++ if (avctx->level != FF_LEVEL_UNKNOWN) ++ param->level = avctx->level; ++ ++ if (avctx->gop_size > 0) ++ param->intra_period_length = avctx->gop_size - 1; ++ ++ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { ++ param->frame_rate_numerator = avctx->framerate.num; ++ param->frame_rate_denominator = avctx->framerate.den; ++ } else { ++ param->frame_rate_numerator = avctx->time_base.den; ++ param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame; ++ } ++ ++ /* 2 = IDR, closed GOP, 1 = CRA, open GOP */ ++ param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1; ++ ++#if SVT_AV1_CHECK_VERSION(0, 9, 1) ++ while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) { ++ EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value); ++ if (ret != EB_ErrorNone) { ++ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING; ++ av_log(avctx, level, "Error parsing option %s: %s.\n", en->key, en->value); ++ if (avctx->err_recognition & AV_EF_EXPLODE) ++ return AVERROR(EINVAL); ++ } ++ } ++#else ++ if ((en = av_dict_get(svt_enc->svtav1_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { ++ int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING; ++ av_log(avctx, level, "svt-params needs libavcodec to be compiled with SVT-AV1 " ++ "headers >= 0.9.1.\n"); ++ if (avctx->err_recognition & AV_EF_EXPLODE) ++ return AVERROR(ENOSYS); ++ } ++#endif ++ + param->source_width = avctx->width; + param->source_height = avctx->height; + +- desc = av_pix_fmt_desc_get(avctx->pix_fmt); + param->encoder_bit_depth = desc->comp[0].depth; + + if (desc->log2_chroma_w == 1 && desc->log2_chroma_h == 1) +@@ -169,12 +289,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration + return AVERROR(EINVAL); + } + +- if (avctx->profile != FF_PROFILE_UNKNOWN) +- param->profile = avctx->profile; +- +- if (avctx->level != FF_LEVEL_UNKNOWN) +- param->level = avctx->level; +- + if ((param->encoder_color_format == EB_YUV422 || param->encoder_bit_depth > 10) + && param->profile != FF_PROFILE_AV1_PROFESSIONAL ) { + av_log(avctx, AV_LOG_WARNING, "Forcing Professional profile\n"); +@@ -184,40 +298,21 @@ static int config_enc_params(EbSvtAv1EncConfiguration + param->profile = FF_PROFILE_AV1_HIGH; + } + +- // Update param from options +- param->hierarchical_levels = svt_enc->hierarchical_level; +- param->enc_mode = svt_enc->enc_mode; +- param->tier = svt_enc->tier; +- param->rate_control_mode = svt_enc->rc_mode; +- param->scene_change_detection = svt_enc->scd; +- param->qp = svt_enc->qp; ++ avctx->bit_rate = param->rate_control_mode > 0 ? ++ param->target_bit_rate : 0; ++ avctx->rc_max_rate = param->max_bit_rate; ++ avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000LL; + +- param->target_bit_rate = avctx->bit_rate; ++ if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) { ++ AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx); ++ if (!cpb_props) ++ return AVERROR(ENOMEM); + +- if (avctx->gop_size > 0) +- param->intra_period_length = avctx->gop_size - 1; +- +- if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { +- param->frame_rate_numerator = avctx->framerate.num; +- param->frame_rate_denominator = avctx->framerate.den; +- } else { +- param->frame_rate_numerator = avctx->time_base.den; +- param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame; ++ cpb_props->buffer_size = avctx->rc_buffer_size; ++ cpb_props->max_bitrate = avctx->rc_max_rate; ++ cpb_props->avg_bitrate = avctx->bit_rate; + } + +- if (param->rate_control_mode) { +- param->max_qp_allowed = avctx->qmax; +- param->min_qp_allowed = avctx->qmin; +- } +- +- param->intra_refresh_type = 2; /* Real keyframes only */ +- +- if (svt_enc->la_depth >= 0) +- param->look_ahead_distance = svt_enc->la_depth; +- +- param->tile_columns = svt_enc->tile_columns; +- param->tile_rows = svt_enc->tile_rows; +- + return 0; + } + +@@ -330,11 +425,8 @@ static int eb_send_frame(AVCodecContext *avctx, const + if (svt_enc->eos_flag == EOS_SENT) + return 0; + +- headerPtrLast.n_alloc_len = 0; +- headerPtrLast.n_filled_len = 0; +- headerPtrLast.n_tick_count = 0; +- headerPtrLast.p_app_private = NULL; +- headerPtrLast.p_buffer = NULL; ++ memset(&headerPtrLast, 0, sizeof(headerPtrLast)); ++ headerPtrLast.pic_type = EB_AV1_INVALID_PICTURE; + headerPtrLast.flags = EB_BUFFERFLAG_EOS; + + svt_av1_enc_send_picture(svt_enc->svt_handle, &headerPtrLast); +@@ -350,6 +442,16 @@ static int eb_send_frame(AVCodecContext *avctx, const + headerPtr->p_app_private = NULL; + headerPtr->pts = frame->pts; + ++ switch (frame->pict_type) { ++ case AV_PICTURE_TYPE_I: ++ headerPtr->pic_type = EB_AV1_KEY_PICTURE; ++ break; ++ default: ++ // Actually means auto, or default. ++ headerPtr->pic_type = EB_AV1_INVALID_PICTURE; ++ break; ++ } ++ + svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr); + + return 0; +@@ -472,21 +574,22 @@ static av_cold int eb_enc_close(AVCodecContext *avctx) + #define OFFSET(x) offsetof(SvtContext, x) + #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + static const AVOption options[] = { +- { "hielevel", "Hierarchical prediction levels setting", OFFSET(hierarchical_level), +- AV_OPT_TYPE_INT, { .i64 = 4 }, 3, 4, VE , "hielevel"}, ++#if FF_API_SVTAV1_OPTS ++ { "hielevel", "Hierarchical prediction levels setting (Deprecated, use svtav1-params)", OFFSET(hierarchical_level), ++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED , "hielevel"}, + { "3level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "hielevel" }, + { "4level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4 }, INT_MIN, INT_MAX, VE, "hielevel" }, + +- { "la_depth", "Look ahead distance [0, 120]", OFFSET(la_depth), +- AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE }, ++ { "la_depth", "Look ahead distance [0, 120] (Deprecated, use svtav1-params)", OFFSET(la_depth), ++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE | AV_OPT_FLAG_DEPRECATED }, + +- { "preset", "Encoding preset [0, 8]", +- OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = MAX_ENC_PRESET }, 0, MAX_ENC_PRESET, VE }, +- +- { "tier", "Set operating point tier", OFFSET(tier), +- AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "tier" }, ++ { "tier", "Set operating point tier (Deprecated, use svtav1-params)", OFFSET(tier), ++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED, "tier" }, + { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, "tier" }, + { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "tier" }, ++#endif ++ { "preset", "Encoding preset", ++ OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_ENC_PRESET, VE }, + + FF_AV1_PROFILE_OPTS + +@@ -518,21 +621,20 @@ static const AVOption options[] = { + { LEVEL("7.3", 73) }, + #undef LEVEL + +- { "rc", "Bit rate control mode", OFFSET(rc_mode), +- AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE , "rc"}, +- { "cqp", "Constant quantizer", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" }, +- { "vbr", "Variable Bit Rate, use a target bitrate for the entire stream", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "rc" }, +- { "cvbr", "Constrained Variable Bit Rate, use a target bitrate for each GOP", 0, AV_OPT_TYPE_CONST,{ .i64 = 2 }, INT_MIN, INT_MAX, VE, "rc" }, ++ { "crf", "Constant Rate Factor value", OFFSET(crf), ++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE }, ++ { "qp", "Initial Quantizer level value", OFFSET(qp), ++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE }, ++#if FF_API_SVTAV1_OPTS ++ { "sc_detection", "Scene change detection (Deprecated, use svtav1-params)", OFFSET(scd), ++ AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED }, + +- { "qp", "Quantizer to use with cqp rate control mode", OFFSET(qp), +- AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE }, ++ { "tile_columns", "Log2 of number of tile columns to use (Deprecated, use svtav1-params)", OFFSET(tile_columns), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED }, ++ { "tile_rows", "Log2 of number of tile rows to use (Deprecated, use svtav1-params)", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, VE | AV_OPT_FLAG_DEPRECATED }, ++#endif + +- { "sc_detection", "Scene change detection", OFFSET(scd), +- AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, ++ { "svtav1-params", "Set the SVT-AV1 configuration using a :-separated list of key=value parameters", OFFSET(svtav1_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE }, + +- { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE}, +- { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE}, +- + {NULL}, + }; + +@@ -544,9 +646,10 @@ static const AVClass class = { + }; + + static const AVCodecDefault eb_enc_defaults[] = { +- { "b", "7M" }, ++ { "b", "0" }, ++ { "flags", "+cgop" }, + { "g", "-1" }, +- { "qmin", "0" }, ++ { "qmin", "1" }, + { "qmax", "63" }, + { NULL }, + }; +@@ -561,12 +664,11 @@ AVCodec ff_libsvtav1_encoder = { + .receive_packet = eb_receive_packet, + .close = eb_enc_close, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, +- .caps_internal = FF_CODEC_CAP_AUTO_THREADS, ++ .caps_internal = FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP, + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_NONE }, + .priv_class = &class, + .defaults = eb_enc_defaults, +- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .wrapper_name = "libsvtav1", + }; diff --git a/graphics/ffmpeg/patches/patch-libavcodec_version_h b/graphics/ffmpeg/patches/patch-libavcodec_version_h @@ -0,0 +1,14 @@ +avcodec/libsvtav1: deprecate some options + +Index: libavcodec/version.h +--- libavcodec/version.h.orig ++++ libavcodec/version.h +@@ -168,5 +168,8 @@ + #ifndef FF_API_INIT_PACKET + #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) + #endif ++#ifndef FF_API_SVTAV1_OPTS ++#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) ++#endif + + #endif /* AVCODEC_VERSION_H */ diff --git a/graphics/ffmpeg/patches/patch-libavcodec_x86_fft_asm b/graphics/ffmpeg/patches/patch-libavcodec_x86_fft_asm @@ -0,0 +1,128 @@ +- place a table in rodata +- use _CET_ENDBR in functions header + +Index: libavcodec/x86/fft.asm +--- libavcodec/x86/fft.asm.orig ++++ libavcodec/x86/fft.asm +@@ -325,6 +325,7 @@ INIT_YMM avx + %if HAVE_AVX_EXTERNAL + align 16 + fft8_avx: ++ _CET_ENDBR + mova m0, Z(0) + mova m1, Z(1) + T8_AVX m0, m1, m2, m3, m4 +@@ -335,6 +336,7 @@ fft8_avx: + + align 16 + fft16_avx: ++ _CET_ENDBR + mova m2, Z(2) + mova m3, Z(3) + T4_SSE m2, m3, m7 +@@ -372,6 +374,7 @@ fft16_avx: + + align 16 + fft32_avx: ++ _CET_ENDBR + call fft16_avx + + mova m0, Z(4) +@@ -396,6 +399,7 @@ fft32_avx: + ret + + fft32_interleave_avx: ++ _CET_ENDBR + call fft32_avx + mov r2d, 32 + .deint_loop: +@@ -419,6 +423,7 @@ INIT_XMM sse + align 16 + fft4_avx: + fft4_sse: ++ _CET_ENDBR + mova m0, Z(0) + mova m1, Z(1) + T4_SSE m0, m1, m2 +@@ -428,6 +433,7 @@ fft4_sse: + + align 16 + fft8_sse: ++ _CET_ENDBR + mova m0, Z(0) + mova m1, Z(1) + T4_SSE m0, m1, m2 +@@ -442,6 +448,7 @@ fft8_sse: + + align 16 + fft16_sse: ++ _CET_ENDBR + mova m0, Z(0) + mova m1, Z(1) + T4_SSE m0, m1, m2 +@@ -465,6 +472,7 @@ fft16_sse: + %macro FFT48_3DNOW 0 + align 16 + fft4 %+ SUFFIX: ++ _CET_ENDBR + T2_3DNOW m0, m1, Z(0), Z(1) + mova m2, Z(2) + mova m3, Z(3) +@@ -479,6 +487,7 @@ fft4 %+ SUFFIX: + + align 16 + fft8 %+ SUFFIX: ++ _CET_ENDBR + T2_3DNOW m0, m1, Z(0), Z(1) + mova m2, Z(2) + mova m3, Z(3) +@@ -532,6 +541,7 @@ FFT48_3DNOW + %macro DECL_PASS 2+ ; name, payload + align 16 + %1: ++ _CET_ENDBR + DEFINE_ARGS zc, w, n, o1, o3 + lea o3q, [nq*3] + lea o1q, [nq*8] +@@ -548,10 +558,6 @@ DEFINE_ARGS zc, w, n, o1, o3 + %macro FFT_DISPATCH 2; clobbers 5 GPRs, 8 XMMs + lea r2, [dispatch_tab%1] + mov r2, [r2 + (%2q-2)*gprsize] +-%ifdef PIC +- lea r3, [$$] +- add r2, r3 +-%endif + call r2 + %endmacro ; FFT_DISPATCH + +@@ -731,11 +737,7 @@ DECL_PASS pass_interleave_3dnow, PASS_BIG 0 + %define pass_interleave_3dnowext pass_interleave_3dnow + %endif + +-%ifdef PIC +-%define SECTION_REL - $$ +-%else + %define SECTION_REL +-%endif + + %macro DECL_FFT 1-2 ; nbits, suffix + %ifidn %0, 1 +@@ -759,6 +761,7 @@ DECL_PASS pass_interleave_3dnow, PASS_BIG 0 + + align 16 + fft %+ n %+ fullsuffix: ++ _CET_ENDBR + call fft %+ n2 %+ SUFFIX + add r0, n*4 - (n&(-2<<%1)) + call fft %+ n4 %+ SUFFIX +@@ -773,8 +776,10 @@ fft %+ n %+ fullsuffix: + %endrep + %undef n + ++[SECTION .data.rel.ro write] + align 8 + dispatch_tab %+ fullsuffix: pointer list_of_fft ++__?SECT?__ + %endmacro ; DECL_FFT + + %if HAVE_AVX_EXTERNAL diff --git a/graphics/ffmpeg/patches/patch-libavformat_rtpproto_c b/graphics/ffmpeg/patches/patch-libavformat_rtpproto_c @@ -0,0 +1,14 @@ +avformat/rtpproto: set ttl upper bound to 255 + +Index: libavformat/rtpproto.c +--- libavformat/rtpproto.c.orig ++++ libavformat/rtpproto.c +@@ -67,7 +67,7 @@ typedef struct RTPContext { + #define D AV_OPT_FLAG_DECODING_PARAM + #define E AV_OPT_FLAG_ENCODING_PARAM + static const AVOption options[] = { +- { "ttl", "Time to live (in milliseconds, multicast only)", OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "ttl", "Time to live (multicast only)", OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, .flags = D|E }, + { "buffer_size", "Send/Receive buffer size (in bytes)", OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { "rtcp_port", "Custom rtcp port", OFFSET(rtcp_port), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { "local_rtpport", "Local rtp port", OFFSET(local_rtpport), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, diff --git a/graphics/ffmpeg/patches/patch-libavformat_udp_c b/graphics/ffmpeg/patches/patch-libavformat_udp_c @@ -0,0 +1,82 @@ +- avformat/udp: set ttl upper bound to 255 +- avformat/udp: properly check for valid ttl in url +- avformat/udp: use one setsockopt for ipv4/ipv6 +- avformat/udp: Fix IP_MULTICAST_TTL for BSD compatibility +- avformat/udp: remove IPPROTO_IPV6 macro + +Index: libavformat/udp.c +--- libavformat/udp.c.orig ++++ libavformat/udp.c +@@ -134,7 +134,7 @@ static const AVOption options[] = { + { "reuse", "explicitly allow reusing UDP sockets", OFFSET(reuse_socket), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, D|E }, + { "reuse_socket", "explicitly allow reusing UDP sockets", OFFSET(reuse_socket), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E }, + { "broadcast", "explicitly allow or disallow broadcast destination", OFFSET(is_broadcast), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, +- { "ttl", "Time to live (multicast only)", OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, INT_MAX, E }, ++ { "ttl", "Time to live (multicast only)", OFFSET(ttl), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 255, E }, + { "connect", "set if connect() should be called on socket", OFFSET(is_connected), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D|E }, + { "fifo_size", "set the UDP receiving circular buffer size, expressed as a number of packets with size of 188 bytes", OFFSET(circular_buffer_size), AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D }, + { "overrun_nonfatal", "survive in case of UDP receiving circular buffer overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, D }, +@@ -161,22 +161,40 @@ static const AVClass udplite_context_class = { + static int udp_set_multicast_ttl(int sockfd, int mcastTTL, + struct sockaddr *addr) + { ++ int protocol, cmd; ++ ++ /* There is some confusion in the world whether IP_MULTICAST_TTL ++ * takes a byte or an int as an argument. ++ * BSD seems to indicate byte so we are going with that and use ++ * int and fall back to byte to be safe */ ++ switch (addr->sa_family) { + #ifdef IP_MULTICAST_TTL +- if (addr->sa_family == AF_INET) { +- if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) { +- ff_log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL)"); +- return ff_neterrno(); +- } +- } ++ case AF_INET: ++ protocol = IPPROTO_IP; ++ cmd = IP_MULTICAST_TTL; ++ break; + #endif +-#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS) +- if (addr->sa_family == AF_INET6) { +- if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) { +- ff_log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS)"); ++#ifdef IPV6_MULTICAST_HOPS ++ case AF_INET6: ++ protocol = IPPROTO_IPV6; ++ cmd = IPV6_MULTICAST_HOPS; ++ break; ++#endif ++ default: ++ return 0; ++ } ++ ++ if (setsockopt(sockfd, protocol, cmd, &mcastTTL, sizeof(mcastTTL)) < 0) { ++ /* BSD compatibility */ ++ unsigned char ttl = (unsigned char) mcastTTL; ++ ++ ff_log_net_error(NULL, AV_LOG_DEBUG, "setsockopt(IPV4/IPV6 MULTICAST TTL)"); ++ if (setsockopt(sockfd, protocol, cmd, &ttl, sizeof(ttl)) < 0) { ++ ff_log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV4/IPV6 MULTICAST TTL)"); + return ff_neterrno(); + } + } +-#endif ++ + return 0; + } + +@@ -673,6 +691,11 @@ static int udp_open(URLContext *h, const char *uri, in + } + if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { + s->ttl = strtol(buf, NULL, 10); ++ if (s->ttl < 0 || s->ttl > 255) { ++ av_log(h, AV_LOG_ERROR, "ttl(%d) should be in range [0,255]\n", s->ttl); ++ ret = AVERROR(EINVAL); ++ goto fail; ++ } + } + if (av_find_info_tag(buf, sizeof(buf), "udplite_coverage", p)) { + s->udplite_coverage = strtol(buf, NULL, 10); diff --git a/graphics/ffmpeg/patches/patch-libavformat_utils_c b/graphics/ffmpeg/patches/patch-libavformat_utils_c @@ -0,0 +1,24 @@ +llvm 16 optimizations lead to a segfault when seeking in opus files because +checks that could leave pos_max uninitialized are optimized away, leading +to out-of-bounds reads from the guard pages. + +av_uninit() is complete batshittery: + +https://marc.info/?l=openbsd-ports&m=170284868209618&w=2 + +Turns out the same commit has landed upstream: + +https://github.com/FFmpeg/FFmpeg/commit/ab792634197e364ca1bb194f9abe36836e42f12d + +Index: libavformat/utils.c +--- libavformat/utils.c.orig ++++ libavformat/utils.c +@@ -2146,7 +2146,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int strea + int64_t target_ts, int flags) + { + const AVInputFormat *avif = s->iformat; +- int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit; ++ int64_t pos_min = 0, pos_max = 0, pos, pos_limit; + int64_t ts_min, ts_max, ts; + int index; + int64_t ret; diff --git a/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S b/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S @@ -0,0 +1,137 @@ +Index: libavutil/aarch64/asm.S +--- libavutil/aarch64/asm.S.orig ++++ libavutil/aarch64/asm.S +@@ -36,6 +36,125 @@ + # define __has_feature(x) 0 + #endif + ++ ++/* Support macros for ++ * - Armv8.3-A Pointer Authentication and ++ * - Armv8.5-A Branch Target Identification ++ * features which require emitting a .note.gnu.property section with the ++ * appropriate architecture-dependent feature bits set. ++ * ++ * |AARCH64_SIGN_LINK_REGISTER| and |AARCH64_VALIDATE_LINK_REGISTER| expand to ++ * PACIxSP and AUTIxSP, respectively. |AARCH64_SIGN_LINK_REGISTER| should be ++ * used immediately before saving the LR register (x30) to the stack. ++ * |AARCH64_VALIDATE_LINK_REGISTER| should be used immediately after restoring ++ * it. Note |AARCH64_SIGN_LINK_REGISTER|'s modifications to LR must be undone ++ * with |AARCH64_VALIDATE_LINK_REGISTER| before RET. The SP register must also ++ * have the same value at the two points. For example: ++ * ++ * .global f ++ * f: ++ * AARCH64_SIGN_LINK_REGISTER ++ * stp x29, x30, [sp, #-96]! ++ * mov x29, sp ++ * ... ++ * ldp x29, x30, [sp], #96 ++ * AARCH64_VALIDATE_LINK_REGISTER ++ * ret ++ * ++ * |AARCH64_VALID_CALL_TARGET| expands to BTI 'c'. Either it, or ++ * |AARCH64_SIGN_LINK_REGISTER|, must be used at every point that may be an ++ * indirect call target. In particular, all symbols exported from a file must ++ * begin with one of these macros. For example, a leaf function that does not ++ * save LR can instead use |AARCH64_VALID_CALL_TARGET|: ++ * ++ * .globl return_zero ++ * return_zero: ++ * AARCH64_VALID_CALL_TARGET ++ * mov x0, #0 ++ * ret ++ * ++ * A non-leaf function which does not immediately save LR may need both macros ++ * because |AARCH64_SIGN_LINK_REGISTER| appears late. For example, the function ++ * may jump to an alternate implementation before setting up the stack: ++ * ++ * .globl with_early_jump ++ * with_early_jump: ++ * AARCH64_VALID_CALL_TARGET ++ * cmp x0, #128 ++ * b.lt .Lwith_early_jump_128 ++ * AARCH64_SIGN_LINK_REGISTER ++ * stp x29, x30, [sp, #-96]! ++ * mov x29, sp ++ * ... ++ * ldp x29, x30, [sp], #96 ++ * AARCH64_VALIDATE_LINK_REGISTER ++ * ret ++ * ++ * .Lwith_early_jump_128: ++ * ... ++ * ret ++ * ++ * These annotations are only required with indirect calls. Private symbols that ++ * are only the target of direct calls do not require annotations. Also note ++ * that |AARCH64_VALID_CALL_TARGET| is only valid for indirect calls (BLR), not ++ * indirect jumps (BR). Indirect jumps in assembly are supported through ++ * |AARCH64_VALID_JUMP_TARGET|. Landing Pads which shall serve for jumps and ++ * calls can be created using |AARCH64_VALID_JUMP_CALL_TARGET|. ++ * ++ * Although not necessary, it is safe to use these macros in 32-bit ARM ++ * assembly. This may be used to simplify dual 32-bit and 64-bit files. ++ * ++ * References: ++ * - "ELF for the ArmĀ® 64-bit Architecture" ++ * https: *github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst ++ * - "Providing protection for complex software" ++ * https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software ++ */ ++#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1) ++# define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has BTI ++# define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c' ++# define AARCH64_VALID_JUMP_TARGET hint #38 // BTI 'j' ++#else ++# define GNU_PROPERTY_AARCH64_BTI 0 // No BTI ++# define AARCH64_VALID_CALL_TARGET ++# define AARCH64_VALID_JUMP_TARGET ++#endif ++ ++#if defined(__ARM_FEATURE_PAC_DEFAULT) ++# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 0)) != 0) // authentication using key A ++# define AARCH64_SIGN_LINK_REGISTER paciasp ++# define AARCH64_VALIDATE_LINK_REGISTER autiasp ++# elif ((__ARM_FEATURE_PAC_DEFAULT & (1 << 1)) != 0) // authentication using key B ++# define AARCH64_SIGN_LINK_REGISTER pacibsp ++# define AARCH64_VALIDATE_LINK_REGISTER autibsp ++# else ++# error Pointer authentication defines no valid key! ++# endif ++# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 2)) != 0) ++# error Authentication of leaf functions is enabled but not supported in FFmpeg! ++# endif ++# define GNU_PROPERTY_AARCH64_PAC (1 << 1) ++#else ++# define GNU_PROPERTY_AARCH64_PAC 0 ++# define AARCH64_SIGN_LINK_REGISTER ++# define AARCH64_VALIDATE_LINK_REGISTER ++#endif ++ ++ ++#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0) ++ .pushsection .note.gnu.property, "a" ++ .balign 8 ++ .long 4 ++ .long 0x10 ++ .long 0x5 ++ .asciz "GNU" ++ .long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ ++ .long 4 ++ .long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC) ++ .long 0 ++ .popsection ++#endif ++ + .macro function name, export=0, align=2 + .macro endfunc + ELF .size \name, . - \name +@@ -49,6 +168,7 @@ FUNC .endfunc + ELF .type EXTERN_ASM\name, %function + FUNC .func EXTERN_ASM\name + EXTERN_ASM\name: ++ AARCH64_VALID_CALL_TARGET + .else + ELF .type \name, %function + FUNC .func \name diff --git a/graphics/ffmpeg/patches/patch-libavutil_x86_x86inc_asm b/graphics/ffmpeg/patches/patch-libavutil_x86_x86inc_asm @@ -0,0 +1,27 @@ +- define _CET_ENDBR depending X86_64 / X86 +- use it in cglobal macro + +Index: libavutil/x86/x86inc.asm +--- libavutil/x86/x86inc.asm.orig ++++ libavutil/x86/x86inc.asm +@@ -53,6 +53,12 @@ + %endif + %endif + ++%if ARCH_X86_64 ++ %define _CET_ENDBR endbr64 ++%else ++ %define _CET_ENDBR ++%endif ++ + %define WIN64 0 + %define UNIX64 0 + %if ARCH_X86_64 +@@ -746,6 +752,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, + %endif + align function_align + %2: ++ _CET_ENDBR + RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer + %xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required + %assign stack_offset 0 ; stack pointer offset relative to the return address diff --git a/graphics/ffmpeg/patches/patch-libswscale_ppc_yuv2rgb_altivec_c b/graphics/ffmpeg/patches/patch-libswscale_ppc_yuv2rgb_altivec_c @@ -0,0 +1,14 @@ +error: redeclaration of 'vec_xl' must have the 'overloadable' attribute + +Index: libswscale/ppc/yuv2rgb_altivec.c +--- libswscale/ppc/yuv2rgb_altivec.c.orig ++++ libswscale/ppc/yuv2rgb_altivec.c +@@ -284,7 +284,7 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector s + * ------------------------------------------------------------------------------ + */ + +-#if !HAVE_VSX ++#if !HAVE_VSX && !defined(__clang__) + static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr) + { + const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset); diff --git a/graphics/ffmpeg/pkg/CVS/Entries b/graphics/ffmpeg/pkg/CVS/Entries @@ -0,0 +1,4 @@ +/DESCR/1.4/Sun Sep 4 09:22:43 2011// +/README/1.3/Sat Mar 12 08:16:31 2022// +/PLIST/1.42/Fri Dec 30 08:19:04 2022// +D diff --git a/graphics/ffmpeg/pkg/CVS/Repository b/graphics/ffmpeg/pkg/CVS/Repository @@ -0,0 +1 @@ +ports/graphics/ffmpeg/pkg diff --git a/graphics/ffmpeg/pkg/DESCR b/graphics/ffmpeg/pkg/DESCR @@ -0,0 +1,2 @@ +FFmpeg is a complete solution to record, convert and stream audio and +video. It includes libavcodec, the leading audio/video codec library. diff --git a/graphics/ffmpeg/pkg/PLIST b/graphics/ffmpeg/pkg/PLIST @@ -0,0 +1,249 @@ +@bin bin/ffmpeg +@bin bin/ffplay +@bin bin/ffprobe +@bin bin/qt-faststart +include/libavcodec/ +include/libavcodec/ac3_parser.h +include/libavcodec/adts_parser.h +include/libavcodec/avcodec.h +include/libavcodec/avdct.h +include/libavcodec/avfft.h +include/libavcodec/bsf.h +include/libavcodec/codec.h +include/libavcodec/codec_desc.h +include/libavcodec/codec_id.h +include/libavcodec/codec_par.h +include/libavcodec/d3d11va.h +include/libavcodec/dirac.h +include/libavcodec/dv_profile.h +include/libavcodec/dxva2.h +include/libavcodec/jni.h +include/libavcodec/mediacodec.h +include/libavcodec/packet.h +include/libavcodec/qsv.h +include/libavcodec/vaapi.h +include/libavcodec/vdpau.h +include/libavcodec/version.h +include/libavcodec/videotoolbox.h +include/libavcodec/vorbis_parser.h +include/libavcodec/xvmc.h +include/libavdevice/ +include/libavdevice/avdevice.h +include/libavdevice/version.h +include/libavfilter/ +include/libavfilter/avfilter.h +include/libavfilter/buffersink.h +include/libavfilter/buffersrc.h +include/libavfilter/version.h +include/libavformat/ +include/libavformat/avformat.h +include/libavformat/avio.h +include/libavformat/version.h +include/libavutil/ +include/libavutil/adler32.h +include/libavutil/aes.h +include/libavutil/aes_ctr.h +include/libavutil/attributes.h +include/libavutil/audio_fifo.h +include/libavutil/avassert.h +include/libavutil/avconfig.h +include/libavutil/avstring.h +include/libavutil/avutil.h +include/libavutil/base64.h +include/libavutil/blowfish.h +include/libavutil/bprint.h +include/libavutil/bswap.h +include/libavutil/buffer.h +include/libavutil/camellia.h +include/libavutil/cast5.h +include/libavutil/channel_layout.h +include/libavutil/common.h +include/libavutil/cpu.h +include/libavutil/crc.h +include/libavutil/des.h +include/libavutil/dict.h +include/libavutil/display.h +include/libavutil/dovi_meta.h +include/libavutil/downmix_info.h +include/libavutil/encryption_info.h +include/libavutil/error.h +include/libavutil/eval.h +include/libavutil/ffversion.h +include/libavutil/fifo.h +include/libavutil/file.h +include/libavutil/film_grain_params.h +include/libavutil/frame.h +include/libavutil/hash.h +include/libavutil/hdr_dynamic_metadata.h +include/libavutil/hmac.h +include/libavutil/hwcontext.h +include/libavutil/hwcontext_cuda.h +include/libavutil/hwcontext_d3d11va.h +include/libavutil/hwcontext_drm.h +include/libavutil/hwcontext_dxva2.h +include/libavutil/hwcontext_mediacodec.h +include/libavutil/hwcontext_opencl.h +include/libavutil/hwcontext_qsv.h +include/libavutil/hwcontext_vaapi.h +include/libavutil/hwcontext_vdpau.h +include/libavutil/hwcontext_videotoolbox.h +include/libavutil/hwcontext_vulkan.h +include/libavutil/imgutils.h +include/libavutil/intfloat.h +include/libavutil/intreadwrite.h +include/libavutil/lfg.h +include/libavutil/log.h +include/libavutil/lzo.h +include/libavutil/macros.h +include/libavutil/mastering_display_metadata.h +include/libavutil/mathematics.h +include/libavutil/md5.h +include/libavutil/mem.h +include/libavutil/motion_vector.h +include/libavutil/murmur3.h +include/libavutil/opt.h +include/libavutil/parseutils.h +include/libavutil/pixdesc.h +include/libavutil/pixelutils.h +include/libavutil/pixfmt.h +include/libavutil/random_seed.h +include/libavutil/rational.h +include/libavutil/rc4.h +include/libavutil/replaygain.h +include/libavutil/ripemd.h +include/libavutil/samplefmt.h +include/libavutil/sha.h +include/libavutil/sha512.h +include/libavutil/spherical.h +include/libavutil/stereo3d.h +include/libavutil/tea.h +include/libavutil/threadmessage.h +include/libavutil/time.h +include/libavutil/timecode.h +include/libavutil/timestamp.h +include/libavutil/tree.h +include/libavutil/twofish.h +include/libavutil/tx.h +include/libavutil/version.h +include/libavutil/video_enc_params.h +include/libavutil/xtea.h +include/libpostproc/ +include/libpostproc/postprocess.h +include/libpostproc/version.h +include/libswresample/ +include/libswresample/swresample.h +include/libswresample/version.h +include/libswscale/ +include/libswscale/swscale.h +include/libswscale/version.h +@static-lib lib/libavcodec.a +@lib lib/libavcodec.so.${LIBavcodec_VERSION} +@static-lib lib/libavdevice.a +@lib lib/libavdevice.so.${LIBavdevice_VERSION} +@static-lib lib/libavfilter.a +@lib lib/libavfilter.so.${LIBavfilter_VERSION} +@static-lib lib/libavformat.a +@lib lib/libavformat.so.${LIBavformat_VERSION} +@static-lib lib/libavutil.a +@lib lib/libavutil.so.${LIBavutil_VERSION} +@static-lib lib/libpostproc.a +@lib lib/libpostproc.so.${LIBpostproc_VERSION} +@static-lib lib/libswresample.a +@lib lib/libswresample.so.${LIBswresample_VERSION} +@static-lib lib/libswscale.a +@lib lib/libswscale.so.${LIBswscale_VERSION} +lib/pkgconfig/libavcodec.pc +lib/pkgconfig/libavdevice.pc +lib/pkgconfig/libavfilter.pc +lib/pkgconfig/libavformat.pc +lib/pkgconfig/libavutil.pc +lib/pkgconfig/libpostproc.pc +lib/pkgconfig/libswresample.pc +lib/pkgconfig/libswscale.pc +@man man/man1/ffmpeg-all.1 +@man man/man1/ffmpeg-bitstream-filters.1 +@man man/man1/ffmpeg-codecs.1 +@man man/man1/ffmpeg-devices.1 +@man man/man1/ffmpeg-filters.1 +@man man/man1/ffmpeg-formats.1 +@man man/man1/ffmpeg-protocols.1 +@man man/man1/ffmpeg-resampler.1 +@man man/man1/ffmpeg-scaler.1 +@man man/man1/ffmpeg-utils.1 +@man man/man1/ffmpeg.1 +@man man/man1/ffplay-all.1 +@man man/man1/ffplay.1 +@man man/man1/ffprobe-all.1 +@man man/man1/ffprobe.1 +@man man/man3/libavcodec.3 +@man man/man3/libavdevice.3 +@man man/man3/libavfilter.3 +@man man/man3/libavformat.3 +@man man/man3/libavutil.3 +@man man/man3/libswresample.3 +@man man/man3/libswscale.3 +share/doc/ffmpeg/ +share/doc/ffmpeg/developer.html +share/doc/ffmpeg/faq.html +share/doc/ffmpeg/fate.html +share/doc/ffmpeg/ffmpeg-all.html +share/doc/ffmpeg/ffmpeg-bitstream-filters.html +share/doc/ffmpeg/ffmpeg-codecs.html +share/doc/ffmpeg/ffmpeg-devices.html +share/doc/ffmpeg/ffmpeg-filters.html +share/doc/ffmpeg/ffmpeg-formats.html +share/doc/ffmpeg/ffmpeg-protocols.html +share/doc/ffmpeg/ffmpeg-resampler.html +share/doc/ffmpeg/ffmpeg-scaler.html +share/doc/ffmpeg/ffmpeg-utils.html +share/doc/ffmpeg/ffmpeg.html +share/doc/ffmpeg/ffplay-all.html +share/doc/ffmpeg/ffplay.html +share/doc/ffmpeg/ffprobe-all.html +share/doc/ffmpeg/ffprobe.html +share/doc/ffmpeg/general.html +share/doc/ffmpeg/git-howto.html +share/doc/ffmpeg/libavcodec.html +share/doc/ffmpeg/libavdevice.html +share/doc/ffmpeg/libavfilter.html +share/doc/ffmpeg/libavformat.html +share/doc/ffmpeg/libavutil.html +share/doc/ffmpeg/libswresample.html +share/doc/ffmpeg/libswscale.html +share/doc/ffmpeg/mailing-list-faq.html +share/doc/ffmpeg/nut.html +share/doc/ffmpeg/platform.html +share/doc/pkg-readmes/${PKGSTEM} +share/examples/ffmpeg/ +share/examples/ffmpeg/Makefile +share/examples/ffmpeg/README +share/examples/ffmpeg/avio_list_dir.c +share/examples/ffmpeg/avio_reading.c +share/examples/ffmpeg/decode_audio.c +share/examples/ffmpeg/decode_video.c +share/examples/ffmpeg/demuxing_decoding.c +share/examples/ffmpeg/encode_audio.c +share/examples/ffmpeg/encode_video.c +share/examples/ffmpeg/extract_mvs.c +share/examples/ffmpeg/filter_audio.c +share/examples/ffmpeg/filtering_audio.c +share/examples/ffmpeg/filtering_video.c +share/examples/ffmpeg/http_multiclient.c +share/examples/ffmpeg/hw_decode.c +share/examples/ffmpeg/metadata.c +share/examples/ffmpeg/muxing.c +share/examples/ffmpeg/qsvdec.c +share/examples/ffmpeg/remuxing.c +share/examples/ffmpeg/resampling_audio.c +share/examples/ffmpeg/scaling_video.c +share/examples/ffmpeg/transcode_aac.c +share/examples/ffmpeg/transcoding.c +share/examples/ffmpeg/vaapi_encode.c +share/examples/ffmpeg/vaapi_transcode.c +share/ffmpeg/ +share/ffmpeg/ffprobe.xsd +share/ffmpeg/libvpx-1080p.ffpreset +share/ffmpeg/libvpx-1080p50_60.ffpreset +share/ffmpeg/libvpx-360p.ffpreset +share/ffmpeg/libvpx-720p.ffpreset +share/ffmpeg/libvpx-720p50_60.ffpreset diff --git a/graphics/ffmpeg/pkg/README b/graphics/ffmpeg/pkg/README @@ -0,0 +1,18 @@ ++----------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++----------------------------------------------------------------------- + +bktr(4) support (amd64/i386/powerpc only) may be controlled through the +following environment variables: + +BKTR_DEV={0|1|2|3|4}: Selects device input (tuner, camera, ...) + +BKTR_FORMAT={1|2|3|4|5|6}: + 1 PAL + 2 NTSC + 3 SECAM + 4 PALN + 5 PALM + 6 NTSCJ + +BKTR_FREQUENCY=xxx.yy: Sets frequency in MHz