Yaakov Selkowitz 2 months ago
parent 7b9cb9e242
commit db2b332ca1

@ -1,4 +1,4 @@
From a4645b577c71e58db09ee6888f270fb3d0cfd61e Mon Sep 17 00:00:00 2001 From 81d6d56df6e5a66ed99970e2c559539858f4a0b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sat, 5 May 2018 15:28:15 +0300 Date: Sat, 5 May 2018 15:28:15 +0300
Subject: [PATCH 01/11] avcodec: avoid signedness mismatch warning Subject: [PATCH 01/11] avcodec: avoid signedness mismatch warning
@ -11,7 +11,7 @@ Bitmask should be unsigned, but ffmpeg seems confused with itself.
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 50a76c7a18e1..e5af0ca5f2f8 100644 index 50a76c7a18e..e5af0ca5f2f 100644
--- a/modules/codec/avcodec/audio.c --- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c +++ b/modules/codec/avcodec/audio.c
@@ -593,9 +593,9 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) @@ -593,9 +593,9 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
@ -30,7 +30,7 @@ index 50a76c7a18e1..e5af0ca5f2f8 100644
GitLab GitLab
From 2d51293c3f8e0bfa2b73112acf4dacb62b40ac57 Mon Sep 17 00:00:00 2001 From c7709e7a048eb69b656d7f9663debbc1dde1f591 Mon Sep 17 00:00:00 2001
From: Ilkka Ollakka <ileoo@videolan.org> From: Ilkka Ollakka <ileoo@videolan.org>
Date: Wed, 5 Jul 2023 12:51:34 +0300 Date: Wed, 5 Jul 2023 12:51:34 +0300
Subject: [PATCH 02/11] avcodec: use p_dec->fmt_out instead of context channels Subject: [PATCH 02/11] avcodec: use p_dec->fmt_out instead of context channels
@ -44,7 +44,7 @@ reduces the need of ifdefs when adding ch_layout support
1 file changed, 7 insertions(+), 7 deletions(-) 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index e5af0ca5f2f8..26166c084e51 100644 index e5af0ca5f2f..26166c084e5 100644
--- a/modules/codec/avcodec/audio.c --- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c +++ b/modules/codec/avcodec/audio.c
@@ -484,15 +484,15 @@ static block_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame ) @@ -484,15 +484,15 @@ static block_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame )
@ -96,7 +96,7 @@ index e5af0ca5f2f8..26166c084e51 100644
GitLab GitLab
From 1e5bd8a6f5fbf2c07071cefb1b24aceff058760d Mon Sep 17 00:00:00 2001 From 99b14966182995314f5b29fd972d6a9000ea3e00 Mon Sep 17 00:00:00 2001
From: Ilkka Ollakka <ileoo@videolan.org> From: Ilkka Ollakka <ileoo@videolan.org>
Date: Wed, 5 Jul 2023 13:33:09 +0300 Date: Wed, 5 Jul 2023 13:33:09 +0300
Subject: [PATCH 03/11] avcodec: audio decoder to use ch_layout Subject: [PATCH 03/11] avcodec: audio decoder to use ch_layout
@ -107,7 +107,7 @@ Subject: [PATCH 03/11] avcodec: audio decoder to use ch_layout
1 file changed, 34 insertions(+), 8 deletions(-) 1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 26166c084e51..ad8a40ab4ed6 100644 index 26166c084e5..ad8a40ab4ed 100644
--- a/modules/codec/avcodec/audio.c --- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c +++ b/modules/codec/avcodec/audio.c
@@ -139,7 +139,11 @@ static int OpenAudioCodec( decoder_t *p_dec ) @@ -139,7 +139,11 @@ static int OpenAudioCodec( decoder_t *p_dec )
@ -210,7 +210,7 @@ index 26166c084e51..ad8a40ab4ed6 100644
GitLab GitLab
From 1fbf3f028cffed87cb257a45668760370db267cf Mon Sep 17 00:00:00 2001 From c44edb85e4f25cbc7a848211d2d3ca9f03bd46e6 Mon Sep 17 00:00:00 2001
From: Ilkka Ollakka <ileoo@videolan.org> From: Ilkka Ollakka <ileoo@videolan.org>
Date: Tue, 4 Jul 2023 16:52:38 +0300 Date: Tue, 4 Jul 2023 16:52:38 +0300
Subject: [PATCH 04/11] avcodec: use p_enc audio channels instead of context Subject: [PATCH 04/11] avcodec: use p_enc audio channels instead of context
@ -224,7 +224,7 @@ Allows to have less conditions in code when adding new ch_layout use
1 file changed, 12 insertions(+), 12 deletions(-) 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 4919ccf0e0e4..52848de06587 100644 index 4919ccf0e0e..52848de0658 100644
--- a/modules/codec/avcodec/encoder.c --- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c
@@ -790,7 +790,7 @@ int InitVideoEnc( vlc_object_t *p_this ) @@ -790,7 +790,7 @@ int InitVideoEnc( vlc_object_t *p_this )
@ -336,7 +336,7 @@ index 4919ccf0e0e4..52848de06587 100644
GitLab GitLab
From a1a3edd4eacc813e5b4c3a6f353b92f4069fbc1a Mon Sep 17 00:00:00 2001 From b8ad80a20e9e84082dac2848070d251fa68412c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr> From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Tue, 23 Apr 2024 13:13:30 +0700 Date: Tue, 23 Apr 2024 13:13:30 +0700
Subject: [PATCH 05/11] codec: avcodec: map AYUV as RAWVIDEO with ffmpeg 6.0 Subject: [PATCH 05/11] codec: avcodec: map AYUV as RAWVIDEO with ffmpeg 6.0
@ -347,7 +347,7 @@ Subject: [PATCH 05/11] codec: avcodec: map AYUV as RAWVIDEO with ffmpeg 6.0
1 file changed, 5 insertions(+), 1 deletion(-) 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index 33c6cae09abc..97f3188211d3 100644 index 33c6cae09ab..97f3188211d 100644
--- a/modules/codec/avcodec/fourcc.c --- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c +++ b/modules/codec/avcodec/fourcc.c
@@ -182,8 +182,12 @@ static const struct vlc_avcodec_fourcc video_codecs[] = @@ -182,8 +182,12 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
@ -368,8 +368,8 @@ index 33c6cae09abc..97f3188211d3 100644
GitLab GitLab
From da6f67588dacf60c7563fd720cc75e1912215a45 Mon Sep 17 00:00:00 2001 From 58c05240c26b6eef56e7c5ab35b14ccd8377667f Mon Sep 17 00:00:00 2001
From: Francois Cartegnie <fcvlcdev@free.fr> From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Thu, 13 Jun 2024 12:21:58 +0700 Date: Thu, 13 Jun 2024 12:21:58 +0700
Subject: [PATCH 06/11] avcodec: encoder: fix channel_layout conditionals Subject: [PATCH 06/11] avcodec: encoder: fix channel_layout conditionals
@ -378,7 +378,7 @@ Subject: [PATCH 06/11] avcodec: encoder: fix channel_layout conditionals
1 file changed, 8 insertions(+), 3 deletions(-) 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 52848de06587..6bd58f5071d2 100644 index 52848de0658..6bd58f5071d 100644
--- a/modules/codec/avcodec/encoder.c --- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c
@@ -43,12 +43,13 @@ @@ -43,12 +43,13 @@
@ -436,8 +436,8 @@ index 52848de06587..6bd58f5071d2 100644
GitLab GitLab
From 8e2d209d0897138ba13372ab49c0ee7cef7c316c Mon Sep 17 00:00:00 2001 From 3db6e677680a1a94e473fe9d9fc121af34cdcf2b Mon Sep 17 00:00:00 2001
From: Francois Cartegnie <fcvlcdev@free.fr> From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Sat, 17 Aug 2024 11:22:33 +0700 Date: Sat, 17 Aug 2024 11:22:33 +0700
Subject: [PATCH 07/11] codec: avcodec: fix audio channel_layout conditionals Subject: [PATCH 07/11] codec: avcodec: fix audio channel_layout conditionals
@ -446,7 +446,7 @@ Subject: [PATCH 07/11] codec: avcodec: fix audio channel_layout conditionals
1 file changed, 15 insertions(+), 8 deletions(-) 1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index ad8a40ab4ed6..c74757c76ae5 100644 index ad8a40ab4ed..c74757c76ae 100644
--- a/modules/codec/avcodec/audio.c --- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c +++ b/modules/codec/avcodec/audio.c
@@ -41,8 +41,11 @@ @@ -41,8 +41,11 @@
@ -501,7 +501,7 @@ index ad8a40ab4ed6..c74757c76ae5 100644
GitLab GitLab
From cc5306f9b4eaac1b684747d65c04901008423f61 Mon Sep 17 00:00:00 2001 From b5bb9bda03a06fc1cfd682dacb571b688b5558d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr> From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Tue, 23 Apr 2024 13:14:53 +0700 Date: Tue, 23 Apr 2024 13:14:53 +0700
Subject: [PATCH 08/11] demux/mux: avformat: use ch_layout from ffmpeg 5.1 Subject: [PATCH 08/11] demux/mux: avformat: use ch_layout from ffmpeg 5.1
@ -514,7 +514,7 @@ and fixup 195f0c98599b55950c49a62f98d9d3495be310df
2 files changed, 8 insertions(+) 2 files changed, 8 insertions(+)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 3b355bb3faec..830dc0157e2b 100644 index 3b355bb3fae..830dc0157e2 100644
--- a/modules/demux/avformat/demux.c --- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c +++ b/modules/demux/avformat/demux.c
@@ -401,7 +401,11 @@ int avformat_OpenDemux( vlc_object_t *p_this ) @@ -401,7 +401,11 @@ int avformat_OpenDemux( vlc_object_t *p_this )
@ -530,7 +530,7 @@ index 3b355bb3faec..830dc0157e2b 100644
es_fmt.audio.i_bitspersample = cp->bits_per_coded_sample; es_fmt.audio.i_bitspersample = cp->bits_per_coded_sample;
es_fmt.audio.i_blockalign = cp->block_align; es_fmt.audio.i_blockalign = cp->block_align;
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index c708276954ce..8bf8735885f5 100644 index c708276954c..8bf8735885f 100644
--- a/modules/demux/avformat/mux.c --- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c +++ b/modules/demux/avformat/mux.c
@@ -267,7 +267,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) @@ -267,7 +267,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
@ -549,7 +549,7 @@ index c708276954ce..8bf8735885f5 100644
GitLab GitLab
From ad413ab9c0d8522cb79f7df3640249998902b6ca Mon Sep 17 00:00:00 2001 From fa001cda7f6b22843438c39dfc078050bb54c72a Mon Sep 17 00:00:00 2001
From: Ilkka Ollakka <ileoo@videolan.org> From: Ilkka Ollakka <ileoo@videolan.org>
Date: Tue, 4 Jul 2023 16:53:43 +0300 Date: Tue, 4 Jul 2023 16:53:43 +0300
Subject: [PATCH 09/11] avcodec: add handling of new ch_layout in audio encoder Subject: [PATCH 09/11] avcodec: add handling of new ch_layout in audio encoder
@ -562,7 +562,7 @@ conditioned to avcodec version where is it added
1 file changed, 13 insertions(+), 2 deletions(-) 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 6bd58f5071d2..757f93b46845 100644 index 6bd58f5071d..757f93b4684 100644
--- a/modules/codec/avcodec/encoder.c --- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c
@@ -927,11 +927,14 @@ errmsg: @@ -927,11 +927,14 @@ errmsg:
@ -612,7 +612,7 @@ index 6bd58f5071d2..757f93b46845 100644
GitLab GitLab
From 416eeca68bfb67b244827a45a4392bddb8cc0ce8 Mon Sep 17 00:00:00 2001 From bb62989ccc12866d308e6f38dc1513de9cb1c6da Mon Sep 17 00:00:00 2001
From: Ilkka Ollakka <ileoo@videolan.org> From: Ilkka Ollakka <ileoo@videolan.org>
Date: Tue, 4 Jul 2023 16:55:28 +0300 Date: Tue, 4 Jul 2023 16:55:28 +0300
Subject: [PATCH 10/11] avcodec: use ch_layout for channel layout in audio Subject: [PATCH 10/11] avcodec: use ch_layout for channel layout in audio
@ -628,7 +628,7 @@ also always create the mapping, as ch_layout is always there
1 file changed, 22 insertions(+), 31 deletions(-) 1 file changed, 22 insertions(+), 31 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 757f93b46845..ae746c99fc89 100644 index 757f93b4684..ae746c99fc8 100644
--- a/modules/codec/avcodec/encoder.c --- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c
@@ -183,6 +183,7 @@ static const uint64_t pi_channels_map[][2] = @@ -183,6 +183,7 @@ static const uint64_t pi_channels_map[][2] =
@ -728,7 +728,7 @@ index 757f93b46845..ae746c99fc89 100644
GitLab GitLab
From c493ec18c5f3d10ba5a967e81b80d03e79f2d8b7 Mon Sep 17 00:00:00 2001 From e020f9abb31809584e33d740593d6ae5a190771d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr> From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Mon, 12 Aug 2024 19:32:42 +0700 Date: Mon, 12 Aug 2024 19:32:42 +0700
Subject: [PATCH 11/11] codec: avcodec: bypass removed define for Intel Subject: [PATCH 11/11] codec: avcodec: bypass removed define for Intel
@ -741,7 +741,7 @@ adapted from cherry picked commit 1280728ad305f00ceba3491ce11bf66107017a6c
2 files changed, 8 insertions(+) 2 files changed, 8 insertions(+)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index e1560a9312cc..5260628364f0 100644 index e1560a9312c..5260628364f 100644
--- a/modules/codec/avcodec/d3d11va.c --- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c
@@ -55,6 +55,10 @@ @@ -55,6 +55,10 @@
@ -756,7 +756,7 @@ index e1560a9312cc..5260628364f0 100644
const es_format_t *, picture_sys_t *p_sys); const es_format_t *, picture_sys_t *p_sys);
static void Close(vlc_va_t *, void **); static void Close(vlc_va_t *, void **);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 2e6809a05410..037ad7d44887 100644 index 2e6809a0541..037ad7d4488 100644
--- a/modules/codec/avcodec/dxva2.c --- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c
@@ -43,6 +43,10 @@ @@ -43,6 +43,10 @@
@ -773,81 +773,3 @@ index 2e6809a05410..037ad7d44887 100644
-- --
GitLab GitLab
From: =?utf-8?q?Fran=C3=A7ois_Cartegnie?= <fcvlcdev@free.fr>
Date: Thu, 15 Aug 2024 12:09:56 +0200
Subject: mux: avformat: fix avio callbacks signature with ffmpeg 6.1
API signature changes introduced depending on a positive define,
then removed later, making it break prior or post removal...
---
modules/codec/avcodec/avcommon_compat.h | 3 +++
modules/demux/avformat/mux.c | 19 +++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
index 9d16b3d..561ad83 100644
--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -77,6 +77,9 @@
#ifndef FF_MAX_B_FRAMES
# define FF_MAX_B_FRAMES 16 // FIXME: remove this
#endif
+#ifndef FF_API_AVIO_WRITE_NONCONST // removed in ffmpeg 7
+# define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
+#endif
#endif /* HAVE_LIBAVCODEC_AVCODEC_H */
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 8bf8735..4994647 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -74,12 +74,18 @@ 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 FF_API_AVIO_WRITE_NONCONST
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 )
static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
- enum AVIODataMarkerType type, int64_t time);
+ enum AVIODataMarkerType type, int64_t time);
+#endif
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size );
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time);
#endif
+static int64_t IOSeek( void *opaque, int64_t offset, int whence );
/*****************************************************************************
* Open
@@ -411,8 +417,13 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
}
#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
+#if FF_API_AVIO_WRITE_NONCONST
int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time)
+#else
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time)
+#endif
{
VLC_UNUSED(time);
@@ -512,7 +523,11 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
/*****************************************************************************
* I/O wrappers for libavformat
*****************************************************************************/
+#if FF_API_AVIO_WRITE_NONCONST
static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size )
+#endif
{
sout_mux_t *p_mux = opaque;
sout_mux_sys_t *p_sys = p_mux->p_sys;

@ -0,0 +1,82 @@
From a618e31cf209168ae420e95750734a37359969e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
Date: Sun, 7 Jul 2024 11:14:05 +0200
Subject: [PATCH] mux: avformat: fix avio callbacks signature with ffmpeg 6.1
API signature changes introduced depending on a positive define,
then removed later, making it break prior or post removal...
(adapted from commit 503c04fad9239420be26d67aab4d5f63c53eb4f7)
---
modules/codec/avcodec/avcommon_compat.h | 3 +++
modules/demux/avformat/mux.c | 18 ++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
index 9d16b3dc47d9..561ad83f99f9 100644
--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -77,6 +77,9 @@
#ifndef FF_MAX_B_FRAMES
# define FF_MAX_B_FRAMES 16 // FIXME: remove this
#endif
+#ifndef FF_API_AVIO_WRITE_NONCONST // removed in ffmpeg 7
+# define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
+#endif
#endif /* HAVE_LIBAVCODEC_AVCODEC_H */
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 8bf8735885f5..033a87bdaaad 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -74,11 +74,20 @@ 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 FF_API_AVIO_WRITE_NONCONST
static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size );
+#endif
static int64_t IOSeek( void *opaque, int64_t offset, int whence );
#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
+# if FF_API_AVIO_WRITE_NONCONST
static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time);
+# else
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time);
+# endif
#endif
/*****************************************************************************
@@ -411,8 +420,13 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
}
#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
+# if FF_API_AVIO_WRITE_NONCONST
int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time)
+# else
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+ enum AVIODataMarkerType type, int64_t time)
+# endif
{
VLC_UNUSED(time);
@@ -512,7 +526,11 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
/*****************************************************************************
* I/O wrappers for libavformat
*****************************************************************************/
+#if FF_API_AVIO_WRITE_NONCONST
static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size )
+#endif
{
sout_mux_t *p_mux = opaque;
sout_mux_sys_t *p_sys = p_mux->p_sys;
--
GitLab

File diff suppressed because it is too large Load Diff

@ -0,0 +1,149 @@
From ba5dc03aecc1d96f81b76838f845ebde7348cf62 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Fri, 20 Dec 2024 20:24:36 +0100
Subject: [PATCH] avcodec: vaapi: Support VAAPI with latest FFmpeg
---
configure.ac | 20 +------------
modules/codec/Makefile.am | 2 +-
modules/codec/avcodec/avcommon_compat.h | 3 ++
modules/codec/avcodec/vaapi.c | 38 +++++++++++++++++++++++--
4 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/configure.ac b/configure.ac
index 00afb063c455..089339e10e0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2550,25 +2550,7 @@ AM_CONDITIONAL([HAVE_VAAPI], [test "${have_vaapi}" = "yes"])
AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
AM_CONDITIONAL([HAVE_VAAPI_WL], [test "${have_vaapi_wl}" = "yes"])
-
-have_avcodec_vaapi="no"
-AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
- VLC_SAVE_FLAGS
- CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
- CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
- AC_CHECK_HEADERS([libavcodec/vaapi.h], [
- AC_MSG_NOTICE([VA API acceleration activated])
- have_avcodec_vaapi="yes"
- ],[
- AS_IF([test -n "${enable_libva}"], [
- AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
- ], [
- AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
- ])
- ])
- VLC_RESTORE_FLAGS
-])
-AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
+AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"])
dnl
dnl dxva2 needs avcodec
diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 6d9465fdaef9..dd04391c1bf7 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -416,7 +416,7 @@ libvaapi_plugin_la_SOURCES = \
codec/avcodec/vaapi.c hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h
libvaapi_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
libvaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVCODEC_CFLAGS)
-libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS)
+libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS) $(AVCODEC_LIBS)
if HAVE_AVCODEC_VAAPI
if HAVE_VAAPI_DRM
codec_LTLIBRARIES += libvaapi_drm_plugin.la
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
index ac02c06d2339..8ab6910f3250 100644
--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -84,6 +84,9 @@
#ifndef FF_API_AVIO_WRITE_NONCONST // removed in ffmpeg 7
# define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
#endif
+#ifndef FF_API_STRUCT_VAAPI_CONTEXT
+# define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#endif /* HAVE_LIBAVCODEC_AVCODEC_H */
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index c83269e43f30..e203baaf9ee2 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -42,12 +42,25 @@
# include <va/va_drm.h>
#endif
#include <libavcodec/avcodec.h>
+#if FF_API_STRUCT_VAAPI_CONTEXT
#include <libavcodec/vaapi.h>
+#else
+#include <libavutil/hwcontext_vaapi.h>
+#endif
#include "avcodec.h"
#include "va.h"
#include "../../hw/vaapi/vlc_vaapi.h"
+#if !FF_API_STRUCT_VAAPI_CONTEXT
+struct vaapi_context
+{
+ VADisplay display;
+ VAConfigID config_id;
+ VAContextID context_id;
+};
+#endif
+
struct vlc_va_sys_t
{
struct vlc_vaapi_instance *va_inst;
@@ -145,8 +158,10 @@ static void Delete(vlc_va_t *va, void **hwctx)
(void) hwctx;
- vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
- vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
+ if (sys->hw_ctx.context_id != VA_INVALID_ID)
+ vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
+ if (sys->hw_ctx.config_id != VA_INVALID_ID)
+ vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
vlc_vaapi_ReleaseInstance(sys->va_inst);
free(sys);
}
@@ -196,6 +211,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
sys->hw_ctx.config_id = VA_INVALID_ID;
sys->hw_ctx.context_id = VA_INVALID_ID;
+#if FF_API_STRUCT_VAAPI_CONTEXT
sys->hw_ctx.config_id =
vlc_vaapi_CreateConfigChecked(o, sys->hw_ctx.display, i_profile,
VAEntrypointVLD, i_vlc_chroma);
@@ -211,6 +227,24 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
goto error;
ctx->hwaccel_context = &sys->hw_ctx;
+#else
+ AVBufferRef *hwdev_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
+ if (hwdev_ref == NULL)
+ goto error;
+
+ AVHWDeviceContext *hwdev_ctx = (void *) hwdev_ref->data;
+ AVVAAPIDeviceContext *vadev_ctx = hwdev_ctx->hwctx;
+ vadev_ctx->display = va_dpy;
+
+ if (av_hwdevice_ctx_init(hwdev_ref) < 0)
+ {
+ av_buffer_unref(&hwdev_ref);
+ goto error;
+ }
+
+ ctx->hw_device_ctx = hwdev_ref;
+#endif
+
va->sys = sys;
va->description = vaQueryVendorString(sys->hw_ctx.display);
va->get = Get;
--
GitLab

