* araw.c: Pseudo audio decoder; for raw pcm data
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: araw.c,v 1.1 2002/10/14 21:59:44 fenrir Exp $
+ * $Id: araw.c,v 1.2 2002/10/20 17:44:17 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
set_callbacks( OpenDecoder, NULL );
vlc_module_end();
+
+static int i_channels_maps[6] =
+{
+ 0,
+ AOUT_CHAN_MONO, AOUT_CHAN_STEREO,
+ AOUT_CHAN_3F, AOUT_CHAN_2F2R,
+ AOUT_CHAN_3F2R
+};
+
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************
return( i_size );
}
+
/*****************************************************************************
* InitThread: initialize data before entering main loop
*****************************************************************************/
+
static int InitThread( adec_thread_t * p_adec )
{
return( -1 );
}
p_adec->output_format.i_rate = p_adec->format.i_samplespersec;
- p_adec->output_format.i_channels = p_adec->format.i_channels;
+ if( p_adec->output_format.i_channels <= 0 ||
+ p_adec->output_format.i_channels > 5 )
+ {
+ msg_Err( p_adec->p_fifo, "bad channels count(1-5)" );
+ return( -1 );
+ }
+
+ p_adec->output_format.i_channels =
+ i_channels_maps[p_adec->format.i_channels];
p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL;
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: decoder.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: decoder.c,v 1.6 2002/10/20 17:44:17 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
return;
}
if( ( faad_frame.channels <= 0 )||
- ( faad_frame.channels > AAC_MAXCHANNELS) )
+ ( faad_frame.channels > AAC_MAXCHANNELS) ||
+ ( faad_frame.channels > 5 ) )
{
msg_Warn( p_adec->p_fifo,
"invalid channels count(%d)", faad_frame.channels );
}
/* **** Create a new audio output **** */
- p_adec->output_format.i_channels = faad_frame.channels;
+ p_adec->output_format.i_channels =
+ i_channels_maps[faad_frame.channels];
aout_DateInit( &p_adec->date, p_adec->output_format.i_rate );
p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo,
&p_adec->p_aout,
*
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: decoder.h,v 1.2 2002/08/23 14:05:22 sam Exp $
+ * $Id: decoder.h,v 1.3 2002/10/20 17:44:17 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
} adec_thread_t;
+static int i_channels_maps[6] =
+{
+ 0,
+ AOUT_CHAN_MONO, AOUT_CHAN_STEREO,
+ AOUT_CHAN_3F, AOUT_CHAN_2F2R,
+ AOUT_CHAN_3F2R
+};