From cc1791f39b2271ecc8adfcac16509770faec1b8c Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Thu, 19 Oct 2006 13:59:23 +0000 Subject: [PATCH] * Support 5.1 channels in Flac (untested with a 5.1 device) * Don't crash on Flac samples that have more channels than we can handle. --- modules/codec/flac.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/codec/flac.c b/modules/codec/flac.c index 0fe8f29dfa..b072443f9e 100644 --- a/modules/codec/flac.c +++ b/modules/codec/flac.c @@ -97,7 +97,7 @@ enum { STATE_SEND_DATA }; -static int pi_channels_maps[6] = +static int pi_channels_maps[7] = { 0, AOUT_CHAN_CENTER, @@ -106,7 +106,9 @@ static int pi_channels_maps[6] = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT, AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER - | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT + | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT, + AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER + | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE }; /***************************************************************************** @@ -285,7 +287,7 @@ static void CloseDecoder( vlc_object_t *p_this ) } /***************************************************************************** - * ProcessHeader: processe Flac header. + * ProcessHeader: process Flac header. *****************************************************************************/ static void ProcessHeader( decoder_t *p_dec ) { @@ -347,6 +349,12 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block ) if( !p_sys->b_stream_info ) ProcessHeader( p_dec ); + if( p_sys->stream_info.channels > 6 ) + { + msg_Err( p_dec, "This stream uses too many audio channels" ); + return NULL; + } + if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts ) { /* We've just started the stream, wait for the first PTS. */ -- 2.39.5