git: d3f02ad3fa71 - main - multimedia/vlc: Update to 3.0.22

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Thu, 25 Dec 2025 02:40:33 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d3f02ad3fa71931f8c9168eac71660bc7e542a76

commit d3f02ad3fa71931f8c9168eac71660bc7e542a76
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2025-12-25 02:38:45 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2025-12-25 02:40:28 +0000

    multimedia/vlc: Update to 3.0.22
    
    https://code.videolan.org/videolan/vlc/-/tags/3.0.22
---
 multimedia/vlc/Makefile                            |    6 +-
 multimedia/vlc/distinfo                            |    6 +-
 .../vlc/files/patch-modules_access_live555.cpp     |   17 -
 .../files/patch-modules_meta__engine_taglib.cpp    |  159 ---
 .../vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch    | 1139 --------------------
 multimedia/vlc/files/vlc-3.0.21-ffmpeg8-1.patch    |  393 -------
 multimedia/vlc/files/vlc-3.0.22-ffmpeg8.patch      |  324 ++++++
 multimedia/vlc/pkg-plist                           |    4 +-
 8 files changed, 331 insertions(+), 1717 deletions(-)

diff --git a/multimedia/vlc/Makefile b/multimedia/vlc/Makefile
index 8b5911ac8653..fcb368e641d9 100644
--- a/multimedia/vlc/Makefile
+++ b/multimedia/vlc/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	vlc
-DISTVERSION=	3.0.21
-PORTREVISION=	21
+DISTVERSION=	3.0.22
 PORTEPOCH=	4
 CATEGORIES=	multimedia audio net www
 MASTER_SITES=	https://get.videolan.org/${PORTNAME}/${DISTVERSION:S/a$//}/ \
@@ -28,8 +27,7 @@ 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
+EXTRA_PATCHES=	${FILESDIR}/vlc-3.0.22-ffmpeg8.patch:-p1
 
 USES=		compiler:c++17-lang cpe desktop-file-utils elfctl gettext-tools \
 		gl gmake gnome iconv:wchar_t libtool localbase pathfix pkgconfig \