@ -1,18 +0,0 @@
avcodec_vaapi requires ffmpeg-4, but other vaapi modules can be built
diff --git a/configure.ac b/configure.ac
index 69beb77..c7f7142 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2454,9 +2454,9 @@ AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
have_avcodec_vaapi="yes"
],[
AS_IF([test -n "${enable_libva}"], [
- AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
+ AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing])
], [
- AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
+ AC_MSG_NOTICE([libva is present but libavcodec/vaapi.h is missing ])
])
])
VLC_RESTORE_FLAGS

@ -37,18 +37,22 @@ Source: macros.vlc
## upstream patches ## upstream patches
# opus_header: fix channel mapping family 1 parsing (rhbz#2307919) # opus_header: fix channel mapping family 1 parsing (rhbz#2307919)
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/5590.patch Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/5590.patch
# add support for ffmpeg 7.0 (without VAAPI)
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/5574.patch
# mux: avformat: fix avio callbacks signature with ffmpeg 6.1
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/6168.patch
# ffmpeg: backport more channel checks
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/6273.patch
# avcodec: vaapi: support VAAPI with latest FFmpeg
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/6606.patch
## upstreamable patches ## upstreamable patches
# add support for ffmpeg 7.0
Patch: https://code.videolan.org/videolan/vlc/-/merge_requests/5574.patch
## downstream patches ## downstream patches
# https://fedoraproject.org/wiki/Changes/CryptoPolicy # https://fedoraproject.org/wiki/Changes/CryptoPolicy
Patch: 0001-Use-SYSTEM-wide-ciphers-for-gnutls.patch Patch: 0001-Use-SYSTEM-wide-ciphers-for-gnutls.patch
# Fix building with fdk-aac-2.0; backport for 3.0 from flathub # Fix building with fdk-aac-2.0; backport for 3.0 from flathub
Patch: fdk-aac2.patch Patch: fdk-aac2.patch
# separate avcodec-vaapi conditional from other vaapi modules
Patch: vaapi-without-ffmepg4.patch
# port from intel-mediasdk to oneVPL # port from intel-mediasdk to oneVPL
Patch: oneVPL.patch Patch: oneVPL.patch
# fix appstreamcli validate to show in Software (rhbz#2258611) # fix appstreamcli validate to show in Software (rhbz#2258611)
@ -1148,6 +1152,8 @@ make check
%files plugin-ffmpeg %files plugin-ffmpeg
%{vlc_plugindir}/access/libavio_plugin.so %{vlc_plugindir}/access/libavio_plugin.so
%{vlc_plugindir}/codec/libavcodec_plugin.so %{vlc_plugindir}/codec/libavcodec_plugin.so
%{vlc_plugindir}/codec/libvaapi_drm_plugin.so
%{vlc_plugindir}/codec/libvaapi_plugin.so
%{vlc_plugindir}/demux/libavformat_plugin.so %{vlc_plugindir}/demux/libavformat_plugin.so
%{vlc_plugindir}/packetizer/libpacketizer_avparser_plugin.so %{vlc_plugindir}/packetizer/libpacketizer_avparser_plugin.so
%{vlc_plugindir}/stream_out/libstream_out_chromaprint_plugin.so %{vlc_plugindir}/stream_out/libstream_out_chromaprint_plugin.so

Loading…
Cancel
Save