From 0290468dd48bd85c63d2cdb94d22b695b8af14e3 Mon Sep 17 00:00:00 2001 From: psykose Date: Mon, 30 Sep 2024 11:49:06 +0200 Subject: [PATCH] main/ffmpeg: update to 7.1 --- ...01-ffbuild-libversion.sh-add-shebang.patch | 24 --- main/ffmpeg/patches/bigendian.patch | 23 --- main/ffmpeg/patches/v4l-ioctl.patch | 2 +- main/ffmpeg/patches/vaapi-1.patch | 184 ------------------ main/ffmpeg/patches/vaapi-2.patch | 110 ----------- main/ffmpeg/patches/x265-4.patch | 98 ---------- main/ffmpeg/template.py | 6 +- 7 files changed, 4 insertions(+), 443 deletions(-) delete mode 100644 main/ffmpeg/patches/0001-ffbuild-libversion.sh-add-shebang.patch delete mode 100644 main/ffmpeg/patches/bigendian.patch delete mode 100644 main/ffmpeg/patches/vaapi-1.patch delete mode 100644 main/ffmpeg/patches/vaapi-2.patch delete mode 100644 main/ffmpeg/patches/x265-4.patch diff --git a/main/ffmpeg/patches/0001-ffbuild-libversion.sh-add-shebang.patch b/main/ffmpeg/patches/0001-ffbuild-libversion.sh-add-shebang.patch deleted file mode 100644 index 1df16917b9..0000000000 --- a/main/ffmpeg/patches/0001-ffbuild-libversion.sh-add-shebang.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 3eb43e2e9df80baad20722b3698e6995a546853a Mon Sep 17 00:00:00 2001 -From: Carlo Landmeter -Date: Tue, 29 Jun 2021 11:56:32 +0000 -Subject: [PATCH] ffbuild/libversion.sh: add shebang - -when using something like qemu-user where argv[0] is qemu the script -will not be exexuted by the shell. ---- - ffbuild/libversion.sh | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/ffbuild/libversion.sh b/ffbuild/libversion.sh -index 990ce9f640..30046b1d25 100755 ---- a/ffbuild/libversion.sh -+++ b/ffbuild/libversion.sh -@@ -1,3 +1,5 @@ -+#!/bin/sh -+ - toupper(){ - echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ - } --- -2.32.0 - diff --git a/main/ffmpeg/patches/bigendian.patch b/main/ffmpeg/patches/bigendian.patch deleted file mode 100644 index 3b6f98a13d..0000000000 --- a/main/ffmpeg/patches/bigendian.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit 5cb1f50717e777b21463462c5bebf1d681265d75 -Author: q66 -Date: Tue Dec 5 01:21:54 2023 +0100 - - less crappy big endian check - -diff --git a/configure b/configure -index 3cd3bdf..9d91611 100755 ---- a/configure -+++ b/configure -@@ -5917,11 +5917,7 @@ done - - check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")' - --# The global variable ensures the bits appear unchanged in the object file. --test_cc < -Date: Wed, 8 May 2024 09:11:11 +0200 -Subject: [PATCH] lavc/vaapi_decode: Make it possible to send multiple slice - params buffers - -Reviewed-by: Neal Gompa -Signed-off-by: David Rosca -Signed-off-by: Haihao Xiang ---- - libavcodec/vaapi_av1.c | 2 +- - libavcodec/vaapi_decode.c | 3 ++- - libavcodec/vaapi_decode.h | 1 + - libavcodec/vaapi_h264.c | 2 +- - libavcodec/vaapi_hevc.c | 4 ++-- - libavcodec/vaapi_mjpeg.c | 2 +- - libavcodec/vaapi_mpeg2.c | 2 +- - libavcodec/vaapi_mpeg4.c | 2 +- - libavcodec/vaapi_vc1.c | 2 +- - libavcodec/vaapi_vp8.c | 2 +- - libavcodec/vaapi_vp9.c | 2 +- - 11 files changed, 13 insertions(+), 11 deletions(-) - -diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c -index f61bf630988a7..e184d01a4326f 100644 ---- a/libavcodec/vaapi_av1.c -+++ b/libavcodec/vaapi_av1.c -@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - .tg_end = s->tg_end, - }; - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, - sizeof(VASliceParameterBufferAV1), - buffer, - size); -diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c -index 7f2fe032db1c8..7c91d50f7bfdd 100644 ---- a/libavcodec/vaapi_decode.c -+++ b/libavcodec/vaapi_decode.c -@@ -63,6 +63,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, - int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - VAAPIDecodePicture *pic, - const void *params_data, -+ int nb_params, - size_t params_size, - const void *slice_data, - size_t slice_size) -@@ -88,7 +89,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - - vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, - VASliceParameterBufferType, -- params_size, 1, (void*)params_data, -+ params_size, nb_params, (void*)params_data, - &pic->slice_buffers[index]); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to create slice " -diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h -index 6beda14e52e8f..702171e1087fa 100644 ---- a/libavcodec/vaapi_decode.h -+++ b/libavcodec/vaapi_decode.h -@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, - int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, - VAAPIDecodePicture *pic, - const void *params_data, -+ int nb_params, - size_t params_size, - const void *slice_data, - size_t slice_size); -diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c -index 55cf5a05ee3a4..b47531ce1c60f 100644 ---- a/libavcodec/vaapi_h264.c -+++ b/libavcodec/vaapi_h264.c -@@ -375,7 +375,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx, - slice_param.chroma_offset_l1); - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c -index 3bdd2dd1b8177..3937b7574aabd 100644 ---- a/libavcodec/vaapi_hevc.c -+++ b/libavcodec/vaapi_hevc.c -@@ -353,7 +353,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) - if (pic->last_size) { - last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1; - ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic, -- &pic->last_slice_param, slice_param_size, -+ &pic->last_slice_param, 1, slice_param_size, - pic->last_buffer, pic->last_size); - if (ret < 0) - goto fail; -@@ -471,7 +471,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, - - if (!sh->first_slice_in_pic_flag) { - err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic, -- &pic->last_slice_param, slice_param_size, -+ &pic->last_slice_param, 1, slice_param_size, - pic->last_buffer, pic->last_size); - pic->last_buffer = NULL; - pic->last_size = 0; -diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c -index 5b8d47bb2a501..9557cf5f9bbae 100644 ---- a/libavcodec/vaapi_mjpeg.c -+++ b/libavcodec/vaapi_mjpeg.c -@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx, - sp.components[i].ac_table_selector = s->ac_index[i]; - } - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size); -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size); - if (err) - goto fail; - -diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c -index eeb4e8732105d..171a742c7f09c 100644 ---- a/libavcodec/vaapi_mpeg2.c -+++ b/libavcodec/vaapi_mpeg2.c -@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer - }; - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err < 0) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c -index 363b686e42e5b..612de10cd777f 100644 ---- a/libavcodec/vaapi_mpeg4.c -+++ b/libavcodec/vaapi_mpeg4.c -@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer - }; - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err < 0) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c -index 5594118a69dc5..abbe877dd8635 100644 ---- a/libavcodec/vaapi_vc1.c -+++ b/libavcodec/vaapi_vc1.c -@@ -490,7 +490,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, - }; - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err < 0) { - ff_vaapi_decode_cancel(avctx, pic); -diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c -index 31137a45bd1be..66fdde1f39d6a 100644 ---- a/libavcodec/vaapi_vp8.c -+++ b/libavcodec/vaapi_vp8.c -@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx, - for (i = 0; i < 8; i++) - sp.partition_size[i+1] = s->coeff_partition_size[i]; - -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size); -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size); - if (err) - goto fail; - -diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c -index b8e760c80751c..a28fc75a59e24 100644 ---- a/libavcodec/vaapi_vp9.c -+++ b/libavcodec/vaapi_vp9.c -@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx, - } - - err = ff_vaapi_decode_make_slice_buffer(avctx, pic, -- &slice_param, sizeof(slice_param), -+ &slice_param, 1, sizeof(slice_param), - buffer, size); - if (err) { - ff_vaapi_decode_cancel(avctx, pic); diff --git a/main/ffmpeg/patches/vaapi-2.patch b/main/ffmpeg/patches/vaapi-2.patch deleted file mode 100644 index c1f19dfafb..0000000000 --- a/main/ffmpeg/patches/vaapi-2.patch +++ /dev/null @@ -1,110 +0,0 @@ -Patch-Source: https://github.com/FFmpeg/FFmpeg/commit/d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba --- -From d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba Mon Sep 17 00:00:00 2001 -From: David Rosca -Date: Wed, 8 May 2024 09:11:13 +0200 -Subject: [PATCH] lavc/vaapi_av1: Avoid sending the same slice buffer multiple - times - -When there are multiple tiles in one slice buffer, use multiple slice -params to avoid sending the same slice buffer multiple times and thus -increasing the bitstream size the driver will need to upload to hw. - -Reviewed-by: Neal Gompa -Signed-off-by: David Rosca -Signed-off-by: Haihao Xiang ---- - libavcodec/vaapi_av1.c | 47 +++++++++++++++++++++++++++++------------- - 1 file changed, 33 insertions(+), 14 deletions(-) - -diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c -index e184d01a4326f..fe0852318d01a 100644 ---- a/libavcodec/vaapi_av1.c -+++ b/libavcodec/vaapi_av1.c -@@ -19,6 +19,7 @@ - */ - - #include "libavutil/frame.h" -+#include "libavutil/mem.h" - #include "hwaccel_internal.h" - #include "vaapi_decode.h" - #include "internal.h" -@@ -42,6 +43,9 @@ typedef struct VAAPIAV1DecContext { - */ - VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES]; - AVFrame *tmp_frame; -+ -+ int nb_slice_params; -+ VASliceParameterBufferAV1 *slice_params; - } VAAPIAV1DecContext; - - static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf) -@@ -97,6 +101,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx) - for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++) - av_frame_free(&ctx->ref_tab[i].frame); - -+ av_freep(&ctx->slice_params); -+ - return ff_vaapi_decode_uninit(avctx); - } - -@@ -393,13 +399,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - { - const AV1DecContext *s = avctx->priv_data; - VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private; -- VASliceParameterBufferAV1 slice_param; -- int err = 0; -+ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data; -+ int err, nb_params; -+ -+ nb_params = s->tg_end - s->tg_start + 1; -+ if (ctx->nb_slice_params < nb_params) { -+ ctx->slice_params = av_realloc_array(ctx->slice_params, -+ nb_params, -+ sizeof(*ctx->slice_params)); -+ if (!ctx->slice_params) { -+ ctx->nb_slice_params = 0; -+ err = AVERROR(ENOMEM); -+ goto fail; -+ } -+ ctx->nb_slice_params = nb_params; -+ } - - for (int i = s->tg_start; i <= s->tg_end; i++) { -- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1)); -- -- slice_param = (VASliceParameterBufferAV1) { -+ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) { - .slice_data_size = s->tile_group_info[i].tile_size, - .slice_data_offset = s->tile_group_info[i].tile_offset, - .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, -@@ -408,18 +425,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx, - .tg_start = s->tg_start, - .tg_end = s->tg_end, - }; -- -- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1, -- sizeof(VASliceParameterBufferAV1), -- buffer, -- size); -- if (err) { -- ff_vaapi_decode_cancel(avctx, pic); -- return err; -- } - } - -+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params, -+ sizeof(VASliceParameterBufferAV1), -+ buffer, -+ size); -+ if (err) -+ goto fail; -+ - return 0; -+ -+fail: -+ ff_vaapi_decode_cancel(avctx, pic); -+ return err; - } - - const FFHWAccel ff_av1_vaapi_hwaccel = { diff --git a/main/ffmpeg/patches/x265-4.patch b/main/ffmpeg/patches/x265-4.patch deleted file mode 100644 index 82178d660f..0000000000 --- a/main/ffmpeg/patches/x265-4.patch +++ /dev/null @@ -1,98 +0,0 @@ -Patch-Source: https://github.com/FFmpeg/FFmpeg/commit/1f801dfdb5066aadf0ade9cb5e94d620f33eacdc --- -From 1f801dfdb5066aadf0ade9cb5e94d620f33eacdc Mon Sep 17 00:00:00 2001 -From: Gyan Doshi -Date: Sun, 11 Aug 2024 12:51:50 +0530 -Subject: [PATCH] lavc/libx265: unbreak build for X265_BUILD >= 210 - -x265 added support for alpha starting with build 210. -While doing so, x265_encoder_encode() changed its fifth arg to -an array of pointers to x265_picture. This broke building lavc/libx265.c - -This patch simply unbreaks the build and maintains existing single-layer -non-alpha encoding support. - -Fixes #11130 ---- - libavcodec/libx265.c | 40 ++++++++++++++++++++++++++++++---------- - 1 file changed, 30 insertions(+), 10 deletions(-) - -diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c -index 0dc7ab6eeb6a3..3bc3b5a03e9fc 100644 ---- a/libavcodec/libx265.c -+++ b/libavcodec/libx265.c -@@ -661,7 +661,13 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, - { - libx265Context *ctx = avctx->priv_data; - x265_picture x265pic; -- x265_picture x265pic_out = { 0 }; -+#if X265_BUILD >= 210 -+ x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS]; -+ x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS]; -+#else -+ x265_picture x265pic_solo_out = { 0 }; -+#endif -+ x265_picture* x265pic_out; - x265_nal *nal; - x265_sei *sei; - uint8_t *dst; -@@ -798,8 +804,16 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, - #endif - } - -+#if X265_BUILD >= 210 -+ for (i = 0; i < MAX_SCALABLE_LAYERS; i++) -+ x265pic_lyrptr_out[i] = &x265pic_layers_out[i]; -+ -+ ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, -+ pic ? &x265pic : NULL, x265pic_lyrptr_out); -+#else - ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, -- pic ? &x265pic : NULL, &x265pic_out); -+ pic ? &x265pic : NULL, &x265pic_solo_out); -+#endif - - for (i = 0; i < sei->numPayloads; i++) - av_free(sei->payloads[i].payload); -@@ -829,10 +843,16 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, - pkt->flags |= AV_PKT_FLAG_KEY; - } - -- pkt->pts = x265pic_out.pts; -- pkt->dts = x265pic_out.dts; -+#if X265_BUILD >= 210 -+ x265pic_out = x265pic_lyrptr_out[0]; -+#else -+ x265pic_out = &x265pic_solo_out; -+#endif -+ -+ pkt->pts = x265pic_out->pts; -+ pkt->dts = x265pic_out->dts; - -- switch (x265pic_out.sliceType) { -+ switch (x265pic_out->sliceType) { - case X265_TYPE_IDR: - case X265_TYPE_I: - pict_type = AV_PICTURE_TYPE_I; -@@ -850,16 +870,16 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, - } - - #if X265_BUILD >= 130 -- if (x265pic_out.sliceType == X265_TYPE_B) -+ if (x265pic_out->sliceType == X265_TYPE_B) - #else -- if (x265pic_out.frameData.sliceType == 'b') -+ if (x265pic_out->frameData.sliceType == 'b') - #endif - pkt->flags |= AV_PKT_FLAG_DISPOSABLE; - -- ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type); -+ ff_side_data_set_encoder_stats(pkt, x265pic_out->frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type); - -- if (x265pic_out.userData) { -- int idx = (int)(intptr_t)x265pic_out.userData - 1; -+ if (x265pic_out->userData) { -+ int idx = (int)(intptr_t)x265pic_out->userData - 1; - ReorderedData *rd = &ctx->rd[idx]; - - pkt->duration = rd->duration; diff --git a/main/ffmpeg/template.py b/main/ffmpeg/template.py index be064aa66f..b70cbc0cc9 100644 --- a/main/ffmpeg/template.py +++ b/main/ffmpeg/template.py @@ -1,6 +1,6 @@ pkgname = "ffmpeg" -pkgver = "7.0.2" -pkgrel = 4 +pkgver = "7.1" +pkgrel = 0 build_style = "configure" configure_args = [ "--prefix=/usr", @@ -145,7 +145,7 @@ license = "GPL-3.0-or-later" url = "https://ffmpeg.org" source = f"{url}/releases/ffmpeg-{pkgver}.tar.xz" -sha256 = "8646515b638a3ad303e23af6a3587734447cb8fc0a0c064ecdb8e95c4fd8b389" +sha256 = "40973d44970dbc83ef302b0609f2e74982be2d85916dd2ee7472d30678a7abe6" # seems to need rpath? options = ["!check"]