[vlc-devel] [PATCH 11/12] codec: araw: supports output with channels > AOUT_CHAN_MAX
Thomas Guillem
thomas at gllm.fr
Fri Jul 7 15:39:58 CEST 2017
If the channel number is higher than AOUT_CHAN_MAX, don't set the physical
mask, and just set the number of channels. A filter will take of dropping extra
channels or doing an ambisonics conversion.
---
modules/codec/araw.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index e6206b4bc1..2c08413fee 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -247,8 +247,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_dec->fmt_in.audio.i_channels == 0 ||
- p_dec->fmt_in.audio.i_channels > AOUT_CHAN_MAX )
+ if( p_dec->fmt_in.audio.i_channels == 0 )
{
msg_Err( p_dec, "bad channels count (1-%i): %i",
AOUT_CHAN_MAX, p_dec->fmt_in.audio.i_channels );
@@ -275,18 +274,28 @@ static int DecoderOpen( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = format;
p_dec->fmt_out.audio.i_format = format;
p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
- if( p_dec->fmt_in.audio.i_physical_channels )
- p_dec->fmt_out.audio.i_physical_channels =
- p_dec->fmt_in.audio.i_physical_channels;
+ if( p_dec->fmt_in.audio.i_channels <= AOUT_CHAN_MAX )
+ {
+ if( p_dec->fmt_in.audio.i_physical_channels )
+ p_dec->fmt_out.audio.i_physical_channels =
+ p_dec->fmt_in.audio.i_physical_channels;
+ else
+ p_dec->fmt_out.audio.i_physical_channels =
+ pi_channels_maps[p_dec->fmt_in.audio.i_channels];
+ if( p_dec->fmt_in.audio.i_original_channels )
+ p_dec->fmt_out.audio.i_original_channels =
+ p_dec->fmt_in.audio.i_original_channels;
+ else
+ p_dec->fmt_out.audio.i_original_channels =
+ p_dec->fmt_out.audio.i_physical_channels;
+ }
else
+ {
+ /* Unknown channel map, let the aout/filters decide what to do */
+ p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
p_dec->fmt_out.audio.i_physical_channels =
- pi_channels_maps[p_dec->fmt_in.audio.i_channels];
- if( p_dec->fmt_in.audio.i_original_channels )
- p_dec->fmt_out.audio.i_original_channels =
- p_dec->fmt_in.audio.i_original_channels;
- else
- p_dec->fmt_out.audio.i_original_channels =
- p_dec->fmt_out.audio.i_physical_channels;
+ p_dec->fmt_out.audio.i_original_channels = 0;
+ }
aout_FormatPrepare( &p_dec->fmt_out.audio );
p_sys->decode = decode;
--
2.11.0
More information about the vlc-devel
mailing list