]> git.sesse.net Git - vlc/commitdiff
* Support 5.1 channels in Flac (untested with a 5.1 device)
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 19 Oct 2006 13:59:23 +0000 (13:59 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 19 Oct 2006 13:59:23 +0000 (13:59 +0000)
* Don't crash on Flac samples that have more channels than we can handle.

modules/codec/flac.c

index 0fe8f29dfa51504180228095e48b382a504e95c0..b072443f9eee5404095dcd567c4dfc0f9acfea0f 100644 (file)
@@ -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. */