mirror of
https://github.com/termux/termux-packages.git
synced 2025-02-07 20:10:04 +00:00
96616601d0
Patches copied from f0ead348a0
64 lines
2.9 KiB
Diff
64 lines
2.9 KiB
Diff
Copied from https://salsa.debian.org/multimedia-team/vlc/-/commit/f0ead348a0d2739c6e097938e7fd20db39c6fc59
|
|
|
|
From: Ilkka Ollakka <ileoo@videolan.org>
|
|
Date: Wed, 5 Jul 2023 12:51:34 +0300
|
|
Subject: 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 e5af0ca..26166c0 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 */
|