Commit 5f3c2d34 authored by Laurent Aimar's avatar Laurent Aimar

* all: fix for correct "i_channels" use.

parent cada6d07
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -84,6 +84,15 @@ vlc_module_begin();
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
*****************************************************************************
......@@ -223,9 +232,11 @@ static int PESGetSize( pes_packet_t *p_pes )
return( i_size );
}
/*****************************************************************************
* InitThread: initialize data before entering main loop
*****************************************************************************/
static int InitThread( adec_thread_t * p_adec )
{
......@@ -271,7 +282,15 @@ 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;
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -420,7 +420,8 @@ static void DecodeThread( adec_thread_t *p_adec )
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 );
......@@ -453,7 +454,8 @@ static void DecodeThread( adec_thread_t *p_adec )
}
/* **** 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,
......
......@@ -3,7 +3,7 @@
*
*****************************************************************************
* 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>
*
......@@ -72,5 +72,12 @@ typedef struct adec_thread_s
} 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
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment