automatic version update by autodist [release 3.0.21-1mamba;Sun Nov 10 2024]
This commit is contained in:
parent
4186e1314d
commit
74987c7766
853
vlc-3.0.21-ffmpeg-7.1.patch
Normal file
853
vlc-3.0.21-ffmpeg-7.1.patch
Normal file
@ -0,0 +1,853 @@
|
||||
From a4645b577c71e58db09ee6888f270fb3d0cfd61e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
|
||||
Date: Sat, 5 May 2018 15:28:15 +0300
|
||||
Subject: [PATCH 01/11] avcodec: avoid signedness mismatch warning
|
||||
|
||||
Bitmask should be unsigned, but ffmpeg seems confused with itself.
|
||||
|
||||
(cherry picked from commit 8544233e7fde2965435e32a445494898440ecc30)
|
||||
---
|
||||
modules/codec/avcodec/audio.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||||
index 50a76c7a18e1..e5af0ca5f2f8 100644
|
||||
--- a/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 )
|
||||
uint32_t pi_order_src[i_order_max];
|
||||
|
||||
int i_channels_src = 0;
|
||||
- int64_t channel_layout =
|
||||
+ uint64_t channel_layout =
|
||||
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 );
|
||||
|
||||
if( channel_layout )
|
||||
{
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 2d51293c3f8e0bfa2b73112acf4dacb62b40ac57 Mon Sep 17 00:00:00 2001
|
||||
From: Ilkka Ollakka <ileoo@videolan.org>
|
||||
Date: Wed, 5 Jul 2023 12:51:34 +0300
|
||||
Subject: [PATCH 02/11] avcodec: use p_dec->fmt_out instead of context channels
|
||||
on audio channel-count
|
||||
|
||||
reduces the need of ifdefs when adding ch_layout support
|
||||
|
||||
(cherry picked from commit bddf5ba19111d1cc4463d9876c4bc4ba75f82d7f)
|
||||
---
|
||||
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 e5af0ca5f2f8..26166c084e51 100644
|
||||
--- a/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 )
|
||||
/* 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_t *p_dec, AVFrame *frame )
|
||||
{
|
||||
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 *p_dec, bool b_trust )
|
||||
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 1e5bd8a6f5fbf2c07071cefb1b24aceff058760d Mon Sep 17 00:00:00 2001
|
||||
From: Ilkka Ollakka <ileoo@videolan.org>
|
||||
Date: Wed, 5 Jul 2023 13:33:09 +0300
|
||||
Subject: [PATCH 03/11] avcodec: audio decoder to use ch_layout
|
||||
|
||||
(cherry picked from commit 496f0f2a659c1339d1e37330d446e9b6ce96e76b)
|
||||
---
|
||||
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 26166c084e51..ad8a40ab4ed6 100644
|
||||
--- a/modules/codec/avcodec/audio.c
|
||||
+++ b/modules/codec/avcodec/audio.c
|
||||
@@ -139,7 +139,11 @@ static int OpenAudioCodec( decoder_t *p_dec )
|
||||
}
|
||||
|
||||
ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
|
||||
+#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 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, block_t **pp_block )
|
||||
ret = avcodec_receive_frame( ctx, frame );
|
||||
if( ret == 0 )
|
||||
{
|
||||
+#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 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, bool b_trust )
|
||||
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
|
||||
|
||||
/* */
|
||||
+#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 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_dec, bool b_trust )
|
||||
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];
|
||||
|
||||
int i_channels_src = 0;
|
||||
- uint64_t channel_layout =
|
||||
+#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 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 :
|
||||
(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++ )
|
||||
+ && 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 *p_dec, bool b_trust )
|
||||
{
|
||||
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 1fbf3f028cffed87cb257a45668760370db267cf Mon Sep 17 00:00:00 2001
|
||||
From: Ilkka Ollakka <ileoo@videolan.org>
|
||||
Date: Tue, 4 Jul 2023 16:52:38 +0300
|
||||
Subject: [PATCH 04/11] 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
|
||||
|
||||
(cherry-picked from commit 29747a8abb98ba53a64aa6761983891eeed2e0e4)
|
||||
---
|
||||
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 4919ccf0e0e4..52848de06587 100644
|
||||
--- a/modules/codec/avcodec/encoder.c
|
||||
+++ b/modules/codec/avcodec/encoder.c
|
||||
@@ -790,7 +790,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 =
|
||||
@@ -897,7 +897,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:
|
||||
{
|
||||
@@ -922,7 +922,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];
|
||||
@@ -1028,7 +1028,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 ) )
|
||||
@@ -1278,7 +1278,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
|
||||
{
|
||||
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;
|
||||
@@ -1301,7 +1301,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
|
||||
// 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);
|
||||
|
||||
@@ -1319,7 +1319,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
|
||||
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 )
|
||||
@@ -1349,7 +1349,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||||
|
||||
//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
|
||||
@@ -1418,12 +1418,12 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||||
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
|
||||
@@ -1431,7 +1431,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||||
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,
|
||||
@@ -1457,7 +1457,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||||
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 a1a3edd4eacc813e5b4c3a6f353b92f4069fbc1a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
|
||||
Date: Tue, 23 Apr 2024 13:13:30 +0700
|
||||
Subject: [PATCH 05/11] codec: avcodec: map AYUV as RAWVIDEO with ffmpeg 6.0
|
||||
|
||||
(cherry picked from commit 955ef939467a628eb8da08e0d5eaefc9a3484cba)
|
||||
---
|
||||
modules/codec/avcodec/fourcc.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
|
||||
index 33c6cae09abc..97f3188211d3 100644
|
||||
--- a/modules/codec/avcodec/fourcc.c
|
||||
+++ b/modules/codec/avcodec/fourcc.c
|
||||
@@ -182,8 +182,12 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
|
||||
/* 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_MICRO >= 100
|
||||
+# if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 59, 42, 102 )
|
||||
+ { VLC_CODEC_VUYA, AV_CODEC_ID_RAWVIDEO },
|
||||
+# elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 50, 100 )
|
||||
{ VLC_CODEC_VUYA, AV_CODEC_ID_AYUV },
|
||||
+# endif
|
||||
#endif
|
||||
/* AV_CODEC_ID_DPX */
|
||||
{ VLC_CODEC_MAD, AV_CODEC_ID_MAD },
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From da6f67588dacf60c7563fd720cc75e1912215a45 Mon Sep 17 00:00:00 2001
|
||||
From: Francois Cartegnie <fcvlcdev@free.fr>
|
||||
Date: Thu, 13 Jun 2024 12:21:58 +0700
|
||||
Subject: [PATCH 06/11] avcodec: encoder: fix channel_layout conditionals
|
||||
|
||||
---
|
||||
modules/codec/avcodec/encoder.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||||
index 52848de06587..6bd58f5071d2 100644
|
||||
--- a/modules/codec/avcodec/encoder.c
|
||||
+++ b/modules/codec/avcodec/encoder.c
|
||||
@@ -43,12 +43,13 @@
|
||||
#include <vlc_cpu.h>
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
-#include <libavutil/channel_layout.h>
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "avcommon.h"
|
||||
|
||||
-#if LIBAVUTIL_VERSION_CHECK( 52,2,6,0,0 )
|
||||
+#define API_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||||
+
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
# include <libavutil/channel_layout.h>
|
||||
#endif
|
||||
|
||||
@@ -157,6 +158,7 @@ struct encoder_sys_t
|
||||
|
||||
|
||||
/* Taken from audio.c*/
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
static const uint64_t pi_channels_map[][2] =
|
||||
{
|
||||
{ AV_CH_FRONT_LEFT, AOUT_CHAN_LEFT },
|
||||
@@ -193,6 +195,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",
|
||||
@@ -746,7 +749,7 @@ 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)
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
p_context->channel_layout = channel_mask[p_context->channels][1];
|
||||
|
||||
/* Setup Channel ordering for multichannel audio
|
||||
@@ -925,7 +928,9 @@ errmsg:
|
||||
if( p_enc->fmt_out.audio.i_channels > 2 )
|
||||
{
|
||||
p_context->channels = 2;
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
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 =
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 8e2d209d0897138ba13372ab49c0ee7cef7c316c Mon Sep 17 00:00:00 2001
|
||||
From: Francois Cartegnie <fcvlcdev@free.fr>
|
||||
Date: Sat, 17 Aug 2024 11:22:33 +0700
|
||||
Subject: [PATCH 07/11] codec: avcodec: fix audio channel_layout conditionals
|
||||
|
||||
---
|
||||
modules/codec/avcodec/audio.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||||
index ad8a40ab4ed6..c74757c76ae5 100644
|
||||
--- a/modules/codec/avcodec/audio.c
|
||||
+++ b/modules/codec/avcodec/audio.c
|
||||
@@ -41,8 +41,11 @@
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/mem.h>
|
||||
|
||||
-#include <libavutil/channel_layout.h>
|
||||
+#define API_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||||
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
+# include <libavutil/channel_layout.h>
|
||||
+#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* decoder_sys_t : decoder descriptor
|
||||
@@ -598,7 +601,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool 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
|
||||
+#elif API_CHANNEL_LAYOUT
|
||||
if( p_sys->i_previous_channels == p_sys->p_context->channels &&
|
||||
p_sys->i_previous_layout == p_sys->p_context->channel_layout )
|
||||
return;
|
||||
@@ -612,15 +615,19 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||||
const unsigned i_order_max = sizeof(pi_channels_map)/sizeof(*pi_channels_map);
|
||||
uint32_t pi_order_src[i_order_max];
|
||||
|
||||
- int i_channels_src = 0;
|
||||
+ int i_channels_src = 0, channel_count;
|
||||
+ uint64_t channel_layout_mask;
|
||||
#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 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 =
|
||||
+ channel_layout_mask = p_sys->p_context->ch_layout.u.mask;
|
||||
+ channel_count = p_sys->p_context->ch_layout.nb_channels;
|
||||
+#elif API_CHANNEL_LAYOUT
|
||||
+ channel_layout_mask =
|
||||
p_sys->p_context->channel_layout ? p_sys->p_context->channel_layout :
|
||||
(uint64_t)av_get_default_channel_layout( p_sys->p_context->channels );
|
||||
- int channel_count = p_sys->p_context->channels;
|
||||
+ channel_count = p_sys->p_context->channels;
|
||||
+#else
|
||||
+ channel_layout_mask = NULL;
|
||||
+ channel_count = p_sys->p_context->channels;
|
||||
#endif
|
||||
|
||||
if( channel_layout_mask )
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From cc5306f9b4eaac1b684747d65c04901008423f61 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
|
||||
Date: Tue, 23 Apr 2024 13:14:53 +0700
|
||||
Subject: [PATCH 08/11] demux/mux: avformat: use ch_layout from ffmpeg 5.1
|
||||
|
||||
merger pick from commit a55ec32ab3760d9edb6f05481cd3a981aa42878d
|
||||
and fixup 195f0c98599b55950c49a62f98d9d3495be310df
|
||||
---
|
||||
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 3b355bb3faec..830dc0157e2b 100644
|
||||
--- a/modules/demux/avformat/demux.c
|
||||
+++ b/modules/demux/avformat/demux.c
|
||||
@@ -401,7 +401,11 @@ int avformat_OpenDemux( vlc_object_t *p_this )
|
||||
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 LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 59, 24, 100 ) && LIBAVCODEC_VERSION_MICRO >= 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 c708276954ce..8bf8735885f5 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, sout_input_t *p_input )
|
||||
{
|
||||
case AUDIO_ES:
|
||||
codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 59, 24, 100 ) && LIBAVCODEC_VERSION_MICRO >= 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 ad413ab9c0d8522cb79f7df3640249998902b6ca Mon Sep 17 00:00:00 2001
|
||||
From: Ilkka Ollakka <ileoo@videolan.org>
|
||||
Date: Tue, 4 Jul 2023 16:53:43 +0300
|
||||
Subject: [PATCH 09/11] avcodec: add handling of new ch_layout in audio encoder
|
||||
|
||||
conditioned to avcodec version where is it added
|
||||
|
||||
(cherry picked from commit c4302ca59dd79efd7208a45a3fcdc44388fd03a8)
|
||||
---
|
||||
modules/codec/avcodec/encoder.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||||
index 6bd58f5071d2..757f93b46845 100644
|
||||
--- a/modules/codec/avcodec/encoder.c
|
||||
+++ b/modules/codec/avcodec/encoder.c
|
||||
@@ -927,11 +927,14 @@ errmsg:
|
||||
|
||||
if( p_enc->fmt_out.audio.i_channels > 2 )
|
||||
{
|
||||
+#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||||
+ av_channel_layout_default( &p_context->ch_layout, 2 );
|
||||
+#else
|
||||
p_context->channels = 2;
|
||||
-#if API_CHANNEL_LAYOUT
|
||||
+# if API_CHANNEL_LAYOUT
|
||||
p_context->channel_layout = channel_mask[p_context->channels][1];
|
||||
+# endif
|
||||
#endif
|
||||
-
|
||||
/* Change fmt_in in order to ask for a channels conversion */
|
||||
p_enc->fmt_in.audio.i_channels =
|
||||
p_enc->fmt_out.audio.i_channels = 2;
|
||||
@@ -1288,8 +1291,12 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
|
||||
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, 999, 999, 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;
|
||||
@@ -1419,8 +1426,12 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||||
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, 999, 999, 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 416eeca68bfb67b244827a45a4392bddb8cc0ce8 Mon Sep 17 00:00:00 2001
|
||||
From: Ilkka Ollakka <ileoo@videolan.org>
|
||||
Date: Tue, 4 Jul 2023 16:55:28 +0300
|
||||
Subject: [PATCH 10/11] 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
|
||||
|
||||
(cherry picked from commit b73dc8841d999c6be9de718cd2cd3aeb13279792)
|
||||
---
|
||||
modules/codec/avcodec/encoder.c | 53 ++++++++++++++-------------------
|
||||
1 file changed, 22 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||||
index 757f93b46845..ae746c99fc89 100644
|
||||
--- a/modules/codec/avcodec/encoder.c
|
||||
+++ b/modules/codec/avcodec/encoder.c
|
||||
@@ -183,6 +183,7 @@ static const uint64_t pi_channels_map[][2] =
|
||||
{ AV_CH_STEREO_RIGHT, 0 },
|
||||
};
|
||||
|
||||
+# if !LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||||
static const uint32_t channel_mask[][2] = {
|
||||
{0,0},
|
||||
{AOUT_CHAN_CENTER, AV_CH_LAYOUT_MONO},
|
||||
@@ -195,6 +196,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
|
||||
#endif
|
||||
|
||||
static const char *const ppsz_enc_options[] = {
|
||||
@@ -748,49 +750,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;
|
||||
-#if API_CHANNEL_LAYOUT
|
||||
- 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] = { };
|
||||
+#if API_CHANNEL_LAYOUT
|
||||
+ uint32_t pi_order_dst[AOUT_CHAN_MAX] = { 0 };
|
||||
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, 999, 999, 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 )
|
||||
@@ -799,6 +788,8 @@ 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 );
|
||||
+#else
|
||||
+ p_context->channels = p_enc->fmt_out.audio.i_channels;
|
||||
#endif
|
||||
|
||||
if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A )
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From c493ec18c5f3d10ba5a967e81b80d03e79f2d8b7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
|
||||
Date: Mon, 12 Aug 2024 19:32:42 +0700
|
||||
Subject: [PATCH 11/11] codec: avcodec: bypass removed define for Intel
|
||||
workarounds
|
||||
|
||||
adapted from cherry picked commit 1280728ad305f00ceba3491ce11bf66107017a6c
|
||||
---
|
||||
modules/codec/avcodec/d3d11va.c | 4 ++++
|
||||
modules/codec/avcodec/dxva2.c | 4 ++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
|
||||
index e1560a9312cc..5260628364f0 100644
|
||||
--- a/modules/codec/avcodec/d3d11va.c
|
||||
+++ b/modules/codec/avcodec/d3d11va.c
|
||||
@@ -55,6 +55,10 @@
|
||||
#define D3D_DecoderSurface ID3D11VideoDecoderOutputView
|
||||
#include "directx_va.h"
|
||||
|
||||
+#ifndef FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO
|
||||
+# define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 // moved to libavcodec/dxva2_internal.h :/
|
||||
+#endif
|
||||
+
|
||||
static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat,
|
||||
const es_format_t *, picture_sys_t *p_sys);
|
||||
static void Close(vlc_va_t *, void **);
|
||||
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
|
||||
index 2e6809a05410..037ad7d44887 100644
|
||||
--- a/modules/codec/avcodec/dxva2.c
|
||||
+++ b/modules/codec/avcodec/dxva2.c
|
||||
@@ -43,6 +43,10 @@
|
||||
#define D3D_DecoderSurface IDirect3DSurface9
|
||||
#include "directx_va.h"
|
||||
|
||||
+#ifndef FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO
|
||||
+# define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 // moved to libavcodec/dxva2_internal.h :/
|
||||
+#endif
|
||||
+
|
||||
static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat,
|
||||
const es_format_t *, picture_sys_t *p_sys);
|
||||
static void Close(vlc_va_t *, void **);
|
||||
--
|
||||
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;
|
||||
|
18
vlc-3.0.21-vaapi-without-ffmpeg4.patch
Normal file
18
vlc-3.0.21-vaapi-without-ffmpeg4.patch
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
30
vlc-3.0.21-x265-4.0.patch
Normal file
30
vlc-3.0.21-x265-4.0.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/modules/codec/x265.c b/modules/codec/x265.c
|
||||
index 4c2b585594b2dfcbbef0f9a3e5b47495c2a43e7b..5c5f35e214df28ff80379757688c451e474fccb9 100644
|
||||
--- a/modules/codec/x265.c
|
||||
+++ b/modules/codec/x265.c
|
||||
@@ -71,6 +71,11 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
|
||||
x265_picture pic;
|
||||
|
||||
x265_picture_init(&p_sys->param, &pic);
|
||||
+#ifdef MAX_SCALABLE_LAYERS
|
||||
+ /* Handle API changes for scalable layers output in x265 4.0 */
|
||||
+ x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL};
|
||||
+ pics[0] = &pic;
|
||||
+#endif
|
||||
|
||||
if (likely(p_pict)) {
|
||||
pic.pts = p_pict->date;
|
||||
@@ -89,8 +94,13 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
|
||||
|
||||
x265_nal *nal;
|
||||
uint32_t i_nal = 0;
|
||||
+#ifdef MAX_SCALABLE_LAYERS
|
||||
+ x265_encoder_encode(p_sys->h, &nal, &i_nal,
|
||||
+ likely(p_pict) ? &pic : NULL, pics);
|
||||
+#else
|
||||
x265_encoder_encode(p_sys->h, &nal, &i_nal,
|
||||
likely(p_pict) ? &pic : NULL, &pic);
|
||||
+#endif
|
||||
|
||||
if (!i_nal)
|
||||
return NULL;
|
27
vlc.spec
27
vlc.spec
@ -3,8 +3,8 @@
|
||||
%define with_pulseaudio 1
|
||||
|
||||
Name: vlc
|
||||
Version: 3.0.20
|
||||
Release: 2mamba
|
||||
Version: 3.0.21
|
||||
Release: 1mamba
|
||||
Summary: The VideoLAN client
|
||||
Group: Graphical Desktop/Applications/Multimedia
|
||||
Vendor: openmamba
|
||||
@ -12,8 +12,11 @@ Distribution: openmamba
|
||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
URL: https://www.videolan.org/
|
||||
Source: http://download.videolan.org/pub/videolan/vlc/%{version}/vlc-%{version}.tar.xz
|
||||
Patch6: vlc-2.0.4-fix-undefined-symbol.patch
|
||||
Patch9: vlc-2.2.0-vorbisidec.patch
|
||||
Patch0: vlc-2.0.4-fix-undefined-symbol.patch
|
||||
Patch1: vlc-2.2.0-vorbisidec.patch
|
||||
Patch2: vlc-3.0.21-ffmpeg-7.1.patch
|
||||
Patch3: vlc-3.0.21-vaapi-without-ffmpeg4.patch
|
||||
Patch4: vlc-3.0.21-x265-4.0.patch
|
||||
License: GPL
|
||||
## AUTOBUILDREQ-BEGIN
|
||||
BuildRequires: glibc-devel
|
||||
@ -148,7 +151,7 @@ BuildRequires: libz-devel
|
||||
BuildRequires: libzvbi-devel
|
||||
BuildRequires: qt5-qtbase-devel
|
||||
## AUTOBUILDREQ-END
|
||||
BuildRequires: libx265-devel >= 3.6-1mamba
|
||||
BuildRequires: libx265-devel >= 4.0
|
||||
BuildRequires: libfreerdp-devel
|
||||
BuildRequires: liblive-devel
|
||||
BuildRequires: libprojectM-devel >= 3.1.7
|
||||
@ -198,14 +201,19 @@ Install this package if you need to build Videolan Client plugins or intend to l
|
||||
%setup -q -n %{name}-%{version}
|
||||
#-D -T
|
||||
#:<< _EOF
|
||||
%patch 6 -p1
|
||||
%patch 9 -p1
|
||||
%patch 0 -p1
|
||||
%patch 1 -p1
|
||||
%patch 2 -p1 -b .ffmpeg-7
|
||||
%patch 3 -p1 -b .vaapi-without-ffmpeg4
|
||||
%patch 4 -p1 -b .x265-4.0
|
||||
|
||||
# FIXME: bootstrap: build with ffmpeg2 is correct, but libs are relinked with ffmpeg at install
|
||||
./bootstrap
|
||||
|
||||
%build
|
||||
#:<< ___EOF
|
||||
#export PKG_CONFIG_PATH="%{_libdir}/ffmpeg4/pkgconfig"
|
||||
|
||||
%configure \
|
||||
BUILDCC=gcc \
|
||||
LIBS_access_smb="-L%{_libdir}/samba" \
|
||||
@ -259,7 +267,7 @@ Install this package if you need to build Videolan Client plugins or intend to l
|
||||
--with-kde-solid=%{_datadir}/apps/solid/actions \
|
||||
--enable-tremor \
|
||||
--disable-libplacebo \
|
||||
LUAC=/usr/bin/luac-5.2 LUA_LIBS="`pkg-config --libs lua5.2`"
|
||||
LUAC=/usr/bin/luac LUA_LIBS="`pkg-config --libs lua`" LUA_CFLAGS="`pkg-config --cflags lua`"
|
||||
|
||||
%make
|
||||
|
||||
@ -376,6 +384,9 @@ fi
|
||||
%doc ChangeLog README THANKS
|
||||
|
||||
%changelog
|
||||
* Sun Nov 10 2024 Automatic Build System <autodist@openmamba.org> 3.0.21-1mamba
|
||||
- automatic version update by autodist
|
||||
|
||||
* Sat May 04 2024 Automatic Build System <autodist@mambasoft.it> 3.0.20-2mamba
|
||||
- rebuilt by autoport with build requirements: libx265-devel>=3.6-1mamba
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user