Commit e035de49 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

DJ's first steps in C and vlc decoders ;)

* modules/audio_filter/converter/mpgatofixed32.c:
  - fixed an issue that could cause glitches when switching from one stream
    to another. the buffer wasn't entirely getting 0000 because multiple
    channels were not taken into account when doing this.
* ALL:
  - if float32 then clear the buffer with (float)0
parent 7002c3ed
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* using MAD (MPEG Audio Decoder) * using MAD (MPEG Audio Decoder)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 by Jean-Paul Saman * Copyright (C) 2001 by Jean-Paul Saman
* $Id: mpgatofixed32.c,v 1.6 2003/02/21 15:16:52 hartman Exp $ * $Id: mpgatofixed32.c,v 1.7 2003/02/21 16:31:37 hartman Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Paul Saman <jpsaman@wxs.nl> * Jean-Paul Saman <jpsaman@wxs.nl>
...@@ -114,7 +114,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -114,7 +114,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_samples * sizeof(vlc_fixed_t); p_out_buf->i_nb_bytes = p_in_buf->i_nb_samples * sizeof(vlc_fixed_t) *
aout_FormatNbChannels( &p_filter->input );
/* Do the actual decoding now. */ /* Do the actual decoding now. */
mad_stream_buffer( &p_sys->mad_stream, p_in_buf->p_buffer, mad_stream_buffer( &p_sys->mad_stream, p_in_buf->p_buffer,
...@@ -123,8 +124,21 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -123,8 +124,21 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{ {
msg_Warn( p_aout, "libmad error: %s", msg_Warn( p_aout, "libmad error: %s",
mad_stream_errorstr( &p_sys->mad_stream ) ); mad_stream_errorstr( &p_sys->mad_stream ) );
if( p_filter->output.i_format == VLC_FOURCC('f','l','3','2') )
{
int i;
int i_size = p_out_buf->i_nb_bytes / sizeof(float);
float * a = (float *)p_out_buf->p_buffer;
for ( i = 0 ; i < i_size ; i++ )
*a++ = 0.0;
}
else
{
memset( p_out_buf->p_buffer, 0, p_out_buf->i_nb_bytes ); memset( p_out_buf->p_buffer, 0, p_out_buf->i_nb_bytes );
} }
return;
}
mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame ); mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame );
if ( p_filter->output.i_format == VLC_FOURCC('f','i','3','2') ) if ( p_filter->output.i_format == VLC_FOURCC('f','i','3','2') )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout.m: CoreAudio output plugin * aout.m: CoreAudio output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: aout.m,v 1.22 2003/01/21 00:47:43 jlj Exp $ * $Id: aout.m,v 1.23 2003/02/21 16:31:37 hartman Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -467,10 +467,22 @@ static OSStatus IOCallback( AudioDeviceID inDevice, ...@@ -467,10 +467,22 @@ static OSStatus IOCallback( AudioDeviceID inDevice,
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
} }
else else
{
if( p_aout->output.output.i_format == VLC_FOURCC('f','l','3','2') )
{
int i;
int i_size = p_sys->i_buffer_size / sizeof(float);
float * a = (float *)outOutputData->mBuffers[ 0 ].mData;
for ( i = 0 ; i < i_size ; i++ )
*a++ = 0.0;
}
else
{ {
memset( outOutputData->mBuffers[ 0 ].mData, memset( outOutputData->mBuffers[ 0 ].mData,
0, p_sys->i_buffer_size ); 0, p_sys->i_buffer_size );
} }
}
return( noErr ); return( noErr );
} }
......
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