aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/vlc
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/vlc')
-rw-r--r--multimedia/vlc/Makefile5
-rw-r--r--multimedia/vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch1139
-rw-r--r--multimedia/vlc/files/vlc-3.0.21-ffmpeg8-1.patch393
3 files changed, 1536 insertions, 1 deletions
diff --git a/multimedia/vlc/Makefile b/multimedia/vlc/Makefile
index ab13839863c3..a8894e4d3642 100644
--- a/multimedia/vlc/Makefile
+++ b/multimedia/vlc/Makefile
@@ -1,6 +1,6 @@
PORTNAME= vlc
DISTVERSION= 3.0.21
-PORTREVISION= 18
+PORTREVISION= 20
PORTEPOCH= 4
CATEGORIES= multimedia audio net www
MASTER_SITES= https://get.videolan.org/${PORTNAME}/${DISTVERSION:S/a$//}/ \
@@ -28,6 +28,9 @@ LIB_DEPENDS= libgcrypt.so:security/libgcrypt \
libebml.so:textproc/libebml
RUN_DEPENDS= ffmpeg>=3.4.1,1:multimedia/ffmpeg
+EXTRA_PATCHES= ${FILESDIR}/vlc-3.0.21-fedora_ffmpeg7-1.patch:-p1 \
+ ${FILESDIR}/vlc-3.0.21-ffmpeg8-1.patch:-p1
+
USES= compiler:c++17-lang cpe desktop-file-utils elfctl gettext-tools \
gl gmake gnome iconv:wchar_t libtool localbase pathfix pkgconfig \
tar:xz
diff --git a/multimedia/vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch b/multimedia/vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch
new file mode 100644
index 000000000000..d6df9831ddca
--- /dev/null
+++ b/multimedia/vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch
@@ -0,0 +1,1139 @@
+Submitted By: Bruce Dubbs <bdubbs@linuxfromscratch.org>
+Date: 2024-05-27
+Initial Package Version: 3.0.20
+Upstream Status: Unknown
+Origin: Fedora
+Description: Fixes compilation with ffmpeg-7
+
+From 965ad6ca875fea94712b4e8b107d0100937dcd4f Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4@ycbcr.xyz>
+Date: Fri, 3 Aug 2018 10:59:16 +0200
+Subject: [PATCH] avcodec: remove libavutils checks that are always true based
+ on configure checks
+
+We assume we use 55.9.0 and 55.22.101
+---
+ modules/codec/avcodec/avcommon_compat.h | 4 ----
+ modules/codec/avcodec/chroma.c | 6 ------
+ modules/codec/avcodec/encoder.c | 6 +-----
+ modules/codec/avcodec/va.c | 5 +----
+ modules/codec/avcodec/video.c | 12 ++----------
+ 5 files changed, 4 insertions(+), 29 deletions(-)
+
+diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
+index 8f9c12081cf8..afd5cc476f8f 100644
+--- a/modules/codec/avcodec/avcommon_compat.h
++++ b/modules/codec/avcodec/avcommon_compat.h
+@@ -91,10 +91,6 @@
+ ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
+ (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
+
+-#if !LIBAVUTIL_VERSION_CHECK( 52, 11, 0, 32, 100 )
+-# define AV_PIX_FMT_FLAG_HWACCEL PIX_FMT_HWACCEL
+-#endif
+-
+ /*
+ * AV_PIX_FMT_VAAPI is not introduced in the same major version in libav and FFmpeg:
+ * - libav: lavu 55.8.0: libav/d264c720f7b74286840719e506daba39f83b438b
+diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
+index cd8d714bf295..454a20381e41 100644
+--- a/modules/codec/avcodec/chroma.c
++++ b/modules/codec/avcodec/chroma.c
+@@ -145,13 +145,11 @@ static const struct
+ VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_0BGR32, AV_PIX_FMT_0RGB32, 0x000000ff, 0x0000ff00, 0x00ff0000 )
+ #endif
+
+-#if (LIBAVUTIL_VERSION_MICRO == 0 || LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 0, 100 ) )
+ #ifdef WORDS_BIGENDIAN
+ {VLC_CODEC_RGBA64, AV_PIX_FMT_RGBA64BE, 0, 0, 0 },
+ #else /* !WORDS_BIGENDIAN */
+ {VLC_CODEC_RGBA64, AV_PIX_FMT_RGBA64LE, 0, 0, 0 },
+ #endif /* !WORDS_BIGENDIAN */
+-#endif
+
+ {VLC_CODEC_RGBA, AV_PIX_FMT_RGBA, 0, 0, 0 },
+ {VLC_CODEC_ARGB, AV_PIX_FMT_ARGB, 0, 0, 0 },
+@@ -180,9 +178,7 @@ static const struct
+ {VLC_CODEC_GBR_PLANAR_16B, AV_PIX_FMT_GBRP16BE, 0, 0, 0 },
+
+ /* XYZ */
+-#if LIBAVUTIL_VERSION_CHECK(52, 10, 0, 25, 100)
+ {VLC_CODEC_XYZ12, AV_PIX_FMT_XYZ12, 0xfff0, 0xfff0, 0xfff0},
+-#endif
+ { 0, 0, 0, 0, 0 }
+ };
+
+diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
+index a00439e93965..cbe150c7016f 100644
+--- a/modules/codec/avcodec/encoder.c
++++ b/modules/codec/avcodec/encoder.c
+@@ -48,9 +48,7 @@
+ #include "avcodec.h"
+ #include "avcommon.h"
+
+-#if LIBAVUTIL_VERSION_CHECK( 52,2,6,0,0 )
+-# include <libavutil/channel_layout.h>
+-#endif
++#include <libavutil/channel_layout.h>
+
+ #define HURRY_UP_GUARD1 (450000)
+ #define HURRY_UP_GUARD2 (300000)
+@@ -740,7 +738,6 @@ int InitVideoEnc( vlc_object_t *p_this )
+ p_context->time_base.num = 1;
+ p_context->time_base.den = p_context->sample_rate;
+ p_context->channels = p_enc->fmt_out.audio.i_channels;
+-#if LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 0)
+ p_context->channel_layout = channel_mask[p_context->channels][1];
+
+ /* Setup Channel ordering for multichannel audio
+@@ -790,7 +787,6 @@ int InitVideoEnc( vlc_object_t *p_this )
+ p_sys->i_channels_to_reorder =
+ aout_CheckChannelReorder( NULL, pi_order_dst, order_mask,
+ p_sys->pi_reorder_layout );
+-#endif
+
+ if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A )
+ {
+diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
+index d1e3048259be..ecf4e8aa14a1 100644
+--- a/modules/codec/avcodec/va.c
++++ b/modules/codec/avcodec/va.c
+@@ -58,7 +58,6 @@ vlc_fourcc_t vlc_va_GetChroma(enum Pixel
+ }
+ break;
+
+-#if LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
+ case AV_PIX_FMT_D3D11VA_VLD:
+ switch (swfmt)
+ {
+@@ -68,8 +67,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum Pixel
+ return VLC_CODEC_D3D11_OPAQUE;
+ }
+ break;
+-#endif
+-#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 4, 0))
++
+ case AV_PIX_FMT_VDPAU:
+ switch (swfmt)
+ {
+@@ -86,7 +84,6 @@ vlc_fourcc_t vlc_va_GetChroma(enum Pixel
+ return 0;
+ }
+ break;
+-#endif
+ default:
+ return 0;
+ }
+diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
+index a9d45ba4abe1..3c2b3adb2663 100644
+--- a/modules/codec/avcodec/video.c
++++ b/modules/codec/avcodec/video.c
+@@ -39,7 +39,7 @@
+ #include <libavcodec/avcodec.h>
+ #include <libavutil/mem.h>
+ #include <libavutil/pixdesc.h>
+-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 16, 101 ) )
++#if (LIBAVUTIL_VERSION_MICRO >= 100)
+ #include <libavutil/mastering_display_metadata.h>
+ #endif
+
+@@ -687,15 +687,11 @@ static int ffmpeg_OpenVa(decoder_t *p_de
+ static const enum PixelFormat hwfmts[] =
+ {
+ #ifdef _WIN32
+-#if LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
+ AV_PIX_FMT_D3D11VA_VLD,
+-#endif
+ AV_PIX_FMT_DXVA2_VLD,
+ #endif
+ AV_PIX_FMT_VAAPI,
+-#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 4, 0))
+ AV_PIX_FMT_VDPAU,
+-#endif
+ AV_PIX_FMT_NONE,
+ };
+
+@@ -995,7 +991,7 @@ static int DecodeSidedata( decoder_t *p_
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ bool format_changed = false;
+
+-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 16, 101 ) )
++#if (LIBAVUTIL_VERSION_MICRO >= 100)
+ #define FROM_AVRAT(default_factor, avrat) \
+ (uint64_t)(default_factor) * (avrat).num / (avrat).den
+ const AVFrameSideData *metadata =
+--
+GitLab
+
+
+From 16fd46fa506424134beb53ec88be3eea1b42a221 Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Wed, 7 Jul 2021 12:37:58 +0000
+Subject: [PATCH] avcodec: remove use of av_init_packet as it is deprecated in
+ new ffmpeg major version
+
+av_init_packet is deprecated in new major version of ffmpeg.
+
+Also use av_packet_free instead of unref.
+
+Use av_packet_clone and AVPacket * in vlc_av_packet_t.
+---
+ modules/codec/avcodec/subtitle.c | 4 ----
+ 5 files changed, 0 insertions(+), 4 deletions(-)
+
+
+diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
+index a92522e4ed00..4cb920a8f444 100644
+--- a/modules/codec/avcodec/subtitle.c
++++ b/modules/codec/avcodec/subtitle.c
+@@ -90,11 +90,7 @@ int InitSubtitleDec(vlc_object_t *obj)
+ context->extradata_size = 0;
+ context->extradata = NULL;
+
+-#if LIBAVFORMAT_VERSION_MAJOR >= 59
+ context->pkt_timebase=AV_TIME_BASE_Q;
+-#elif LIBAVFORMAT_VERSION_MICRO >= 100
+- av_codec_set_pkt_timebase(context, AV_TIME_BASE_Q);
+-#endif
+
+ /* */
+ int ret;
+--
+GitLab
+
+
+From 18e98b8a0c410be5e1e9eac55052fe0c56901759 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Tue, 30 Nov 2021 18:20:39 +0100
+Subject: [PATCH] avcommon: remove libav from version check macros
+
+---
+ modules/codec/avcodec/avcommon_compat.h | 29 ++++++++++++-------------
+ modules/codec/avcodec/fourcc.c | 4 ++--
+ modules/codec/avcodec/video.c | 4 ++--
+ modules/demux/avformat/mux.c | 10 ++++-----
+ 5 files changed, 23 insertions(+), 24 deletions(-)
+
+diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
+index 90de502d99ce..010b570e0820 100644
+--- a/modules/codec/avcodec/avcommon_compat.h
++++ b/modules/codec/avcodec/avcommon_compat.h
+@@ -30,13 +30,13 @@
+ #ifdef HAVE_LIBAVCODEC_AVCODEC_H
+ #include <libavcodec/avcodec.h>
+
+-/* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
++/* LIBAVCODEC_VERSION_CHECK checks for the right version of FFmpeg
+ * a is the major version
+- * b and c the minor and micro versions of libav
+- * d and e the minor and micro versions of FFmpeg */
+-#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \
+- ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
+- (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
++ * b is the minor version
++ * c is the micro version
++ */
++#define LIBAVCODEC_VERSION_CHECK( a, b, c ) \
++ (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) )
+
+ #ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT
+ # define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT
+@@ -83,13 +83,13 @@
+ #ifdef HAVE_LIBAVUTIL_AVUTIL_H
+ # include <libavutil/avutil.h>
+
+-/* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
++/* LIBAVUTIL_VERSION_CHECK checks for the right version of FFmpeg
+ * a is the major version
+- * b and c the minor and micro versions of libav
+- * d and e the minor and micro versions of FFmpeg */
+-#define LIBAVUTIL_VERSION_CHECK( a, b, c, d, e ) \
+- ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
+- (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
++ * b is the minor version
++ * c is the micro version
++ */
++#define LIBAVUTIL_VERSION_CHECK( a, b, c ) \
++ (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) )
+
+ /*
+ * AV_PIX_FMT_VAAPI is not introduced in the same major version in libav and FFmpeg:
+@@ -115,9 +115,8 @@
+ #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
+ # include <libavformat/avformat.h>
+
+-#define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \
+- ( (LIBAVFORMAT_VERSION_MICRO < 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
+- (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
++#define LIBAVFORMAT_VERSION_CHECK( a, b, c ) \
++ (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) )
+
+ #endif
+
+diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
+index de41991ebb51..edab2cbdca8f 100644
+--- a/modules/codec/avcodec/fourcc.c
++++ b/modules/codec/avcodec/fourcc.c
+@@ -226,7 +226,7 @@ static const struct vlc_avcodec_fourcc v
+ { VLC_CODEC_CLLC, AV_CODEC_ID_CLLC },
+ { VLC_CODEC_MSS2, AV_CODEC_ID_MSS2 },
+ { VLC_CODEC_VP9, AV_CODEC_ID_VP9 },
+-#if LIBAVCODEC_VERSION_CHECK( 57, 26, 0, 83, 101 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 83, 101 )
+ { VLC_CODEC_AV1, AV_CODEC_ID_AV1 },
+ #endif
+ { VLC_CODEC_ICOD, AV_CODEC_ID_AIC },
+@@ -281,19 +281,19 @@ static const struct vlc_avcodec_fourcc v
+ /* ffmpeg only: AV_CODEC_ID_SNOW */
+ /* ffmpeg only: AV_CODEC_ID_SMVJPEG */
+
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 24, 102 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 24, 102 )
+ { VLC_CODEC_CINEFORM, AV_CODEC_ID_CFHD },
+ #endif
+
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 70, 100 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 70, 100 )
+ { VLC_CODEC_PIXLET, AV_CODEC_ID_PIXLET },
+ #endif
+
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 101 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 71, 101 )
+ { VLC_CODEC_SPEEDHQ, AV_CODEC_ID_SPEEDHQ },
+ #endif
+
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 79, 100 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 79, 100 )
+ { VLC_CODEC_FMVC, AV_CODEC_ID_FMVC },
+ #endif
+ };
+@@ -410,7 +410,7 @@ static const struct vlc_avcodec_fourcc a
+ /* AV_CODEC_ID_WESTWOOD_SND1 */
+ { VLC_CODEC_GSM, AV_CODEC_ID_GSM },
+ { VLC_CODEC_QDM2, AV_CODEC_ID_QDM2 },
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 71, 100 )
+ { VLC_CODEC_QDMC, AV_CODEC_ID_QDMC },
+ #endif
+ { VLC_CODEC_COOK, AV_CODEC_ID_COOK },
+@@ -478,7 +478,7 @@ static const struct vlc_avcodec_fourcc s
+ { VLC_CODEC_SSA, AV_CODEC_ID_SSA },
+ /* AV_CODEC_ID_MOV_TEXT */
+ { VLC_CODEC_BD_PG, AV_CODEC_ID_HDMV_PGS_SUBTITLE },
+-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
++#if LIBAVCODEC_VERSION_CHECK( 57, 71, 100 )
+ { VLC_CODEC_BD_TEXT, AV_CODEC_ID_HDMV_TEXT_SUBTITLE },
+ #endif
+ { VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT },
+diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
+index 594c337486a9..d3ba649f272a 100644
+--- a/modules/codec/avcodec/video.c
++++ b/modules/codec/avcodec/video.c
+@@ -257,12 +257,12 @@ static int lavc_GetVideoFormat(decoder_t
+ case AVCOL_TRC_BT2020_12:
+ fmt->transfer = TRANSFER_FUNC_BT2020;
+ break;
+-#if LIBAVUTIL_VERSION_CHECK( 55, 14, 0, 31, 100)
++#if LIBAVUTIL_VERSION_CHECK( 55, 31, 100)
+ case AVCOL_TRC_ARIB_STD_B67:
+ fmt->transfer = TRANSFER_FUNC_ARIB_B67;
+ break;
+ #endif
+-#if LIBAVUTIL_VERSION_CHECK( 55, 17, 0, 37, 100)
++#if LIBAVUTIL_VERSION_CHECK( 55, 37, 100)
+ case AVCOL_TRC_SMPTE2084:
+ fmt->transfer = TRANSFER_FUNC_SMPTE_ST2084;
+ break;
+@@ -1302,7 +1302,7 @@ static picture_t *DecodeBlock( decoder_t
+ }
+
+ /* Compute the PTS */
+-#if LIBAVCODEC_VERSION_CHECK(57, 24, 0, 61, 100)
++#if LIBAVCODEC_VERSION_CHECK(57, 61, 100)
+ # if LIBAVCODEC_VERSION_MICRO >= 100
+ vlc_tick_t i_pts = frame->best_effort_timestamp;
+ # else
+diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
+index 52fe7ef7f9eb..b9c434f0814f 100644
+--- a/modules/demux/avformat/mux.c
++++ b/modules/demux/avformat/mux.c
+@@ -61,7 +61,7 @@ struct sout_mux_sys_t
+ bool b_write_header;
+ bool b_write_keyframe;
+ bool b_error;
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ bool b_header_done;
+ #endif
+ };
+@@ -76,7 +76,7 @@ static int Mux ( sout_mux_t * );
+
+ static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
+ static int64_t IOSeek( void *opaque, int64_t offset, int whence );
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time);
+ #endif
+@@ -159,7 +159,7 @@ int avformat_OpenMux( vlc_object_t *p_th
+ p_sys->b_write_header = true;
+ p_sys->b_write_keyframe = false;
+ p_sys->b_error = false;
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ p_sys->io->write_data_type = IOWriteTyped;
+ p_sys->b_header_done = false;
+ #endif
+@@ -406,7 +406,7 @@ static int MuxBlock( sout_mux_t *p_mux,
+ return VLC_SUCCESS;
+ }
+
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time)
+ {
+@@ -523,7 +523,7 @@ static int IOWrite( void *opaque, uint8_
+
+ if( p_sys->b_write_header )
+ p_buf->i_flags |= BLOCK_FLAG_HEADER;
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ if( !p_sys->b_header_done )
+ p_buf->i_flags |= BLOCK_FLAG_HEADER;
+ #endif
+--
+GitLab
+
+
+From 8cf02acd84a1e099e15037d7c1e4dce6e8888df9 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Tue, 30 Nov 2021 18:30:28 +0100
+Subject: [PATCH] avcodec: remove LIBAVCODEC_VERSION_MICRO >= 100 checks
+
+This check was used to distinguish FFmpeg and libav, as libav support
+is removed now, this is no longer necessary.
+---
+ modules/codec/avcodec/avcommon_compat.h | 2 +-
+ modules/codec/avcodec/directx_va.c | 4 ++--
+ modules/codec/avcodec/fourcc.c | 18 +++++++-----------
+ modules/codec/avcodec/video.c | 11 +----------
+ 4 files changed, 11 insertions(+), 24 deletions(-)
+
+diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
+index 010b570e0820..f56ce84b72db 100644
+--- a/modules/codec/avcodec/avcommon_compat.h
++++ b/modules/codec/avcodec/avcommon_compat.h
+@@ -36,7 +36,7 @@
+ * c is the micro version
+ */
+ #define LIBAVCODEC_VERSION_CHECK( a, b, c ) \
+- (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) )
++ (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ))
+
+ #ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT
+ # define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT
+diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
+index e240fec1ac51..7d180b574a28 100644
+--- a/modules/codec/avcodec/directx_va.c
++++ b/modules/codec/avcodec/directx_va.c
+@@ -274,7 +274,7 @@ static const directx_va_mode_t DXVA_MODE
+
+ /* VPx */
+ { "VP8", &DXVA_ModeVP8_VLD, 8, 0, NULL },
+-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 17, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 17, 100 )
+ { "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, 8, AV_CODEC_ID_VP9, PROF_VP9_MAIN },
+ { "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, 10, AV_CODEC_ID_VP9, PROF_VP9_10 },
+ #else
+@@ -284,7 +284,7 @@ static const directx_va_mode_t DXVA_MODE
+ { "VP9 profile Intel", &DXVA_ModeVP9_VLD_Intel, 8, 0, NULL },
+
+ /* AV1 */
+-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 112, 103 ) && LIBAVCODEC_VERSION_MICRO >= 100
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 112, 103 )
+ { "AV1 Main profile 8", &DXVA_ModeAV1_VLD_Profile0, 8, AV_CODEC_ID_AV1, PROF_AV1_MAIN },
+ { "AV1 Main profile 10", &DXVA_ModeAV1_VLD_Profile0, 10, AV_CODEC_ID_AV1, PROF_AV1_MAIN },
+ { "AV1 High profile 8", &DXVA_ModeAV1_VLD_Profile1, 8, AV_CODEC_ID_AV1, PROF_AV1_HIGH },
+diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
+index edab2cbdca8f..c14320aa1530 100644
+--- a/modules/codec/avcodec/fourcc.c
++++ b/modules/codec/avcodec/fourcc.c
+@@ -182,7 +182,7 @@ static const struct vlc_avcodec_fourcc v
+ /* AV_CODEC_ID_V210X */
+ { VLC_CODEC_TMV, AV_CODEC_ID_TMV },
+ { VLC_CODEC_V210, AV_CODEC_ID_V210 },
+-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 50, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100
++#if LIBAVCODEC_VERSION_CHECK( 54, 50, 100 )
+ { VLC_CODEC_VUYA, AV_CODEC_ID_AYUV },
+ #endif
+ /* AV_CODEC_ID_DPX */
+diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
+index d3ba649f272a..c5385d4574d9 100644
+--- a/modules/codec/avcodec/video.c
++++ b/modules/codec/avcodec/video.c
+@@ -196,10 +196,6 @@ static int lavc_GetVideoFormat(decoder_t
+ {
+ fmt->i_frame_rate = ctx->framerate.num;
+ fmt->i_frame_rate_base = ctx->framerate.den;
+-# if LIBAVCODEC_VERSION_MICRO < 100
+- // for some reason libav don't thinkg framerate presents actually same thing as in ffmpeg
+- fmt->i_frame_rate_base *= __MAX(ctx->ticks_per_frame, 1);
+-# endif
+ }
+ else if (ctx->time_base.num > 0 && ctx->time_base.den > 0)
+ {
+@@ -1303,11 +1299,7 @@ static picture_t *DecodeBlock( decoder_t
+
+ /* Compute the PTS */
+ #if LIBAVCODEC_VERSION_CHECK(57, 61, 100)
+-# if LIBAVCODEC_VERSION_MICRO >= 100
+ vlc_tick_t i_pts = frame->best_effort_timestamp;
+-# else
+- vlc_tick_t i_pts = frame->pts;
+-# endif
+ #else
+ vlc_tick_t i_pts = frame->pkt_pts;
+ #endif
+@@ -1819,8 +1811,7 @@ no_reuse:
+ if (!can_hwaccel)
+ return swfmt;
+
+-#if (LIBAVCODEC_VERSION_MICRO >= 100) \
+- && (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 83, 101))
++#if LIBAVCODEC_VERSION_CHECK(57, 83, 101)
+ if (p_context->active_thread_type)
+ {
+ msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",
+--
+GitLab
+
+
+From 29747a8abb98ba53a64aa6761983891eeed2e0e4 Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Tue, 4 Jul 2023 16:52:38 +0300
+Subject: [PATCH] avcodec: use p_enc audio channels instead of context channels
+ in encoder
+
+Allows to have less conditions in code when adding new ch_layout use
+---
+ modules/codec/avcodec/encoder.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
+index 48d41fe317cd..0ef334212ba4 100644
+--- a/modules/codec/avcodec/encoder.c
++++ b/modules/codec/avcodec/encoder.c
+@@ -781,7 +781,7 @@ int InitVideoEnc( vlc_object_t *p_this )
+ }
+ }
+ }
+- if( i_channels_src != p_context->channels )
++ if( i_channels_src != p_enc->fmt_out.audio.i_channels )
+ msg_Err( p_enc, "Channel layout not understood" );
+
+ p_sys->i_channels_to_reorder =
+@@ -887,7 +887,7 @@ int InitVideoEnc( vlc_object_t *p_this )
+ if( ret )
+ {
+ if( p_enc->fmt_in.i_cat != AUDIO_ES ||
+- (p_context->channels <= 2 && i_codec_id != AV_CODEC_ID_MP2
++ (p_enc->fmt_out.audio.i_channels <= 2 && i_codec_id != AV_CODEC_ID_MP2
+ && i_codec_id != AV_CODEC_ID_MP3) )
+ errmsg:
+ {
+@@ -912,7 +912,7 @@ errmsg:
+ goto error;
+ }
+
+- if( p_context->channels > 2 )
++ if( p_enc->fmt_out.audio.i_channels > 2 )
+ {
+ p_context->channels = 2;
+ p_context->channel_layout = channel_mask[p_context->channels][1];
+@@ -1018,7 +1018,7 @@ errmsg:
+ p_context->frame_size :
+ AV_INPUT_BUFFER_MIN_SIZE;
+ p_sys->i_buffer_out = av_samples_get_buffer_size(NULL,
+- p_sys->p_context->channels, p_sys->i_frame_size,
++ p_enc->fmt_out.audio.i_channels, p_sys->i_frame_size,
+ p_sys->p_context->sample_fmt, DEFAULT_ALIGN);
+ p_sys->p_buffer = av_malloc( p_sys->i_buffer_out );
+ if ( unlikely( p_sys->p_buffer == NULL ) )
+@@ -1268,7 +1268,7 @@ static block_t *handle_delay_buffer( enc
+ {
+ block_t *p_block = NULL;
+ //How much we need to copy from new packet
+- const size_t leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
++ const size_t leftover = leftover_samples * p_enc->fmt_out.audio.i_channels * p_sys->i_sample_bytes;
+
+ av_frame_unref( p_sys->frame );
+ p_sys->frame->format = p_sys->p_context->sample_fmt;
+@@ -1291,7 +1291,7 @@ static block_t *handle_delay_buffer( enc
+ // We need to deinterleave from p_aout_buf to p_buffer the leftover bytes
+ if( p_sys->b_planar )
+ aout_Deinterleave( p_sys->p_interleave_buf, p_sys->p_buffer,
+- p_sys->i_frame_size, p_sys->p_context->channels, p_enc->fmt_in.i_codec );
++ p_sys->i_frame_size, p_enc->fmt_out.audio.i_channels, p_enc->fmt_in.i_codec );
+ else
+ memcpy( p_sys->p_buffer + buffer_delay, p_aout_buf->p_buffer, leftover);
+
+@@ -1309,7 +1309,7 @@ static block_t *handle_delay_buffer( enc
+ memset( p_sys->p_buffer + (leftover+buffer_delay), 0, padding_size );
+ buffer_delay += padding_size;
+ }
+- if( avcodec_fill_audio_frame( p_sys->frame, p_sys->p_context->channels,
++ if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_out.audio.i_channels,
+ p_sys->p_context->sample_fmt, p_sys->b_planar ? p_sys->p_interleave_buf : p_sys->p_buffer,
+ p_sys->i_buffer_out,
+ DEFAULT_ALIGN) < 0 )
+@@ -1339,7 +1339,7 @@ static block_t *EncodeAudio( encoder_t *
+
+ //i_bytes_left is amount of bytes we get
+ i_samples_left = p_aout_buf ? p_aout_buf->i_nb_samples : 0;
+- buffer_delay = p_sys->i_samples_delay * p_sys->i_sample_bytes * p_sys->p_context->channels;
++ buffer_delay = p_sys->i_samples_delay * p_sys->i_sample_bytes * p_enc->fmt_out.audio.i_channels;
+
+ //p_sys->i_buffer_out = p_sys->i_frame_size * chan * p_sys->i_sample_bytes
+ //Calculate how many bytes we would need from current buffer to fill frame
+@@ -1408,12 +1408,12 @@ static block_t *EncodeAudio( encoder_t *
+ p_sys->frame->channels = p_sys->p_context->channels;
+
+ const int in_bytes = p_sys->frame->nb_samples *
+- p_sys->p_context->channels * p_sys->i_sample_bytes;
++ p_enc->fmt_out.audio.i_channels* p_sys->i_sample_bytes;
+
+ if( p_sys->b_planar )
+ {
+ aout_Deinterleave( p_sys->p_buffer, p_aout_buf->p_buffer,
+- p_sys->frame->nb_samples, p_sys->p_context->channels, p_enc->fmt_in.i_codec );
++ p_sys->frame->nb_samples, p_enc->fmt_out.audio.i_channels, p_enc->fmt_in.i_codec );
+
+ }
+ else
+@@ -1421,7 +1421,7 @@ static block_t *EncodeAudio( encoder_t *
+ memcpy(p_sys->p_buffer, p_aout_buf->p_buffer, in_bytes);
+ }
+
+- if( avcodec_fill_audio_frame( p_sys->frame, p_sys->p_context->channels,
++ if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_out.audio.i_channels,
+ p_sys->p_context->sample_fmt,
+ p_sys->p_buffer,
+ p_sys->i_buffer_out,
+@@ -1447,7 +1447,7 @@ static block_t *EncodeAudio( encoder_t *
+ if( p_aout_buf->i_nb_samples > 0 )
+ {
+ memcpy( p_sys->p_buffer + buffer_delay, p_aout_buf->p_buffer,
+- p_aout_buf->i_nb_samples * p_sys->i_sample_bytes * p_sys->p_context->channels);
++ p_aout_buf->i_nb_samples * p_sys->i_sample_bytes * p_enc->fmt_out.audio.i_channels);
+ p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
+ }
+
+--
+GitLab
+
+
+From c4302ca59dd79efd7208a45a3fcdc44388fd03a8 Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Tue, 4 Jul 2023 16:53:43 +0300
+Subject: [PATCH] avcodec: add handling of new ch_layout in audio encoder
+
+conditioned to avcodec version where is it added
+---
+ modules/codec/avcodec/encoder.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
+index 0ef334212ba4..38a8437261dc 100644
+--- a/modules/codec/avcodec/encoder.c
++++ b/modules/codec/avcodec/encoder.c
+@@ -914,8 +914,12 @@ errmsg:
+
+ if( p_enc->fmt_out.audio.i_channels > 2 )
+ {
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ av_channel_layout_default( &p_context->ch_layout, 2 );
++#else
+ p_context->channels = 2;
+ p_context->channel_layout = channel_mask[p_context->channels][1];
++#endif
+
+ /* Change fmt_in in order to ask for a channels conversion */
+ p_enc->fmt_in.audio.i_channels =
+@@ -1273,8 +1277,12 @@ static block_t *handle_delay_buffer( enc
+ av_frame_unref( p_sys->frame );
+ p_sys->frame->format = p_sys->p_context->sample_fmt;
+ p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
++#else
+ p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
+ p_sys->frame->channels = p_sys->p_context->channels;
++#endif
+
+ p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
+ CLOCK_FREQ / p_sys->p_context->time_base.num;
+@@ -1404,8 +1412,12 @@ static block_t *EncodeAudio( encoder_t *
+ p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
+ CLOCK_FREQ / p_sys->p_context->time_base.num;
+
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
++#else
+ p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
+ p_sys->frame->channels = p_sys->p_context->channels;
++#endif
+
+ const int in_bytes = p_sys->frame->nb_samples *
+ p_enc->fmt_out.audio.i_channels* p_sys->i_sample_bytes;
+--
+GitLab
+
+
+From b73dc8841d999c6be9de718cd2cd3aeb13279792 Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Tue, 4 Jul 2023 16:55:28 +0300
+Subject: [PATCH] avcodec: use ch_layout for channel layout in audio encoder
+
+channels and channel_layout has been deprecated in FFMPEG 5.1 and will be removed eventually
+
+also always create the mapping, as ch_layout is always there
+---
+ modules/codec/avcodec/encoder.c | 46 +++++++++++++--------------------
+ 1 file changed, 18 insertions(+), 28 deletions(-)
+
+diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
+index 38a8437261dc..f8bd2bbf939e 100644
+--- a/modules/codec/avcodec/encoder.c
++++ b/modules/codec/avcodec/encoder.c
+@@ -179,6 +179,7 @@ static const uint64_t pi_channels_map[][
+ { AV_CH_STEREO_RIGHT, 0 },
+ };
+
++#if !LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+ static const uint32_t channel_mask[][2] = {
+ {0,0},
+ {AOUT_CHAN_CENTER, AV_CH_LAYOUT_MONO},
+@@ -191,6 +192,7 @@ static const uint32_t channel_mask[][2]
+ {AOUT_CHANS_7_1, AV_CH_LAYOUT_7POINT1},
+ {AOUT_CHANS_8_1, AV_CH_LAYOUT_OCTAGONAL},
+ };
++#endif
+
+ static const char *const ppsz_enc_options[] = {
+ "keyint", "bframes", "vt", "qmin", "qmax", "codec", "hq",
+@@ -737,48 +739,36 @@ int InitVideoEnc( vlc_object_t *p_this )
+ date_Set( &p_sys->buffer_date, AV_NOPTS_VALUE );
+ p_context->time_base.num = 1;
+ p_context->time_base.den = p_context->sample_rate;
+- p_context->channels = p_enc->fmt_out.audio.i_channels;
+- p_context->channel_layout = channel_mask[p_context->channels][1];
+
+- /* Setup Channel ordering for multichannel audio
++ /* Setup Channel ordering for audio
+ * as VLC channel order isn't same as libavcodec expects
+ */
+
+ p_sys->i_channels_to_reorder = 0;
+
+- /* Specified order
++ /* Create channel layout for avcodec
+ * Copied from audio.c
+ */
+- const unsigned i_order_max = 8 * sizeof(p_context->channel_layout);
+ uint32_t pi_order_dst[AOUT_CHAN_MAX] = { };
+ uint32_t order_mask = 0;
+ int i_channels_src = 0;
+
+- if( p_context->channel_layout )
+- {
+- msg_Dbg( p_enc, "Creating channel order for reordering");
+- for( unsigned i = 0; i < sizeof(pi_channels_map)/sizeof(*pi_channels_map); i++ )
+- {
+- if( p_context->channel_layout & pi_channels_map[i][0] )
+- {
+- msg_Dbg( p_enc, "%d %"PRIx64" mapped to %"PRIx64"", i_channels_src, pi_channels_map[i][0], pi_channels_map[i][1]);
+- pi_order_dst[i_channels_src++] = pi_channels_map[i][1];
+- order_mask |= pi_channels_map[i][1];
+- }
+- }
+- }
+- else
++ msg_Dbg( p_enc, "Creating channel order for reordering");
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ av_channel_layout_default( &p_context->ch_layout, p_enc->fmt_out.audio.i_channels );
++ uint64_t channel_mask = p_context->ch_layout.u.mask;
++#else
++ p_context->channels = p_enc->fmt_out.audio.i_channels;
++ p_context->channel_layout = channel_mask[p_context->channels][1];
++ uint64_t channel_mask = p_context->channel_layout;
++#endif
++ for( unsigned i = 0; i < sizeof(pi_channels_map)/sizeof(*pi_channels_map); i++ )
+ {
+- msg_Dbg( p_enc, "Creating default channel order for reordering");
+- /* Create default order */
+- for( unsigned int i = 0; i < __MIN( i_order_max, (unsigned)p_sys->p_context->channels ); i++ )
++ if( channel_mask & pi_channels_map[i][0] )
+ {
+- if( i < sizeof(pi_channels_map)/sizeof(*pi_channels_map) )
+- {
+- msg_Dbg( p_enc, "%d channel is %"PRIx64"", i_channels_src, pi_channels_map[i][1]);
+- pi_order_dst[i_channels_src++] = pi_channels_map[i][1];
+- order_mask |= pi_channels_map[i][1];
+- }
++ msg_Dbg( p_enc, "%d %"PRIx64" mapped to %"PRIx64"", i_channels_src, pi_channels_map[i][0], pi_channels_map[i][1]);
++ pi_order_dst[i_channels_src++] = pi_channels_map[i][1];
++ order_mask |= pi_channels_map[i][1];
+ }
+ }
+ if( i_channels_src != p_enc->fmt_out.audio.i_channels )
+--
+GitLab
+
+
+From bddf5ba19111d1cc4463d9876c4bc4ba75f82d7f Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Wed, 5 Jul 2023 12:51:34 +0300
+Subject: [PATCH] avcodec: use p_dec->fmt_out instead of context channels on
+ audio channel-count
+
+reduces the need of ifdefs when adding ch_layout support
+---
+ modules/codec/avcodec/audio.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
+index 0937641f21ae..5044e1556231 100644
+--- a/modules/codec/avcodec/audio.c
++++ b/modules/codec/avcodec/audio.c
+@@ -484,15 +484,15 @@ static block_t * ConvertAVFrame( decoder
+ /* Interleave audio if required */
+ if( av_sample_fmt_is_planar( ctx->sample_fmt ) )
+ {
+- p_block = block_Alloc(frame->linesize[0] * ctx->channels);
++ p_block = block_Alloc(frame->linesize[0] * p_dec->fmt_out.audio.i_channels );
+ if ( likely(p_block) )
+ {
+- const void *planes[ctx->channels];
+- for (int i = 0; i < ctx->channels; i++)
++ const void *planes[p_dec->fmt_out.audio.i_channels];
++ for (int i = 0; i < p_dec->fmt_out.audio.i_channels; i++)
+ planes[i] = frame->extended_data[i];
+
+ aout_Interleave(p_block->p_buffer, planes, frame->nb_samples,
+- ctx->channels, p_dec->fmt_out.audio.i_format);
++ p_dec->fmt_out.audio.i_channels, p_dec->fmt_out.audio.i_format);
+ p_block->i_nb_samples = frame->nb_samples;
+ }
+ av_frame_free(&frame);
+@@ -511,7 +511,7 @@ static block_t * ConvertAVFrame( decoder
+ {
+ aout_ChannelExtract( p_buffer->p_buffer,
+ p_dec->fmt_out.audio.i_channels,
+- p_block->p_buffer, ctx->channels,
++ p_block->p_buffer, p_dec->fmt_out.audio.i_channels,
+ p_block->i_nb_samples, p_sys->pi_extraction,
+ p_dec->fmt_out.audio.i_bitspersample );
+ p_buffer->i_nb_samples = p_block->i_nb_samples;
+@@ -600,13 +600,13 @@ static void SetupOutputFormat( decoder_t
+ if( channel_layout )
+ {
+ for( unsigned i = 0; i < i_order_max
+- && i_channels_src < p_sys->p_context->channels; i++ )
++ && i_channels_src < p_dec->fmt_out.audio.i_channels; i++ )
+ {
+ if( channel_layout & pi_channels_map[i][0] )
+ pi_order_src[i_channels_src++] = pi_channels_map[i][1];
+ }
+
+- if( i_channels_src != p_sys->p_context->channels && b_trust )
++ if( i_channels_src != p_dec->fmt_out.audio.i_channels && b_trust )
+ msg_Err( p_dec, "Channel layout not understood" );
+
+ /* Detect special dual mono case */
+--
+GitLab
+
+From 496f0f2a659c1339d1e37330d446e9b6ce96e76b Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Wed, 5 Jul 2023 13:33:09 +0300
+Subject: [PATCH] avcodec: audio decoder to use ch_layout
+
+---
+ modules/codec/avcodec/audio.c | 42 ++++++++++++++++++++++++++++-------
+ 1 file changed, 34 insertions(+), 8 deletions(-)
+
+diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
+index 5044e1556231..2c85d83005c5 100644
+--- a/modules/codec/avcodec/audio.c
++++ b/modules/codec/avcodec/audio.c
+@@ -139,7 +139,11 @@ static int OpenAudioCodec( decoder_t *p_
+ }
+
+ ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
+- ctx->channels = p_dec->fmt_in.audio.i_channels;
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ av_channel_layout_default( &ctx->ch_layout, p_dec->fmt_in.audio.i_channels );
++#else
++ ctx->channels = p_dec->fmt_in.audio.i_channels;
++#endif
+ ctx->block_align = p_dec->fmt_in.audio.i_blockalign;
+ ctx->bit_rate = p_dec->fmt_in.i_bitrate;
+ ctx->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
+@@ -395,12 +399,17 @@ static int DecodeBlock( decoder_t *p_dec
+ ret = avcodec_receive_frame( ctx, frame );
+ if( ret == 0 )
+ {
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ int channels = frame->ch_layout.nb_channels;
++#else
++ int channels = ctx->channels;
++#endif
+ /* checks and init from first decoded frame */
+- if( ctx->channels <= 0 || ctx->channels > INPUT_CHAN_MAX
++ if( channels <= 0 || channels > INPUT_CHAN_MAX
+ || ctx->sample_rate <= 0 )
+ {
+ msg_Warn( p_dec, "invalid audio properties channels count %d, sample rate %d",
+- ctx->channels, ctx->sample_rate );
++ channels, ctx->sample_rate );
+ goto drop;
+ }
+ else if( p_dec->fmt_out.audio.i_rate != (unsigned int)ctx->sample_rate )
+@@ -580,6 +589,16 @@ static void SetupOutputFormat( decoder_t
+ p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
+
+ /* */
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ if( p_sys->i_previous_channels == p_sys->p_context->ch_layout.nb_channels &&
++ p_sys->i_previous_layout == p_sys->p_context->ch_layout.u.mask )
++ return;
++ if( b_trust )
++ {
++ p_sys->i_previous_channels = p_sys->p_context->ch_layout.nb_channels;
++ p_sys->i_previous_layout = p_sys->p_context->ch_layout.u.mask;
++ }
++#else
+ if( p_sys->i_previous_channels == p_sys->p_context->channels &&
+ p_sys->i_previous_layout == p_sys->p_context->channel_layout )
+ return;
+@@ -588,25 +607,32 @@ static void SetupOutputFormat( decoder_t
+ p_sys->i_previous_channels = p_sys->p_context->channels;
+ p_sys->i_previous_layout = p_sys->p_context->channel_layout;
+ }
++#endif
+
+- const unsigned i_order_max = sizeof(pi_channels_map)/sizeof(*pi_channels_map);
+- uint32_t pi_order_src[i_order_max];
++ uint32_t pi_order_src[AOUT_CHAN_MAX] = { 0 };
+
+ int i_channels_src = 0;
+- int64_t channel_layout =
++#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
++ uint64_t channel_layout_mask = p_sys->p_context->ch_layout.u.mask;
++ int channel_count = p_sys->p_context->ch_layout.nb_channels;
++#else
++ uint64_t channel_layout_mask =
+ p_sys->p_context->channel_layout ? p_sys->p_context->channel_layout :
+ av_get_default_channel_layout( p_sys->p_context->channels );
++ (uint64_t)av_get_default_channel_layout( p_sys->p_context->channels );
++ int channel_count = p_sys->p_context->channels;
++#endif
+
+- if( channel_layout )
++ if( channel_layout_mask )
+ {
+- for( unsigned i = 0; i < i_order_max
+- && i_channels_src < p_dec->fmt_out.audio.i_channels; i++ )
++ for( unsigned i = 0; pi_channels_map[i][0]
++ && i_channels_src < channel_count; i++ )
+ {
+- if( channel_layout & pi_channels_map[i][0] )
++ if( channel_layout_mask & pi_channels_map[i][0] )
+ pi_order_src[i_channels_src++] = pi_channels_map[i][1];
+ }
+
+- if( i_channels_src != p_dec->fmt_out.audio.i_channels && b_trust )
++ if( i_channels_src != channel_count && b_trust )
+ msg_Err( p_dec, "Channel layout not understood" );
+
+ /* Detect special dual mono case */
+@@ -638,7 +664,7 @@ static void SetupOutputFormat( decoder_t
+ {
+ msg_Warn( p_dec, "no channel layout found");
+ p_dec->fmt_out.audio.i_physical_channels = 0;
+- p_dec->fmt_out.audio.i_channels = p_sys->p_context->channels;
++ p_dec->fmt_out.audio.i_channels = channel_count;
+ }
+
+ aout_FormatPrepare( &p_dec->fmt_out.audio );
+--
+GitLab
+
+From 0ff86bf8a28a080340f600cb8561815fc43e3b4a Mon Sep 17 00:00:00 2001
+From: Ilkka Ollakka <ileoo@videolan.org>
+Date: Wed, 5 Jul 2023 15:09:57 +0300
+Subject: [PATCH] avcodec/audio: make channel mapping array 0 terminated
+
+Also change pi_channels_src to be only AOUT_CHAN_MAX instead of same
+size as mapping array.
+---
+ modules/codec/avcodec/audio.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
+index 2c85d83005c5..d0c8bae750b2 100644
+--- a/modules/codec/avcodec/audio.c
++++ b/modules/codec/avcodec/audio.c
+@@ -577,6 +577,7 @@ static const uint64_t pi_channels_map[][
+ { AV_CH_TOP_BACK_RIGHT, 0 },
+ { AV_CH_STEREO_LEFT, 0 },
+ { AV_CH_STEREO_RIGHT, 0 },
++ { 0, 0 },
+ };
+
+ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
+--
+GitLab
+
+
+From 1a57633d1820eb218771489505876fa55f8a8847 Mon Sep 17 00:00:00 2001
+From: Francois Cartegnie <fcvlcdev@free.fr>
+Date: Tue, 23 Apr 2024 13:13:30 +0700
+Subject: [PATCH 1/4] codec: avcodec: map AYUV as RAWVIDEO with ffmpeg 6.0
+
+---
+ modules/codec/avcodec/fourcc.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
+index de7b9e1377bd..4ce2584bd303 100644
+--- a/modules/codec/avcodec/fourcc.c
++++ b/modules/codec/avcodec/fourcc.c
+@@ -182,7 +182,9 @@ static const struct vlc_avcodec_fourcc v
+ /* AV_CODEC_ID_V210X */
+ { VLC_CODEC_TMV, AV_CODEC_ID_TMV },
+ { VLC_CODEC_V210, AV_CODEC_ID_V210 },
+-#if LIBAVCODEC_VERSION_CHECK( 54, 50, 100 )
++#if LIBAVCODEC_VERSION_CHECK( 59, 42, 102 )
++ { VLC_CODEC_VUYA, AV_CODEC_ID_RAWVIDEO },
++#else
+ { VLC_CODEC_VUYA, AV_CODEC_ID_AYUV },
+ #endif
+ /* AV_CODEC_ID_DPX */
+--
+GitLab
+
+
+From 3ecdd252b42dca492c79470535703eae0dfc1093 Mon Sep 17 00:00:00 2001
+From: Francois Cartegnie <fcvlcdev@free.fr>
+Date: Tue, 23 Apr 2024 13:14:53 +0700
+Subject: [PATCH 2/4] demux/mux: avformat: use ch_layout from ffmpeg 5.1
+
+---
+ modules/demux/avformat/demux.c | 4 ++++
+ modules/demux/avformat/mux.c | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
+index 743e0534901c..87f5b41c0d82 100644
+--- a/modules/demux/avformat/demux.c
++++ b/modules/demux/avformat/demux.c
+@@ -401,7 +401,11 @@ int avformat_OpenDemux( vlc_object_t *p_
+ es_format_Init( &es_fmt, AUDIO_ES, fcc );
+ es_fmt.i_original_fourcc = CodecTagToFourcc( cp->codec_tag );
+ es_fmt.i_bitrate = cp->bit_rate;
++#if LIBAVUTIL_VERSION_CHECK( 57, 28, 100 )
++ es_fmt.audio.i_channels = cp->ch_layout.nb_channels;
++#else
+ es_fmt.audio.i_channels = cp->channels;
++#endif
+ es_fmt.audio.i_rate = cp->sample_rate;
+ es_fmt.audio.i_bitspersample = cp->bits_per_coded_sample;
+ es_fmt.audio.i_blockalign = cp->block_align;
+diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
+index 55fc891437c7..0e87942aa76a 100644
+--- a/modules/demux/avformat/mux.c
++++ b/modules/demux/avformat/mux.c
+@@ -267,7 +267,11 @@ static int AddStream( sout_mux_t *p_mux,
+ {
+ case AUDIO_ES:
+ codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
++#if LIBAVUTIL_VERSION_CHECK( 57, 28, 100 )
++ av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
++#else
+ codecpar->channels = fmt->audio.i_channels;
++#endif
+ codecpar->sample_rate = fmt->audio.i_rate;
+ stream->time_base = (AVRational){1, codecpar->sample_rate};
+ if (fmt->i_bitrate == 0) {
+--
+GitLab
+
+
+From 1c15a5e183df7e292afd27795548d3c2254a9bbd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
+Date: Mon, 6 May 2024 12:15:40 +0200
+Subject: [PATCH] demux/mux: avformat: Constify the buffer pointees
+
+in the write_packet from ffmpeg 6.1
+
+The deprecated FF_API_AVIO_WRITE_NONCONST was removed in ffmpeg 7.0.
+
+Ref:
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/2a68d945cd74265bb71c3d38b7a2e7f7d7e87be5
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/02aea61d69d8f81bc285e2131bf25f96a3e27feb
+---
+ modules/demux/avformat/mux.c | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
+index 0e87942aa76a..390aa3cb4dfd 100644
+--- a/modules/demux/avformat/mux.c
++++ b/modules/demux/avformat/mux.c
+@@ -75,9 +75,16 @@ static int AddStream( sout_mux_t *, sout_input_t * );
+ static void DelStream( sout_mux_t *, sout_input_t * );
+ static int Mux ( sout_mux_t * );
+
++#if LIBAVFORMAT_VERSION_CHECK( 61, 01, 100 )
++static int IOWrite( void *opaque, const uint8_t *buf, int buf_size );
++#else
+ static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
++#endif
+ static int64_t IOSeek( void *opaque, int64_t offset, int whence );
+-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 61, 01, 100 )
++static int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
++ enum AVIODataMarkerType type, int64_t time);
++#elif LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
+ static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time);
+ #endif
+@@ -436,8 +443,13 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
+ }
+
+ #if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
++#if LIBAVFORMAT_VERSION_CHECK( 61, 01, 100 )
++int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
++ enum AVIODataMarkerType type, int64_t time)
++#else
+ int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time)
++#endif
+ {
+ VLC_UNUSED(time);
+
+@@ -533,7 +545,11 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
+ /*****************************************************************************
+ * I/O wrappers for libavformat
+ *****************************************************************************/
++#if LIBAVFORMAT_VERSION_CHECK( 61, 01, 100 )
++static int IOWrite( void *opaque, const uint8_t *buf, int buf_size )
++#else
+ static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
++#endif
+ {
+ sout_mux_t *p_mux = opaque;
+ sout_mux_sys_t *p_sys = p_mux->p_sys;
+--
+GitLab
diff --git a/multimedia/vlc/files/vlc-3.0.21-ffmpeg8-1.patch b/multimedia/vlc/files/vlc-3.0.21-ffmpeg8-1.patch
new file mode 100644
index 000000000000..a523b04968f3
--- /dev/null
+++ b/multimedia/vlc/files/vlc-3.0.21-ffmpeg8-1.patch
@@ -0,0 +1,393 @@
+Submitted By: Joe Locash <jlocash@gmail.com>
+Date: 2025-11-19
+Initial Package Version: 3.0.21
+Upstream Status: Unknown
+Origin: Upstream
+Description: Fixes compilation with ffmpeg-8.0
+
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/audio.c vlc-3.0.21/modules/codec/avcodec/audio.c
+--- vlc-3.0.21.orig/modules/codec/avcodec/audio.c 2025-11-17 18:16:27.482219213 -0500
++++ vlc-3.0.21/modules/codec/avcodec/audio.c 2025-11-17 18:17:09.717861987 -0500
+@@ -44,6 +44,12 @@
+ #include <libavutil/channel_layout.h>
+
+
++#if ! LIBAVCODEC_VERSION_CHECK(61, 33, 102) // Compatibility for profiles <= FFMPEG 8
++# define AV_PROFILE_UNKNOWN FF_PROFILE_UNKNOWN
++# define AV_LEVEL_UNKNOWN FF_LEVEL_UNKNOWN
++# define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
++#endif
++
+ /*****************************************************************************
+ * decoder_sys_t : decoder descriptor
+ *****************************************************************************/
+@@ -101,7 +107,7 @@ static void InitDecoderConfig( decoder_t
+ if( i_size > 0 )
+ {
+ p_context->extradata =
+- av_malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
++ av_malloc( i_size + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( p_context->extradata )
+ {
+ uint8_t *p_dst = p_context->extradata;
+@@ -109,7 +115,7 @@ static void InitDecoderConfig( decoder_t
+ p_context->extradata_size = i_size;
+
+ memcpy( &p_dst[0], &p_src[i_offset], i_size );
+- memset( &p_dst[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
++ memset( &p_dst[i_size], 0, AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+ }
+ }
+@@ -266,9 +272,9 @@ int InitAudioDec( vlc_object_t *obj )
+ p_dec->pf_flush = Flush;
+
+ /* XXX: Writing input format makes little sense. */
+- if( avctx->profile != FF_PROFILE_UNKNOWN )
++ if( avctx->profile != AV_PROFILE_UNKNOWN )
+ p_dec->fmt_in.i_profile = avctx->profile;
+- if( avctx->level != FF_LEVEL_UNKNOWN )
++ if( avctx->level != AV_LEVEL_UNKNOWN )
+ p_dec->fmt_in.i_level = avctx->level;
+
+ return VLC_SUCCESS;
+@@ -348,11 +354,11 @@ static int DecodeBlock( decoder_t *p_dec
+
+ if( (p_block->i_flags & BLOCK_FLAG_PRIVATE_REALLOCATED) == 0 )
+ {
+- *pp_block = p_block = block_Realloc( p_block, 0, p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
++ *pp_block = p_block = block_Realloc( p_block, 0, p_block->i_buffer + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( !p_block )
+ goto end;
+- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+- memset( &p_block->p_buffer[p_block->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE );
++ p_block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
++ memset( &p_block->p_buffer[p_block->i_buffer], 0, AV_INPUT_BUFFER_PADDING_SIZE );
+
+ p_block->i_flags |= BLOCK_FLAG_PRIVATE_REALLOCATED;
+ }
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/avcommon_compat.h vlc-3.0.21/modules/codec/avcodec/avcommon_compat.h
+--- vlc-3.0.21.orig/modules/codec/avcodec/avcommon_compat.h 2025-11-17 18:16:27.478199137 -0500
++++ vlc-3.0.21/modules/codec/avcodec/avcommon_compat.h 2025-11-17 18:17:09.718111806 -0500
+@@ -53,8 +53,11 @@
+ #ifndef AV_CODEC_FLAG2_FAST
+ # define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST
+ #endif
+-#ifndef FF_INPUT_BUFFER_PADDING_SIZE
+-# define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
++#if ! LIBAVCODEC_VERSION_CHECK(61, 33, 102) // Compatibility for profiles <= FFMPEG 8
++# ifndef FF_INPUT_BUFFER_PADDING_SIZE
++# define FF_INPUT_BUFFER_PADDING_SIZE 64
++# endif
++#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
+ #endif
+ #ifndef AV_CODEC_FLAG_INTERLACED_DCT
+ # define AV_CODEC_FLAG_INTERLACED_DCT CODEC_FLAG_INTERLACED_DCT
+@@ -72,7 +75,11 @@
+ # define AV_CODEC_CAP_SMALL_LAST_FRAME CODEC_CAP_SMALL_LAST_FRAME
+ #endif
+ #ifndef AV_INPUT_BUFFER_MIN_SIZE
+-# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE
++# ifdef FF_MIN_BUFFER_SIZE
++# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE
++# else
++# define AV_INPUT_BUFFER_MIN_SIZE 16384 // removed with ffmpeg 8
++# endif
+ #endif
+ #ifndef FF_MAX_B_FRAMES
+ # define FF_MAX_B_FRAMES 16 // FIXME: remove this
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/encoder.c vlc-3.0.21/modules/codec/avcodec/encoder.c
+--- vlc-3.0.21.orig/modules/codec/avcodec/encoder.c 2025-11-17 18:16:27.481068106 -0500
++++ vlc-3.0.21/modules/codec/avcodec/encoder.c 2025-11-17 15:11:31.691944598 -0500
+@@ -65,6 +65,17 @@
+ # define AVC_MAYBE_CONST
+ #endif
+
++#if ! LIBAVCODEC_VERSION_CHECK(61, 33, 102) // Compatibility for profiles <= FFMPEG 8
++# define AV_PROFILE_AAC_MAIN FF_PROFILE_AAC_MAIN
++# define AV_PROFILE_AAC_LOW FF_PROFILE_AAC_LOW
++# define AV_PROFILE_AAC_SSR FF_PROFILE_AAC_SSR
++# define AV_PROFILE_AAC_LTP FF_PROFILE_AAC_LTP
++# define AV_PROFILE_AAC_HE_V2 FF_PROFILE_AAC_HE_V2
++# define AV_PROFILE_AAC_HE FF_PROFILE_AAC_HE
++# define AV_PROFILE_AAC_LD FF_PROFILE_AAC_LD
++# define AV_PROFILE_AAC_ELD FF_PROFILE_AAC_ELD
++#endif
++
+ /*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+@@ -468,30 +479,30 @@ int InitVideoEnc( vlc_object_t *p_this )
+ psz_val = var_GetString( p_enc, ENC_CFG_PREFIX "aac-profile" );
+ /* libavcodec uses faac encoder atm, and it has issues with
+ * other than low-complexity profile, so default to that */
+- p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
+ if( psz_val && *psz_val )
+ {
+ if( !strncmp( psz_val, "main", 4 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_MAIN;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_MAIN;
+ else if( !strncmp( psz_val, "low", 3 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
+ else if( !strncmp( psz_val, "ssr", 3 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_SSR;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_SSR;
+ else if( !strncmp( psz_val, "ltp", 3 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_LTP;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_LTP;
+ /* These require libavcodec with libfdk-aac */
+ else if( !strncmp( psz_val, "hev2", 4 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_HE_V2;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_HE_V2;
+ else if( !strncmp( psz_val, "hev1", 4 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_HE;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_HE;
+ else if( !strncmp( psz_val, "ld", 2 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_LD;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_LD;
+ else if( !strncmp( psz_val, "eld", 3 ) )
+- p_sys->i_aac_profile = FF_PROFILE_AAC_ELD;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_ELD;
+ else
+ {
+ msg_Warn( p_enc, "unknown AAC profile requested, setting it to low" );
+- p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
++ p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
+ }
+ }
+ free( psz_val );
+@@ -1217,8 +1228,19 @@ static block_t *EncodeVideo( encoder_t *
+ frame->pict_type = 0;
+
+ frame->repeat_pict = p_pict->i_nb_fields - 2;
++#if LIBAVUTIL_VERSION_CHECK( 58, 7, 100 )
++ if (p_pict->b_progressive)
++ frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
++ else
++ frame->flags |= AV_FRAME_FLAG_INTERLACED;
++ if (p_pict->b_top_field_first)
++ frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
++ else
++ frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
++#else
+ frame->interlaced_frame = !p_pict->b_progressive;
+ frame->top_field_first = !!p_pict->b_top_field_first;
++#endif
+
+ frame->format = p_sys->p_context->pix_fmt;
+ frame->width = p_sys->p_context->width;
+@@ -1473,9 +1495,8 @@ void EndVideoEnc( vlc_object_t *p_this )
+ av_frame_free( &p_sys->frame );
+
+ vlc_avcodec_lock();
+- avcodec_close( p_sys->p_context );
+- vlc_avcodec_unlock();
+ avcodec_free_context( &p_sys->p_context );
++ vlc_avcodec_unlock();
+
+
+ av_free( p_sys->p_interleave_buf );
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/subtitle.c vlc-3.0.21/modules/codec/avcodec/subtitle.c
+--- vlc-3.0.21.orig/modules/codec/avcodec/subtitle.c 2025-11-17 18:16:27.475904814 -0500
++++ vlc-3.0.21/modules/codec/avcodec/subtitle.c 2025-11-17 18:17:09.718626249 -0500
+@@ -174,11 +174,11 @@ static subpicture_t *DecodeBlock(decoder
+ *block_ptr =
+ block = block_Realloc(block,
+ 0,
+- block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
++ block->i_buffer + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!block)
+ return NULL;
+- block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+- memset(&block->p_buffer[block->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE);
++ block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
++ memset(&block->p_buffer[block->i_buffer], 0, AV_INPUT_BUFFER_PADDING_SIZE);
+
+ /* */
+ AVSubtitle subtitle;
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/vaapi.c vlc-3.0.21/modules/codec/avcodec/vaapi.c
+--- vlc-3.0.21.orig/modules/codec/avcodec/vaapi.c 2024-06-05 11:56:07.000000000 -0400
++++ vlc-3.0.21/modules/codec/avcodec/vaapi.c 2025-11-17 18:17:09.718869643 -0500
+@@ -87,9 +87,9 @@ static int GetVaProfile(AVCodecContext *
+ count = 18;
+ break;
+ case AV_CODEC_ID_HEVC:
+- if (ctx->profile == FF_PROFILE_HEVC_MAIN)
++ if (ctx->profile == AV_PROFILE_HEVC_MAIN)
+ i_profile = VAProfileHEVCMain;
+- else if (ctx->profile == FF_PROFILE_HEVC_MAIN_10)
++ else if (ctx->profile == AV_PROFILE_HEVC_MAIN_10)
+ {
+ i_profile = VAProfileHEVCMain10;
+ i_vlc_chroma = VLC_CODEC_VAAPI_420_10BPP;
+@@ -103,10 +103,10 @@ static int GetVaProfile(AVCodecContext *
+ count = 5;
+ break;
+ case AV_CODEC_ID_VP9:
+- if (ctx->profile == FF_PROFILE_VP9_0)
++ if (ctx->profile == AV_PROFILE_VP9_0)
+ i_profile = VAProfileVP9Profile0;
+ #if VA_CHECK_VERSION( 0, 39, 0 )
+- else if (ctx->profile == FF_PROFILE_VP9_2)
++ else if (ctx->profile == AV_PROFILE_VP9_2)
+ {
+ i_profile = VAProfileVP9Profile2;
+ i_vlc_chroma = VLC_CODEC_VAAPI_420_10BPP;
+diff -Nuarp vlc-3.0.21.orig/modules/codec/avcodec/video.c vlc-3.0.21/modules/codec/avcodec/video.c
+--- vlc-3.0.21.orig/modules/codec/avcodec/video.c 2025-11-17 18:16:27.479151968 -0500
++++ vlc-3.0.21/modules/codec/avcodec/video.c 2025-11-17 15:17:39.571811094 -0500
+@@ -50,6 +50,13 @@
+ #include "../../packetizer/av1.h"
+ #include "../codec/cc.h"
+
++#if ! LIBAVCODEC_VERSION_CHECK(61, 33, 102) // Compatibility for profiles <= FFMPEG 8
++# define AV_PROFILE_UNKNOWN FF_PROFILE_UNKNOWN
++# define AV_LEVEL_UNKNOWN FF_LEVEL_UNKNOWN
++# define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
++#endif
++
++
+ /*****************************************************************************
+ * decoder_sys_t : decoder descriptor
+ *****************************************************************************/
+@@ -200,8 +207,7 @@ static int lavc_GetVideoFormat(decoder_t
+ else if (ctx->time_base.num > 0 && ctx->time_base.den > 0)
+ {
+ fmt->i_frame_rate = ctx->time_base.den;
+- fmt->i_frame_rate_base = ctx->time_base.num
+- * __MAX(ctx->ticks_per_frame, 1);
++ fmt->i_frame_rate_base = ctx->time_base.num;
+ }
+
+ /* FIXME we should only set the known values and let the core decide
+@@ -323,12 +329,10 @@ static int lavc_UpdateVideoFormat(decode
+
+ /* always have date in fields/ticks units */
+ if(dec->p_sys->pts.i_divider_num)
+- date_Change(&dec->p_sys->pts, fmt_out.i_frame_rate *
+- __MAX(ctx->ticks_per_frame, 1),
++ date_Change(&dec->p_sys->pts, fmt_out.i_frame_rate,
+ fmt_out.i_frame_rate_base);
+ else
+- date_Init(&dec->p_sys->pts, fmt_out.i_frame_rate *
+- __MAX(ctx->ticks_per_frame, 1),
++ date_Init(&dec->p_sys->pts, fmt_out.i_frame_rate,
+ fmt_out.i_frame_rate_base);
+
+ fmt_out.p_palette = dec->fmt_out.video.p_palette;
+@@ -622,9 +626,9 @@ static int InitVideoDecCommon( decoder_t
+ p_dec->pf_flush = Flush;
+
+ /* XXX: Writing input format makes little sense. */
+- if( p_context->profile != FF_PROFILE_UNKNOWN )
++ if( p_context->profile != AV_PROFILE_UNKNOWN )
+ p_dec->fmt_in.i_profile = p_context->profile;
+- if( p_context->level != FF_LEVEL_UNKNOWN )
++ if( p_context->level != AV_LEVEL_UNKNOWN )
+ p_dec->fmt_in.i_level = p_context->level;
+ return VLC_SUCCESS;
+ }
+@@ -937,9 +941,11 @@ static vlc_tick_t interpolate_next_pts(
+ p_sys->pts.i_divider_num == 0 )
+ return VLC_TICK_INVALID;
+
++#if LIBAVCODEC_VERSION_CHECK( 60, 12, 100 )
++ int i_tick = p_context->codec_descriptor->props & AV_CODEC_PROP_FIELDS ? 2 : 1;
++#else
+ int i_tick = p_context->ticks_per_frame;
+- if( i_tick <= 0 )
+- i_tick = 1;
++#endif
+
+ /* interpolate the next PTS */
+ return date_Increment( &p_sys->pts, i_tick + frame->repeat_pict );
+@@ -1179,13 +1185,13 @@ static picture_t *DecodeBlock( decoder_t
+ eos_spotted = ( p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE ) != 0;
+
+ p_block = block_Realloc( p_block, 0,
+- p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
++ p_block->i_buffer + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( !p_block )
+ return NULL;
+- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
++ p_block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
+ *pp_block = p_block;
+ memset( p_block->p_buffer + p_block->i_buffer, 0,
+- FF_INPUT_BUFFER_PADDING_SIZE );
++ AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+
+ do
+@@ -1414,8 +1420,13 @@ static picture_t *DecodeBlock( decoder_t
+ /* Hack to force display of still pictures */
+ p_pic->b_force = p_sys->b_first_frame;
+ p_pic->i_nb_fields = 2 + frame->repeat_pict;
++#if LIBAVUTIL_VERSION_CHECK( 58, 7, 100 )
++ p_pic->b_progressive = !(frame->flags & AV_FRAME_FLAG_INTERLACED);
++ p_pic->b_top_field_first = !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
++#else
+ p_pic->b_progressive = !frame->interlaced_frame;
+ p_pic->b_top_field_first = frame->top_field_first;
++#endif
+
+ if (DecodeSidedata(p_dec, frame, p_pic))
+ i_pts = VLC_TICK_INVALID;
+@@ -1502,7 +1513,7 @@ static void ffmpeg_InitCodec( decoder_t
+ p_sys->p_context->extradata_size = i_size + 12;
+ p = p_sys->p_context->extradata =
+ av_malloc( p_sys->p_context->extradata_size +
+- FF_INPUT_BUFFER_PADDING_SIZE );
++ AV_INPUT_BUFFER_PADDING_SIZE );
+ if( !p )
+ return;
+
+@@ -1539,13 +1550,13 @@ static void ffmpeg_InitCodec( decoder_t
+ {
+ p_sys->p_context->extradata_size = i_size;
+ p_sys->p_context->extradata =
+- av_malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
++ av_malloc( i_size + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( p_sys->p_context->extradata )
+ {
+ memcpy( p_sys->p_context->extradata,
+ p_dec->fmt_in.p_extra, i_size );
+ memset( p_sys->p_context->extradata + i_size,
+- 0, FF_INPUT_BUFFER_PADDING_SIZE );
++ 0, AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+ }
+ }
+diff -Nuarp vlc-3.0.21.orig/modules/demux/avformat/demux.c vlc-3.0.21/modules/demux/avformat/demux.c
+--- vlc-3.0.21.orig/modules/demux/avformat/demux.c 2025-11-17 18:16:27.482817115 -0500
++++ vlc-3.0.21/modules/demux/avformat/demux.c 2025-11-17 15:40:29.653691401 -0500
+@@ -112,6 +112,18 @@ static vlc_fourcc_t CodecTagToFourcc( ui
+ #endif
+ }
+
++static inline void* GetStreamSideData(const AVStream *s, enum AVPacketSideDataType type)
++{
++#if LIBAVCODEC_VERSION_CHECK( 60, 29, 100 )
++ const AVCodecParameters *cp = s->codecpar;
++ const AVPacketSideData *psd =
++ av_packet_side_data_get(cp->coded_side_data, cp->nb_coded_side_data, type);
++ return psd ? psd->data : NULL;
++#else
++ return av_stream_get_side_data(s, type, NULL);
++#endif
++}
++
+ /*****************************************************************************
+ * Open
+ *****************************************************************************/
+@@ -138,7 +150,8 @@ static void get_rotation(es_format_t *fm
+ else
+ fmt->video.orientation = ORIENT_NORMAL;
+ }
+- int32_t *matrix = (int32_t *)av_stream_get_side_data(s, AV_PKT_DATA_DISPLAYMATRIX, NULL);
++
++ int32_t *matrix = GetStreamSideData(s, AV_PKT_DATA_DISPLAYMATRIX);
+ if( matrix ) {
+ angle = lround(av_display_rotation_get(matrix));
+