mirror of
https://github.com/termux/termux-packages.git
synced 2025-02-07 20:10:04 +00:00
96616601d0
Patches copied from f0ead348a0
61 lines
2.6 KiB
Diff
61 lines
2.6 KiB
Diff
Copied from https://salsa.debian.org/multimedia-team/vlc/-/commit/f0ead348a0d2739c6e097938e7fd20db39c6fc59
|
|
|
|
From: Ilkka Ollakka <ileoo@videolan.org>
|
|
Date: Tue, 4 Jul 2023 16:53:43 +0300
|
|
Subject: 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 6bd58f5..757f93b 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;
|