diff options
Diffstat (limited to 'source/l/ffmpeg')
-rw-r--r-- | source/l/ffmpeg/0004-support-nv-codec-headers-12.2.patch | 291 | ||||
-rw-r--r-- | source/l/ffmpeg/250471ea1745fc703eb346a2a662304536a311b1.patch | 25 | ||||
-rw-r--r-- | source/l/ffmpeg/add-av_stream_get_first_dts-for-chromium.patch | 31 | ||||
-rwxr-xr-x | source/l/ffmpeg/ffmpeg.SlackBuild | 85 | ||||
-rw-r--r-- | source/l/ffmpeg/ffmpeg.vulkan.diff | 15 |
5 files changed, 426 insertions, 21 deletions
diff --git a/source/l/ffmpeg/0004-support-nv-codec-headers-12.2.patch b/source/l/ffmpeg/0004-support-nv-codec-headers-12.2.patch new file mode 100644 index 000000000..80352e8c5 --- /dev/null +++ b/source/l/ffmpeg/0004-support-nv-codec-headers-12.2.patch @@ -0,0 +1,291 @@ +diff -Nru a/libavcodec/nvenc.c b/libavcodec/nvenc.c +--- a/libavcodec/nvenc.c 2024-04-03 12:14:22.766521297 +0900 ++++ b/libavcodec/nvenc.c 2024-04-03 12:14:01.727470507 +0900 +@@ -242,8 +242,20 @@ + + static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level) + { +-#if NVENCAPI_CHECK_VERSION(12, 1) ++#if NVENCAPI_CHECK_VERSION(12, 3) + const char *minver = "(unknown)"; ++#elif NVENCAPI_CHECK_VERSION(12, 2) ++# if defined(_WIN32) || defined(__CYGWIN__) ++ const char *minver = "551.76"; ++# else ++ const char *minver = "550.54.14"; ++# endif ++#elif NVENCAPI_CHECK_VERSION(12, 1) ++# if defined(_WIN32) || defined(__CYGWIN__) ++ const char *minver = "531.61"; ++# else ++ const char *minver = "530.41.03"; ++# endif + #elif NVENCAPI_CHECK_VERSION(12, 0) + # if defined(_WIN32) || defined(__CYGWIN__) + const char *minver = "522.25"; +@@ -594,6 +606,33 @@ + return AVERROR(ENOSYS); + } + ++#ifdef NVENC_HAVE_TEMPORAL_FILTER ++ ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_FILTER); ++ if(ctx->tf_level > 0 && ret <= 0) { ++ av_log(avctx, AV_LOG_WARNING, "Temporal filtering not supported by the device\n"); ++ return AVERROR(ENOSYS); ++ } ++#endif ++ ++#ifdef NVENC_HAVE_LOOKAHEAD_LEVEL ++ ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD_LEVEL); ++ if(ctx->rc_lookahead > 0 && ctx->lookahead_level > 0 && ++ ctx->lookahead_level != NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT && ++ ctx->lookahead_level > ret) ++ { ++ av_log(avctx, AV_LOG_WARNING, "Lookahead level not supported. Maximum level: %d\n", ret); ++ return AVERROR(ENOSYS); ++ } ++#endif ++ ++#ifdef NVENC_HAVE_UNIDIR_B ++ ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_UNIDIRECTIONAL_B); ++ if(ctx->unidir_b && ret <= 0) { ++ av_log(avctx, AV_LOG_WARNING, "Unidirectional B-Frames not supported by the device\n"); ++ return AVERROR(ENOSYS); ++ } ++#endif ++ + ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); + + return 0; +@@ -987,7 +1026,7 @@ + return 0; + } + +-static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ++static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) + { + NvencContext *ctx = avctx->priv_data; + +@@ -1116,6 +1155,24 @@ + if (ctx->encode_config.rcParams.lookaheadDepth < ctx->rc_lookahead) + av_log(avctx, AV_LOG_WARNING, "Clipping lookahead depth to %d (from %d) due to lack of surfaces/delay", + ctx->encode_config.rcParams.lookaheadDepth, ctx->rc_lookahead); ++ ++#ifdef NVENC_HAVE_LOOKAHEAD_LEVEL ++ if (ctx->lookahead_level >= 0) { ++ switch (ctx->lookahead_level) { ++ case NV_ENC_LOOKAHEAD_LEVEL_0: ++ case NV_ENC_LOOKAHEAD_LEVEL_1: ++ case NV_ENC_LOOKAHEAD_LEVEL_2: ++ case NV_ENC_LOOKAHEAD_LEVEL_3: ++ case NV_ENC_LOOKAHEAD_LEVEL_AUTOSELECT: ++ break; ++ default: ++ av_log(avctx, AV_LOG_ERROR, "Invalid lookahead level.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ ctx->encode_config.rcParams.lookaheadLevel = ctx->lookahead_level; ++ } ++#endif + } + } + +@@ -1143,6 +1200,8 @@ + ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0; + ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; + } ++ ++ return 0; + } + + static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) +@@ -1255,6 +1314,11 @@ + + h264->level = ctx->level; + ++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API ++ h264->inputBitDepth = h264->outputBitDepth = ++ IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; ++#endif ++ + if (ctx->coder >= 0) + h264->entropyCodingMode = ctx->coder; + +@@ -1370,7 +1434,12 @@ + + hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; + ++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API ++ hevc->inputBitDepth = hevc->outputBitDepth = ++ IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; ++#else + hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; ++#endif + + hevc->level = ctx->level; + +@@ -1386,6 +1455,25 @@ + hevc->numRefL1 = avctx->refs; + #endif + ++#ifdef NVENC_HAVE_TEMPORAL_FILTER ++ if (ctx->tf_level >= 0) { ++ hevc->tfLevel = ctx->tf_level; ++ ++ switch (ctx->tf_level) ++ { ++ case NV_ENC_TEMPORAL_FILTER_LEVEL_0: ++ case NV_ENC_TEMPORAL_FILTER_LEVEL_4: ++ break; ++ default: ++ av_log(avctx, AV_LOG_ERROR, "Invalid temporal filtering level.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ if (ctx->encode_config.frameIntervalP < 5) ++ av_log(avctx, AV_LOG_WARNING, "Temporal filtering needs at least 4 B-Frames (-bf 4).\n"); ++ } ++#endif ++ + return 0; + } + +@@ -1455,8 +1543,13 @@ + + av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; + ++#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API ++ av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; ++ av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; ++#else + av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; + av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0; ++#endif + + if (ctx->b_ref_mode >= 0) + av1->useBFramesAsRef = ctx->b_ref_mode; +@@ -1585,6 +1678,10 @@ + FF_ENABLE_DEPRECATION_WARNINGS + } + ++#ifdef NVENC_HAVE_UNIDIR_B ++ ctx->init_encode_params.enableUniDirectionalB = ctx->unidir_b; ++#endif ++ + ctx->init_encode_params.enableEncodeAsync = 0; + ctx->init_encode_params.enablePTD = 1; + +@@ -1633,7 +1730,9 @@ + + nvenc_recalc_surfaces(avctx); + +- nvenc_setup_rate_control(avctx); ++ res = nvenc_setup_rate_control(avctx); ++ if (res < 0) ++ return res; + + if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { + ctx->encode_config.frameFieldMode = NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD; +@@ -1689,15 +1788,15 @@ + { + switch (pix_fmt) { + case AV_PIX_FMT_YUV420P: +- return NV_ENC_BUFFER_FORMAT_YV12_PL; ++ return NV_ENC_BUFFER_FORMAT_YV12; + case AV_PIX_FMT_NV12: +- return NV_ENC_BUFFER_FORMAT_NV12_PL; ++ return NV_ENC_BUFFER_FORMAT_NV12; + case AV_PIX_FMT_P010: + case AV_PIX_FMT_P016: + return NV_ENC_BUFFER_FORMAT_YUV420_10BIT; + case AV_PIX_FMT_GBRP: + case AV_PIX_FMT_YUV444P: +- return NV_ENC_BUFFER_FORMAT_YUV444_PL; ++ return NV_ENC_BUFFER_FORMAT_YUV444; + case AV_PIX_FMT_GBRP16: + case AV_PIX_FMT_YUV444P16: + return NV_ENC_BUFFER_FORMAT_YUV444_10BIT; +@@ -2282,12 +2381,6 @@ + frame_data->duration = frame->duration; + frame_data->frame_opaque = frame->opaque; + +-#if FF_API_REORDERED_OPAQUE +-FF_DISABLE_DEPRECATION_WARNINGS +- frame_data->reordered_opaque = frame->reordered_opaque; +-FF_ENABLE_DEPRECATION_WARNINGS +-#endif +- + ctx->frame_data_array_pos = (ctx->frame_data_array_pos + 1) % ctx->frame_data_array_nb; + pic_params->inputDuration = idx; + +@@ -2304,12 +2397,6 @@ + + pkt->duration = frame_data->duration; + +-#if FF_API_REORDERED_OPAQUE +-FF_DISABLE_DEPRECATION_WARNINGS +- avctx->reordered_opaque = frame_data->reordered_opaque; +-FF_ENABLE_DEPRECATION_WARNINGS +-#endif +- + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) { + pkt->opaque = frame_data->frame_opaque; + pkt->opaque_ref = frame_data->frame_opaque_ref; +@@ -2697,6 +2784,7 @@ + pic_params.encodePicFlags = 0; + } + ++ pic_params.frameIdx = ctx->frame_idx_counter++; + pic_params.inputTimeStamp = frame->pts; + + if (ctx->extra_sei) { +diff -Nru a/libavcodec/nvenc.h b/libavcodec/nvenc.h +--- a/libavcodec/nvenc.h 2024-04-03 12:14:27.574532897 +0900 ++++ b/libavcodec/nvenc.h 2024-04-03 12:14:07.102483487 +0900 +@@ -83,6 +83,15 @@ + #define NVENC_NO_DEPRECATED_RC + #endif + ++// SDK 12.2 compile time feature checks ++#if NVENCAPI_CHECK_VERSION(12, 2) ++#define NVENC_HAVE_NEW_BIT_DEPTH_API ++#define NVENC_HAVE_TEMPORAL_FILTER ++#define NVENC_HAVE_LOOKAHEAD_LEVEL ++#define NVENC_HAVE_UHQ_TUNING ++#define NVENC_HAVE_UNIDIR_B ++#endif ++ + typedef struct NvencSurface + { + NV_ENC_INPUT_PTR input_surface; +@@ -100,10 +109,6 @@ + { + int64_t duration; + +-#if FF_API_REORDERED_OPAQUE +- int64_t reordered_opaque; +-#endif +- + void *frame_opaque; + AVBufferRef *frame_opaque_ref; + } NvencFrameData; +@@ -221,6 +226,8 @@ + + void *nvencoder; + ++ uint32_t frame_idx_counter; ++ + int preset; + int profile; + int level; +@@ -270,6 +277,9 @@ + int highbitdepth; + int max_slice_size; + int rgb_mode; ++ int tf_level; ++ int lookahead_level; ++ int unidir_b; + } NvencContext; + + int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/source/l/ffmpeg/250471ea1745fc703eb346a2a662304536a311b1.patch b/source/l/ffmpeg/250471ea1745fc703eb346a2a662304536a311b1.patch new file mode 100644 index 000000000..b735415ae --- /dev/null +++ b/source/l/ffmpeg/250471ea1745fc703eb346a2a662304536a311b1.patch @@ -0,0 +1,25 @@ +From 250471ea1745fc703eb346a2a662304536a311b1 Mon Sep 17 00:00:00 2001 +From: Sebastian Ramacher <sramacher@debian.org> +Date: Sun, 12 Nov 2023 18:46:28 +0100 +Subject: [PATCH] avcoded/fft: Fix memory leak if ctx2 is used + +Signed-off-by: James Almer <jamrial@gmail.com> +--- + libavcodec/avfft.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c +index 3ef076d222..999b5ed79a 100644 +--- a/libavcodec/avfft.c ++++ b/libavcodec/avfft.c +@@ -130,6 +130,7 @@ av_cold void av_mdct_end(FFTContext *s) + { + if (s) { + AVTXWrapper *w = (AVTXWrapper *)s; ++ av_tx_uninit(&w->ctx2); + av_tx_uninit(&w->ctx); + av_free(w); + } +-- +2.25.1 + diff --git a/source/l/ffmpeg/add-av_stream_get_first_dts-for-chromium.patch b/source/l/ffmpeg/add-av_stream_get_first_dts-for-chromium.patch new file mode 100644 index 000000000..20ea725da --- /dev/null +++ b/source/l/ffmpeg/add-av_stream_get_first_dts-for-chromium.patch @@ -0,0 +1,31 @@ +diff '--color=auto' -rupN ffmpeg.orig/libavformat/avformat.h ffmpeg/libavformat/avformat.h +--- ffmpeg.orig/libavformat/avformat.h 2022-08-19 17:42:47.323422603 +0200 ++++ ffmpeg/libavformat/avformat.h 2022-08-19 17:42:51.347130436 +0200 +@@ -1128,6 +1128,10 @@ struct AVCodecParserContext *av_stream_g + */ + int64_t av_stream_get_end_pts(const AVStream *st); + ++// Chromium: We use the internal field first_dts vvv ++int64_t av_stream_get_first_dts(const AVStream *st); ++// Chromium: We use the internal field first_dts ^^^ ++ + #define AV_PROGRAM_RUNNING 1 + + /** +diff '--color=auto' -rupN ffmpeg.orig/libavformat/mux_utils.c ffmpeg/libavformat/mux_utils.c +--- ffmpeg.orig/libavformat/mux_utils.c 2022-08-19 17:42:47.346758108 +0200 ++++ ffmpeg/libavformat/mux_utils.c 2022-08-19 17:47:28.549589002 +0200 +@@ -37,6 +37,13 @@ int64_t av_stream_get_end_pts(const AVSt + return AV_NOPTS_VALUE; + } + ++// Chromium: We use the internal field first_dts vvv ++int64_t av_stream_get_first_dts(const AVStream *st) ++{ ++ return cffstream(st)->first_dts; ++} ++// Chromium: We use the internal field first_dts ^^^ ++ + int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, + int std_compliance) + { diff --git a/source/l/ffmpeg/ffmpeg.SlackBuild b/source/l/ffmpeg/ffmpeg.SlackBuild index 49bfcc602..ca1e1356c 100755 --- a/source/l/ffmpeg/ffmpeg.SlackBuild +++ b/source/l/ffmpeg/ffmpeg.SlackBuild @@ -2,8 +2,8 @@ # Slackware build script for ffmpeg -# Copyright 2010-2017 Heinz Wiesinger, Amsterdam, The Netherlands -# Copyright 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2010-2024 Heinz Wiesinger, Amsterdam, The Netherlands +# Copyright 2017, 2018, 2022, 2024 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=ffmpeg VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} if [ -z "$ARCH" ]; then case "$( uname -m )" in @@ -46,10 +46,10 @@ PKG=$TMP/package-$PKGNAM NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} if [ "$ARCH" = "i586" ]; then - SLKCFLAGS="-O2 -march=i586 -mtune=i686" + SLKCFLAGS="-O2 -march=i586 -mtune=i686 -fPIC" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686 -mtune=i686" + SLKCFLAGS="-O2 -march=i686 -mtune=i686 -fPIC" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" @@ -89,13 +89,25 @@ fi # - xz # - zlib +# Select one of these for HTTPS support +ssl="" ; [ "${OPENSSL:-no}" != "no" ] && \ + { ssl="--enable-openssl" ; non_free="--enable-nonfree" ; } +gnutls="" ; [ "${GNUTLS:-yes}" != "no" ] && gnutls="--enable-gnutls" + +# Select one of these for RTMP[E] support +librtmp="" ; [ "${RTMP:-no}" != "no" ] && librtmp="--enable-librtmp" +gmp="" ; [ "${GMP:-no}" != "no" ] && gmp="--enable-gmp" +libgcrypt="" ; [ "${GCRYPT:-yes}" != "no" ] && libgcrypt="--enable-gcrypt" + +# Select one of these for GLSL->SPIRV compilation (Required for Vulkan support) +libglslang="" ; [ "${GLSLANG:-no}" != "no" ] && libglslang="--enable-libglslang" +shaderc="" ; [ "${SHADERC:-yes}" != "no" ] && libshaderc="--enable-libshaderc" + libx264="" ; [ "${X264:-no}" != "no" ] && libx264="--enable-libx264" libcelt="" ; [ "${CELT:-no}" != "no" ] && libcelt="--enable-libcelt" libdc1394="" ; [ "${DC1394:-no}" != "no" ] && libdc1394="--enable-libdc1394" libgsm="" ; [ "${GSM:-no}" != "no" ] && libgsm="--enable-libgsm" -librtmp="" ; [ "${RTMP:-no}" != "no" ] && librtmp="--enable-librtmp" libxvid="" ; [ "${XVID:-no}" != "no" ] && libxvid="--enable-libxvid" -libass="" ; [ "${ASS:-no}" != "no" ] && libass="--enable-libass" libiec61883=""; [ "${IEC61883:-no}" != "no" ] && libiec61883="--enable-libiec61883" libilbc="" ; [ "${ILBC:-no}" != "no" ] && libilbc="--enable-libilbc" libmodplug="" ; [ "${MODPLUG:-no}" != "no" ] && libmodplug="--enable-libmodplug" @@ -104,7 +116,6 @@ ladspa="" ; [ "${LADSPA:-no}" != "no" ] && ladspa="--enable-ladspa" libflite="" ; [ "${FLITE:-no}" != "no" ] && libflite="--enable-libflite" libx265="" ; [ "${X265:-no}" != "no" ] && libx265="--enable-libx265" libzvbi="" ; [ "${ZVBI:-no}" != "no" ] && libzvbi="--enable-libzvbi" -libopencv="" ; [ "${OPENCV:-no}" != "no" ] && libopencv="--enable-libopencv" libgme="" ; [ "${GME:-no}" != "no" ] && libgme="--enable-libgme" libsnappy="" ; [ "${SNAPPY:-no}" != "no" ] && libsnappy="--enable-libsnappy" libzmq="" ; [ "${ZMQ:-no}" != "no" ] && libzmq="--enable-libzmq" @@ -112,9 +123,7 @@ libbs2b="" ; [ "${BS2B:-no}" != "no" ] && libbs2b="--enable-libbs2b" rubberband="" ; [ "${RUBBERBAND:-no}" != "no" ] && rubberband="--enable-librubberband" tesseract="" ; [ "${TESSERACT:-no}" != "no" ] && tesseract="--enable-libtesseract" libjack="" ; [ "${JACK:-no}" != "no" ] && libjack="--enable-libjack" -libaom="" ; [ "${AOM:-no}" != "no" ] && libaom="--enable-libaom" lv2="" ; [ "${LV2:-no}" != "no" ] && lv2="--enable-lv2" -libdav1d="" ; [ "${DAV1D:-no}" != "no" ] && libdav1d="--enable-libdav1d" rabbitmq="" ; [ "${RABBITMQ:-no}" != "no" ] && rabbitmq="--enable-librabbitmq" libcodec2="" ; [ "${CODEC2:-no}" != "no" ] && libcodec2="--enable-libcodec2" libsoxr="" ; [ "${SOXR:-no}" != "no" ] && libsoxr="--enable-libsoxr" @@ -126,23 +135,33 @@ opencore_amr="" ; [ "${OPENCORE:-no}" != "no" ] && \ opencore_amr="--enable-libopencore-amrnb --enable-libopencore-amrwb" fdk="" ; [ "${FDK_AAC:-no}" != "no" ] && \ { fdk="--enable-libfdk-aac"; non_free="--enable-nonfree" ; } -ssl="" ; [ "${OPENSSL:-no}" != "no" ] && \ - { ssl="--enable-openssl" ; non_free="--enable-nonfree" ; } decklink="" ; [ "${DECKLINK:-no}" != "no" ] && \ { decklink="--enable-decklink" ; \ SLKCFLAGS="$SLKCFLAGS -I/usr/include/decklink" ; } -vulkan="" ; [ "${VULKAN:-no}" != "no" ] && vulkan="--enable-vulkan" -libglslang="" ; [ "${GLSLANG:-no}" != "no" ] && libglslang="--enable-libglslang" +libaribb24="" ; [ "${ARIBB24:-no}" != "no" ] && libaribb24="--enable-libaribb24" +libjxl="" ; [ "${JXL:-no}" != "no" ] && libjxl="--enable-libjxl" +librist="" ; [ "${RIST:-no}" != "no" ] && librist="--enable-librist" +libshine="" ; [ "${SHINE:-no}" != "no" ] && libshine="--enable-libshine" +svtav1="" ; [ "${SVTAV1:-no}" != "no" ] && svtav1="--enable-libsvtav1" +libmysofa="" ; [ "${MYSOFA:-no}" != "no" ] && libmysofa="--enable-libmysofa" +libxavs2="" ; [ "${XAVS2:-no}" != "no" ] && libxavs2="--enable-libxavs2" +libvmaf="" ; [ "${VMAF:-no}" != "no" ] && libvmaf="--enable-libvmaf" + +# Needs older opencv than we ship. See https://trac.ffmpeg.org/ticket/7059 +libopencv="" ; [ "${OPENCV:-no}" != "no" ] && libopencv="--enable-libopencv" + +# Needs newer lensfun than we ship. See https://trac.ffmpeg.org/ticket/9112 liblensfun="" ; [ "${LENSFUN:-no}" != "no" ] && liblensfun="--enable-liblensfun" # Default enabled features: fontconfig="" ; [ "${FONTCONFIG:-yes}" != "no" ] && fontconfig="--enable-libfontconfig" freetype="" ; [ "${FREETYPE:-yes}" != "no" ] && freetype="--enable-libfreetype" fribidi="" ; [ "${FRIBIDI:-yes}" != "no" ] && fribidi="--enable-libfribidi" -gnutls="" ; [ "${GNUTLS:-yes}" != "no" ] && gnutls="--enable-gnutls" +libaom="" ; [ "${AOM:-yes}" != "no" ] && libaom="--enable-libaom" libbluray="" ; [ "${BLURAY:-yes}" != "no" ] && libbluray="--enable-libbluray" libcaca="" ; [ "${CACA:-yes}" != "no" ] && libcaca="--enable-libcaca" libcdio="" ; [ "${LIBCDIO:-yes}" != "no" ] && libcdio="--enable-libcdio" +libdav1d="" ; [ "${DAV1D:-yes}" != "no" ] && libdav1d="--enable-libdav1d" libssh="" ; [ "${LIBSSH:-yes}" != "no" ] && libssh="--enable-libssh" libtheora="" ; [ "${THEORA:-yes}" != "no" ] && libtheora="--enable-libtheora" libv4l2="" ; [ "${V4L2:-yes}" != "no" ] && libv4l2="--enable-libv4l2" @@ -163,6 +182,10 @@ libvidstab="" ; [ "${VIDSTAB:-yes}" != "no" ] && libvidstab="--enable-libvid libxml2="" ; [ "${LIBXML2:-yes}" != "no" ] && libxml2="--enable-libxml2" librsvg="" ; [ "${LIBRSVG:-yes}" != "no" ] && librsvg="--enable-librsvg" libdrm="" ; [ "${LIBDRM:-yes}" != "no" ] && libdrm="--enable-libdrm" +vulkan="" ; [ "${VULKAN:-yes}" != "no" ] && vulkan="--enable-vulkan" +libass="" ; [ "${ASS:-yes}" != "no" ] && libass="--enable-libass" +libplacebo="" ; [ "${PLACEBO:-yes}" != "no" ] && libplacebo="--enable-libplacebo" +lcms2="" ; [ "${LCMS2:-yes}" != "no" ] && lcms2="--enable-lcms2" # No default patent encumbered features: aac="" ; [ "${AAC:-no}" = "no" ] && aac="--disable-encoder=aac" @@ -171,7 +194,7 @@ rm -rf $PKG mkdir -p $TMP $PKG cd $TMP rm -rf $PKGNAM-$VERSION -tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1 +tar xf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1 cd $PKGNAM-$VERSION || exit 1 chown -R root:root . @@ -181,9 +204,17 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ -# Fix linking with flite: -sed -i "s| -lflite\"| -lflite -lm -lasound\"|" \ - ./configure +# Restore missing function needed by Chromium and qt-webengine: +zcat $CWD/add-av_stream_get_first_dts-for-chromium.patch.gz | patch -p1 --verbose || exit 1 + +# Build against recent Vulkan: +zcat $CWD/ffmpeg.vulkan.diff.gz | patch -p1 --verbose || exit 1 + +# Fix ctx memory leak: +zcat $CWD/250471ea1745fc703eb346a2a662304536a311b1.patch | patch -p1 --verbose || exit 1 + +# Patch for recent nv-codec-headers: +zcat $CWD/0004-support-nv-codec-headers-12.2.patch.gz | patch -p1 --verbose || exit 1 CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ @@ -198,7 +229,6 @@ CXXFLAGS="$SLKCFLAGS" \ --disable-static \ --enable-gpl \ --enable-version3 \ - --enable-avresample \ --arch=$ARCH \ $non_free \ $aac \ @@ -268,7 +298,20 @@ CXXFLAGS="$SLKCFLAGS" \ $libsoxr \ $libsrt \ $libzimg \ - $vapoursynth || exit 1 + $vapoursynth \ + $libshaderc \ + $libgcrypt \ + $libplacebo \ + $lcms2 \ + $gmp \ + $libaribb24 \ + $libjxl \ + $librist \ + $libshine \ + $svtav1 \ + $libmysofa \ + $libxavs2 \ + $libvmaf || exit 1 make $NUMJOBS || make || exit 1 make install DESTDIR=$PKG || exit 1 diff --git a/source/l/ffmpeg/ffmpeg.vulkan.diff b/source/l/ffmpeg/ffmpeg.vulkan.diff new file mode 100644 index 000000000..afd963664 --- /dev/null +++ b/source/l/ffmpeg/ffmpeg.vulkan.diff @@ -0,0 +1,15 @@ +--- ./configure.orig 2023-03-26 09:21:00.000000000 -0500 ++++ ./configure 2023-08-29 13:13:08.176019532 -0500 +@@ -6551,10 +6551,10 @@ + enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType + enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info + enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ +- -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \ ++ -lglslang -lMachineIndependent -lHLSL -lGenericCodeGen \ + -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm || + require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ +- -lglslang -lOSDependent -lHLSL -lOGLCompiler \ ++ -lglslang -lHLSL \ + -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; } + enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu || + require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } |