Commit d86bf0f4 authored by Christophe Massiot's avatar Christophe Massiot

* Fixed filters which couldn't work with more than 2 channels ;

* Fixed detection of VCD support under OS X.2.
parent 235dfe29
...@@ -985,7 +985,7 @@ then ...@@ -985,7 +985,7 @@ then
if test "x${SYS}" = "xdarwin" if test "x${SYS}" = "xdarwin"
then then
# No need to add vcd to PLUGINS, Darwin is already based on FreeBSD PLUGINS="${PLUGINS} vcd"
LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation" LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
fi fi
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* fixed32float32.c : converter from fixed32 to float32 bits integer * fixed32float32.c : converter from fixed32 to float32 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: fixed32tofloat32.c,v 1.9 2002/09/30 21:32:32 massiot Exp $ * $Id: fixed32tofloat32.c,v 1.10 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer; vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer;
float * p_out = (float *)p_out_buf->p_buffer; float * p_out = (float *)p_out_buf->p_buffer;
for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
{ {
*p_out++ = (float)*p_in++ / (float)FIXED32_ONE; *p_out++ = (float)*p_in++ / (float)FIXED32_ONE;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* fixed32tos16.c : converter from fixed32 to signed 16 bits integer * fixed32tos16.c : converter from fixed32 to signed 16 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: fixed32tos16.c,v 1.6 2002/09/30 21:32:32 massiot Exp $ * $Id: fixed32tos16.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -199,7 +199,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -199,7 +199,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
s16 sample; s16 sample;
// static struct audio_dither dither; // static struct audio_dither dither;
for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
{ {
/* Accurate scaling */ /* Accurate scaling */
// p_out = mpg321_s24_to_s16_pcm(16, *p_in++, &dither); // p_out = mpg321_s24_to_s16_pcm(16, *p_in++, &dither);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32tos16.c : converter from float32 to signed 16 bits integer * float32tos16.c : converter from float32 to signed 16 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32tos16.c,v 1.10 2002/09/30 21:32:32 massiot Exp $ * $Id: float32tos16.c,v 1.11 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -83,7 +83,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -83,7 +83,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float *)p_in_buf->p_buffer; float * p_in = (float *)p_in_buf->p_buffer;
s16 * p_out = (s16 *)p_out_buf->p_buffer; s16 * p_out = (s16 *)p_out_buf->p_buffer;
for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ); i-- ; )
{ {
#if 0 #if 0
/* Slow version. */ /* Slow version. */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32tos8.c : converter from float32 to signed 8 bits integer * float32tos8.c : converter from float32 to signed 8 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32tos8.c,v 1.5 2002/09/30 21:32:32 massiot Exp $ * $Id: float32tos8.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Xavier Maillard <zedek@fxgsproject.org> * Authors: Xavier Maillard <zedek@fxgsproject.org>
* *
...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float *)p_in_buf->p_buffer; float * p_in = (float *)p_in_buf->p_buffer;
s8 * p_out = (s8 *)p_out_buf->p_buffer; s8 * p_out = (s8 *)p_out_buf->p_buffer;
for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ); i-- ; )
{ {
if ( *p_in >= 1.0 ) *p_out = 127; if ( *p_in >= 1.0 ) *p_out = 127;
else if ( *p_in < -1.0 ) *p_out = -128; else if ( *p_in < -1.0 ) *p_out = -128;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32tou16.c : converter from float32 to unsigned 16 bits integer * float32tou16.c : converter from float32 to unsigned 16 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32tou16.c,v 1.5 2002/09/30 21:32:32 massiot Exp $ * $Id: float32tou16.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Xavier Maillard <zedek@fxgsproject.org> * Authors: Xavier Maillard <zedek@fxgsproject.org>
* *
...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float *)p_in_buf->p_buffer; float * p_in = (float *)p_in_buf->p_buffer;
u16 * p_out = (u16 *)p_out_buf->p_buffer; u16 * p_out = (u16 *)p_out_buf->p_buffer;
for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ); i-- ; )
{ {
if ( *p_in >= 1.0 ) *p_out = 65535; if ( *p_in >= 1.0 ) *p_out = 65535;
else if ( *p_in < -1.0 ) *p_out = 0; else if ( *p_in < -1.0 ) *p_out = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32tou8.c : converter from float32 to unsigned 8 bits integer * float32tou8.c : converter from float32 to unsigned 8 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32tou8.c,v 1.5 2002/09/30 21:32:32 massiot Exp $ * $Id: float32tou8.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Xavier Maillard <zedek@fxgsproject.org> * Authors: Xavier Maillard <zedek@fxgsproject.org>
* *
...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float *)p_in_buf->p_buffer; float * p_in = (float *)p_in_buf->p_buffer;
u8 * p_out = (u8 *)p_out_buf->p_buffer; u8 * p_out = (u8 *)p_out_buf->p_buffer;
for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ ) for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ); i-- ; )
{ {
if ( *p_in >= 1.0 ) *p_out = 255; if ( *p_in >= 1.0 ) *p_out = 255;
else if ( *p_in < -1.0 ) *p_out = 0; else if ( *p_in < -1.0 ) *p_out = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* s16tofloat32.c : converter from signed 16 bits integer to float32 * s16tofloat32.c : converter from signed 16 bits integer to float32
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32.c,v 1.3 2002/09/30 21:32:32 massiot Exp $ * $Id: s16tofloat32.c,v 1.4 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -81,7 +81,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -81,7 +81,7 @@ static int Create( vlc_object_t *p_this )
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{ {
int i = p_in_buf->i_nb_samples * p_filter->input.i_channels; int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
/* We start from the end because b_in_place is true */ /* We start from the end because b_in_place is true */
s16 * p_in = (s16 *)p_in_buf->p_buffer + i - 1; s16 * p_in = (s16 *)p_in_buf->p_buffer + i - 1;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* with endianness change * with endianness change
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32swab.c,v 1.6 2002/09/30 21:32:32 massiot Exp $ * $Id: s16tofloat32swab.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org> * Henri Fallon <henri@videolan.org>
...@@ -95,7 +95,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -95,7 +95,7 @@ static int Create( vlc_object_t *p_this )
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{ {
int i = p_in_buf->i_nb_samples * p_filter->input.i_channels; int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
/* We start from the end because b_in_place is true */ /* We start from the end because b_in_place is true */
s16 * p_in; s16 * p_in;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* trivial.c : trivial resampler (skips samples or pads with zeroes) * trivial.c : trivial resampler (skips samples or pads with zeroes)
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.6 2002/09/30 21:32:32 massiot Exp $ * $Id: trivial.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -80,7 +80,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -80,7 +80,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
int i_in_nb = p_in_buf->i_nb_samples; int i_in_nb = p_in_buf->i_nb_samples;
int i_out_nb = i_in_nb * p_filter->output.i_rate int i_out_nb = i_in_nb * p_filter->output.i_rate
/ p_filter->input.i_rate; / p_filter->input.i_rate;
int i_frame_bytes = p_filter->input.i_channels * sizeof(s32); int i_frame_bytes = aout_FormatNbChannels( &p_filter->input ) * sizeof(s32);
if ( p_out_buf != p_in_buf ) if ( p_out_buf != p_in_buf )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ugly.c : ugly resampler (changes pitch) * ugly.c : ugly resampler (changes pitch)
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: ugly.c,v 1.3 2002/09/30 21:32:32 massiot Exp $ * $Id: ugly.c,v 1.4 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -80,25 +80,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -80,25 +80,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
s32* p_in = (s32*)p_in_buf->p_buffer; s32* p_in = (s32*)p_in_buf->p_buffer;
s32* p_out = (s32*)p_out_buf->p_buffer; s32* p_out = (s32*)p_out_buf->p_buffer;
int i_nb_channels = aout_FormatNbChannels( &p_filter->input );
int i_in_nb = p_in_buf->i_nb_samples; int i_in_nb = p_in_buf->i_nb_samples;
int i_out_nb = i_in_nb * p_filter->output.i_rate int i_out_nb = i_in_nb * p_filter->output.i_rate
/ p_filter->input.i_rate; / p_filter->input.i_rate;
int i_frame_bytes = p_filter->input.i_channels * sizeof(s32); int i_frame_bytes = i_nb_channels * sizeof(s32);
int i_out, i_chan, i_remainder = 0; int i_out, i_chan, i_remainder = 0;
for( i_out = i_out_nb ; i_out-- ; ) for( i_out = i_out_nb ; i_out-- ; )
{ {
for( i_chan = p_filter->input.i_channels ; i_chan ; ) for( i_chan = i_nb_channels ; i_chan ; )
{ {
i_chan--; i_chan--;
p_out[i_chan] = p_in[i_chan]; p_out[i_chan] = p_in[i_chan];
} }
p_out += p_filter->input.i_channels; p_out += i_nb_channels;
i_remainder += p_filter->input.i_rate; i_remainder += p_filter->input.i_rate;
while( i_remainder >= p_filter->output.i_rate ) while( i_remainder >= p_filter->output.i_rate )
{ {
p_in += p_filter->input.i_channels; p_in += i_nb_channels;
i_remainder -= p_filter->output.i_rate; i_remainder -= p_filter->output.i_rate;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32.c : precise float32 audio mixer implementation * float32.c : precise float32 audio mixer implementation
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32.c,v 1.5 2002/09/30 21:32:32 massiot Exp $ * $Id: float32.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -112,11 +112,11 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -112,11 +112,11 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
int i_nb_inputs = p_aout->i_nb_inputs; int i_nb_inputs = p_aout->i_nb_inputs;
float f_multiplier = p_aout->mixer.f_multiplier; float f_multiplier = p_aout->mixer.f_multiplier;
int i_input; int i_input;
int i_nb_channels = aout_FormatNbChannels( &p_aout->mixer.mixer );
for ( i_input = 0; i_input < i_nb_inputs; i_input++ ) for ( i_input = 0; i_input < i_nb_inputs; i_input++ )
{ {
int i_nb_words = p_buffer->i_nb_samples int i_nb_words = p_buffer->i_nb_samples * i_nb_channels;
* p_aout->mixer.mixer.i_channels;
aout_input_t * p_input = p_aout->pp_inputs[i_input]; aout_input_t * p_input = p_aout->pp_inputs[i_input];
float * p_out = (float *)p_buffer->p_buffer; float * p_out = (float *)p_buffer->p_buffer;
float * p_in = (float *)p_input->p_first_byte_to_mix; float * p_in = (float *)p_input->p_first_byte_to_mix;
...@@ -128,7 +128,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -128,7 +128,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
ptrdiff_t i_available_words = ( ptrdiff_t i_available_words = (
(float *)p_input->fifo.p_first->p_buffer - p_in) (float *)p_input->fifo.p_first->p_buffer - p_in)
+ p_input->fifo.p_first->i_nb_samples + p_input->fifo.p_first->i_nb_samples
* p_aout->mixer.mixer.i_channels; * i_nb_channels;
if ( i_available_words < i_nb_words ) if ( i_available_words < i_nb_words )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* trivial.c : trivial mixer plug-in (1 input, no downmixing) * trivial.c : trivial mixer plug-in (1 input, no downmixing)
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.9 2002/09/30 21:32:32 massiot Exp $ * $Id: trivial.c,v 1.10 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -73,8 +73,9 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -73,8 +73,9 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{ {
int i = 0; int i = 0;
aout_input_t * p_input = p_aout->pp_inputs[i]; aout_input_t * p_input = p_aout->pp_inputs[i];
int i_nb_channels = aout_FormatNbChannels( &p_aout->mixer.mixer );
int i_nb_bytes = p_buffer->i_nb_samples * sizeof(s32) int i_nb_bytes = p_buffer->i_nb_samples * sizeof(s32)
* p_aout->mixer.mixer.i_channels; * i_nb_channels;
byte_t * p_in; byte_t * p_in;
byte_t * p_out; byte_t * p_out;
...@@ -93,7 +94,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -93,7 +94,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
- p_in) - p_in)
+ p_input->fifo.p_first->i_nb_samples + p_input->fifo.p_first->i_nb_samples
* sizeof(s32) * sizeof(s32)
* p_aout->mixer.mixer.i_channels; * i_nb_channels;
if ( i_available_bytes < i_nb_bytes ) if ( i_available_bytes < i_nb_bytes )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lpcm.c: lpcm decoder module * lpcm.c: lpcm decoder module
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.4 2002/09/30 21:32:32 massiot Exp $ * $Id: lpcm.c,v 1.5 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org> * Henri Fallon <henri@videolan.org>
...@@ -127,7 +127,7 @@ static int RunDecoder( decoder_fifo_t * p_fifo ) ...@@ -127,7 +127,7 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
/* FIXME : I suppose the number of channel and sampling rate /* FIXME : I suppose the number of channel and sampling rate
* are somewhere in the headers */ * are somewhere in the headers */
p_dec->output_format.i_format = VLC_FOURCC('s','1','6','b'); p_dec->output_format.i_format = VLC_FOURCC('s','1','6','b');
p_dec->output_format.i_channels = 2; p_dec->output_format.i_channels = AOUT_CHAN_STEREO;
p_dec->output_format.i_rate = 48000; p_dec->output_format.i_rate = 48000;
aout_DateInit( &p_dec->end_date, 48000 ); aout_DateInit( &p_dec->end_date, 48000 );
......
...@@ -147,12 +147,14 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header, ...@@ -147,12 +147,14 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
mad_fixed_t const * p_right = p_pcm->samples[1]; mad_fixed_t const * p_right = p_pcm->samples[1];
int i_samples = p_pcm->length; int i_samples = p_pcm->length;
mad_fixed_t * p_samples; mad_fixed_t * p_samples;
int i_channels = (p_pcm->channels == 2) ? AOUT_CHAN_STEREO :
AOUT_CHAN_MONO;
/* Creating the audio output fifo. Assume the samplerate and nr of channels /* Creating the audio output fifo. Assume the samplerate and nr of channels
* from the first decoded frame is right for the entire audio track. */ * from the first decoded frame is right for the entire audio track. */
if( (p_dec->p_aout_input != NULL) && if( (p_dec->p_aout_input != NULL) &&
(p_dec->output_format.i_rate != p_pcm->samplerate (p_dec->output_format.i_rate != p_pcm->samplerate
|| p_dec->output_format.i_channels != p_pcm->channels) ) || p_dec->output_format.i_channels != i_channels) )
{ {
/* Parameters changed - this should not happen. */ /* Parameters changed - this should not happen. */
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input ); aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
...@@ -163,7 +165,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header, ...@@ -163,7 +165,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
if( p_dec->p_aout_input == NULL ) if( p_dec->p_aout_input == NULL )
{ {
p_dec->output_format.i_rate = p_pcm->samplerate; p_dec->output_format.i_rate = p_pcm->samplerate;
p_dec->output_format.i_channels = p_pcm->channels; p_dec->output_format.i_channels = i_channels;
aout_DateInit( &p_dec->end_date, p_pcm->samplerate ); aout_DateInit( &p_dec->end_date, p_pcm->samplerate );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo, p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout, &p_dec->p_aout,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* decoder.c: MPEG audio decoder thread * decoder.c: MPEG audio decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.5 2002/09/30 21:32:32 massiot Exp $ * $Id: decoder.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -166,8 +166,9 @@ static void DecodeThread( adec_thread_t * p_dec ) ...@@ -166,8 +166,9 @@ static void DecodeThread( adec_thread_t * p_dec )
if( !adec_SyncFrame( p_dec, &sync_info ) ) if( !adec_SyncFrame( p_dec, &sync_info ) )
{ {
/* Create the output fifo if it doesn't exist yet */ /* Create the output fifo if it doesn't exist yet */
if( ( p_dec->p_aout_input == NULL )|| if( ( p_dec->p_aout_input == NULL ) ||
( p_dec->output_format.i_channels != ( sync_info.b_stereo ? 2 : 1 ) )|| ( p_dec->output_format.i_channels !=
( sync_info.b_stereo ? AOUT_CHAN_STEREO : AOUT_CHAN_MONO ) ) ||
( p_dec->output_format.i_rate != sync_info.sample_rate ) ) ( p_dec->output_format.i_rate != sync_info.sample_rate ) )
{ {
if( p_dec->p_aout_input ) if( p_dec->p_aout_input )
...@@ -179,7 +180,8 @@ static void DecodeThread( adec_thread_t * p_dec ) ...@@ -179,7 +180,8 @@ static void DecodeThread( adec_thread_t * p_dec )
/* Set output configuration */ /* Set output configuration */
p_dec->output_format.i_format = VLC_FOURCC('f','l','3','2'); p_dec->output_format.i_format = VLC_FOURCC('f','l','3','2');
p_dec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 ); p_dec->output_format.i_channels =
( sync_info.b_stereo ? AOUT_CHAN_STEREO : AOUT_CHAN_MONO );
p_dec->output_format.i_rate = sync_info.sample_rate; p_dec->output_format.i_rate = sync_info.sample_rate;
aout_DateInit( &p_dec->end_date, sync_info.sample_rate ); aout_DateInit( &p_dec->end_date, sync_info.sample_rate );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo, p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
......
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