Commit d95b6ba1 authored by Eric Petit's avatar Eric Petit

Use pf_memcpy and pf_memset.

parent 95f555e8
......@@ -2,7 +2,7 @@
* AudioOutput.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: AudioOutput.cpp,v 1.23 2003/01/04 17:14:22 titer Exp $
* $Id: AudioOutput.cpp,v 1.24 2003/01/08 13:52:56 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -73,18 +73,35 @@ int E_(OpenAudio) ( vlc_object_t * p_this )
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_VolumeSoftInit( p_aout );
int i_nb_channels = aout_FormatNbChannels( &p_aout->output.output );
if ( i_nb_channels > 2 )
{
/* BSoundPlayer does not support more than 2 channels AFAIK */
i_nb_channels = 2;
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
media_raw_audio_format *p_format;
p_format = (media_raw_audio_format*)
malloc( sizeof( media_raw_audio_format ) );
p_format->channel_count = i_nb_channels;
p_format->frame_rate = p_aout->output.output.i_rate;
p_format->format = media_raw_audio_format::B_AUDIO_FLOAT;
#ifdef WORDS_BIGENDIAN
p_format->byte_order = B_MEDIA_BIG_ENDIAN;
#else
p_format->byte_order = B_MEDIA_LITTLE_ENDIAN;
#endif
p_format->buffer_size = 8192;
p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
/* BSoundPlayer likes 44khz stereo */
p_aout->output.output.i_rate = 44100;
p_aout->output.output.i_physical_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
/* BSoundPlayer wants 8192 bytes buffers.
8192 = i_nb_samples * 2 (stereo) * 4 (fl32) */
p_aout->output.i_nb_samples = 1024;
p_aout->output.i_nb_samples = 2048 / i_nb_channels;
p_aout->output.pf_play = DoNothing;
p_sys->p_player = new BSoundPlayer( "player", Play, NULL, p_aout );
p_sys->p_player = new BSoundPlayer( p_format, "player", Play, NULL, p_aout );
if( p_sys->p_player->InitCheck() != B_OK )
{
msg_Err( p_aout, "BSoundPlayer InitCheck failed" );
......@@ -121,27 +138,19 @@ static void Play( void *aout, void *p_buffer, size_t i_size,
aout_buffer_t * p_aout_buffer;
aout_instance_t *p_aout = (aout_instance_t*) aout;
if( (int)i_size != 8 * p_aout->output.i_nb_samples )
{
msg_Warn( p_aout, "BSoundPlayer buffer size changed (%d -> %d)",
8 * p_aout->output.i_nb_samples, i_size );
p_aout->output.i_nb_samples = i_size / 8;
}
vlc_mutex_lock( &p_aout->output_fifo_lock );
p_aout_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
vlc_mutex_unlock( &p_aout->output_fifo_lock );
if( p_aout_buffer != NULL )
{
memcpy( (float*)p_buffer,
p_aout_buffer->p_buffer,
p_aout_buffer->i_nb_bytes );
p_aout->p_vlc->pf_memcpy( (float*)p_buffer,
p_aout_buffer->p_buffer, i_size );
aout_BufferFree( p_aout_buffer );
}
else
{
memset( (float*)p_buffer, 0, i_size );
p_aout->p_vlc->pf_memset( (float*)p_buffer, 0, i_size );
}
}
......
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