diff --git a/multimedia/vlc/distinfo b/multimedia/vlc/distinfo
index f6fefd30d612..fcc6ae9e4cb3 100644
--- a/multimedia/vlc/distinfo
+++ b/multimedia/vlc/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1718023017
-SHA256 (vlc-3.0.21.tar.xz) = 24dbbe1d7dfaeea0994d5def0bbde200177347136dbfe573f5b6a4cee25afbb0
-SIZE (vlc-3.0.21.tar.xz) = 25649288
+TIMESTAMP = 1766620787
+SHA256 (vlc-3.0.22.tar.xz) = e2cc1cf0ae0902a09da5a37c249a8a4e4b5ec4dc095443b8e1493c6a7cc138ea
+SIZE (vlc-3.0.22.tar.xz) = 26427084
diff --git a/multimedia/vlc/files/patch-modules_access_live555.cpp b/multimedia/vlc/files/patch-modules_access_live555.cpp
deleted file mode 100644
index e2cdbce158dd..000000000000
--- a/multimedia/vlc/files/patch-modules_access_live555.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-The signature of doEventLoop() was changed to match that of
-triggerEvent(), by using std::atomic_char as the 'watch variable'
-type in net/liveMedia 2024.11.28.
-
---- modules/access/live555.cpp.orig	2024-06-05 15:56:07 UTC
-+++ modules/access/live555.cpp
-@@ -236,8 +236,8 @@ struct demux_sys_t
-     bool             b_no_data;     /* if we never received any data */
-     int              i_no_data_ti;  /* consecutive number of TaskInterrupt */
- 
--    char             event_rtsp;
--    char             event_data;
-+    std::atomic_char             event_rtsp;
-+    std::atomic_char             event_data;
- 
-     bool             b_get_param;   /* Does the server support GET_PARAMETER */
-     bool             b_paused;      /* Are we paused? */
diff --git a/multimedia/vlc/files/patch-modules_meta__engine_taglib.cpp b/multimedia/vlc/files/patch-modules_meta__engine_taglib.cpp
deleted file mode 100644
index 1c4cdf0b9ec3..000000000000
--- a/multimedia/vlc/files/patch-modules_meta__engine_taglib.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-Backport upstream fixes for taglib 2.x support and remove usages of member
-functions that were deprecated in taglib 1.x and removed in 2.x.
-
-Obtained from:
-https://code.videolan.org/videolan/vlc/-/commit/d2663d6c3fe3af76bdefd58367b4a45c598b83e4
-https://code.videolan.org/videolan/vlc/-/commit/ac59d0ba59ba800c52c0a92ec1d9576d2653dbe2
-https://code.videolan.org/videolan/vlc/-/commit/c404fdb24183031a419667639846edddca3401f8
-https://code.videolan.org/videolan/vlc/-/commit/ec29dfca1e59530dd412d779e0b045079b72ffb6
-
---- modules/meta_engine/taglib.cpp.orig	2023-04-22 23:27:28 UTC
-+++ modules/meta_engine/taglib.cpp
-@@ -125,7 +125,11 @@ File *VLCTagLib::ExtResolver<T>::createFile(FileName f
- template <class T>
- File *VLCTagLib::ExtResolver<T>::createFile(FileName fileName, bool, AudioProperties::ReadStyle) const
- {
-+#if defined(_WIN32) && TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    std::string filename = fileName.toString().to8Bit(true);
-+#else
-     std::string filename = std::string(fileName);
-+#endif
-     std::size_t namesize = filename.size();
- 
-     if (namesize > ext.length())
-@@ -180,12 +184,16 @@ class VlcIostream : public IOStream (public)
-         return m_stream->psz_location;
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    ByteVector readBlock(size_t length)
-+#else
-     ByteVector readBlock(ulong length)
-+#endif
-     {
-         ByteVector res(length, 0);
-         ssize_t i_read = vlc_stream_Read( m_stream, res.data(), length);
-         if (i_read < 0)
--            return ByteVector::null;
-+            return {};
-         else if ((size_t)i_read != length)
-             res.resize(i_read);
-         return res;
-@@ -196,11 +204,19 @@ class VlcIostream : public IOStream (public)
-         // Let's stay Read-Only for now
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    void insert(const ByteVector&, offset_t, size_t)
-+#else
-     void insert(const ByteVector&, ulong, ulong)
-+#endif
-     {
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    void removeBlock(offset_t, size_t)
-+#else
-     void removeBlock(ulong, ulong)
-+#endif
-     {
-     }
- 
-@@ -214,7 +230,11 @@ class VlcIostream : public IOStream (public)
-         return true;
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    void seek(offset_t offset, Position p)
-+#else
-     void seek(long offset, Position p)
-+#endif
-     {
-         uint64_t pos = 0;
-         switch (p)
-@@ -237,12 +257,20 @@ class VlcIostream : public IOStream (public)
-         return;
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    offset_t tell() const
-+#else
-     long tell() const
-+#endif
-     {
-         return m_previousPos;
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    offset_t length()
-+#else
-     long length()
-+#endif
-     {
-         uint64_t i_size;
-         if (vlc_stream_GetSize( m_stream, &i_size ) != VLC_SUCCESS)
-@@ -250,7 +278,11 @@ class VlcIostream : public IOStream (public)
-         return i_size;
-     }
- 
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+    void truncate(offset_t)
-+#else
-     void truncate(long)
-+#endif
-     {
-     }
- 
-@@ -465,7 +497,7 @@ static void ReadMetaFromBasicTag(const Tag* tag, vlc_m
- static void ReadMetaFromBasicTag(const Tag* tag, vlc_meta_t *dest)
- {
- #define SET( accessor, meta )                                                  \
--    if( !tag->accessor().isNull() && !tag->accessor().isEmpty() )              \
-+    if( !tag->accessor().isEmpty() )                                           \
-         vlc_meta_Set##meta( dest, tag->accessor().toCString(true) )
- #define SETINT( accessor, meta )                                               \
-     if( tag->accessor() )                                                      \
-@@ -806,15 +838,15 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta
- {
-     MP4::Item list;
- #define SET( keyName, metaName )                                                             \
--    if( tag->itemListMap().contains(keyName) )                                               \
-+    if( tag->contains(keyName) )                                                             \
-     {                                                                                        \
--        list = tag->itemListMap()[keyName];                                                  \
-+        list = tag->item(keyName);                                                           \
-         vlc_meta_Set##metaName( p_meta, list.toStringList().front().toCString( true ) );     \
-     }
- #define SET_EXTRA( keyName, metaName )                                                   \
--    if( tag->itemListMap().contains(keyName) )                                  \
-+    if( tag->contains(keyName) )                                                     \
-     {                                                                                \
--        list = tag->itemListMap()[keyName];                                     \
-+        list = tag->item(keyName);                                                   \
-         vlc_meta_AddExtra( p_meta, metaName, list.toStringList().front().toCString( true ) ); \
-     }
- 
-@@ -824,9 +856,9 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta
- #undef SET
- #undef SET_EXTRA
- 
--    if( tag->itemListMap().contains("covr") )
-+    if( tag->contains("covr") )
-     {
--        MP4::CoverArtList list = tag->itemListMap()["covr"].toCoverArtList();
-+        MP4::CoverArtList list = tag->item("covr").toCoverArtList();
-         const char *psz_format = list[0].format() == MP4::CoverArt::PNG ? "image/png" : "image/jpeg";
- 
-         msg_Dbg( p_demux_meta, "Found embedded art (%s) is %i bytes",
-@@ -1337,7 +1369,11 @@ static int WriteMeta( vlc_object_t *p_this )
-         if( RIFF::AIFF::File* riff_aiff = dynamic_cast<RIFF::AIFF::File*>(f.file()) )
-             WriteMetaToId3v2( riff_aiff->tag(), p_item );
-         else if( RIFF::WAV::File* riff_wav = dynamic_cast<RIFF::WAV::File*>(f.file()) )
-+#if TAGLIB_VERSION >= VERSION_INT(2, 0, 0)
-+            WriteMetaToId3v2( riff_wav->ID3v2Tag(), p_item );
-+#else
-             WriteMetaToId3v2( riff_wav->tag(), p_item );
-+#endif
-     }
-     else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
-     {
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
deleted file mode 100644
index d6df9831ddca..000000000000
--- a/multimedia/vlc/files/vlc-3.0.21-fedora_ffmpeg7-1.patch
+++ /dev/null
@@ -1,1139 +0,0 @@
-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
-          */
- 
*** 1154 LINES SKIPPED ***