X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fportaudio.c;h=6bc6c699facd449fe91fc58234a1bb28d19f2997;hb=12dfb65e91cb460d1ac97dff6b5c0d2b1e431c51;hp=dd65f379b1826c4795d76d9d7efd2cb965e05fb5;hpb=cfca8bcd6d718662c18d6ccb8a44d6b90305b997;p=vlc diff --git a/modules/audio_output/portaudio.c b/modules/audio_output/portaudio.c index dd65f379b1..6bc6c699fa 100644 --- a/modules/audio_output/portaudio.c +++ b/modules/audio_output/portaudio.c @@ -63,6 +63,7 @@ typedef struct struct aout_sys_t { + aout_packet_t packet; audio_output_t *p_aout; PaStream *p_stream; @@ -113,7 +114,6 @@ vlc_module_begin () set_subcategory( SUBCAT_AUDIO_AOUT ) add_integer( "portaudio-audio-device", 0, DEVICE_TEXT, DEVICE_LONGTEXT, false ) - add_deprecated_alias( "portaudio-device" ) /* deprecated since 0.9.3 */ set_capability( "audio output", 0 ) set_callbacks( Open, Close ) vlc_module_end () @@ -136,7 +136,7 @@ static int paCallback( const void *inputBuffer, void *outputBuffer, out_date = mdate() + (mtime_t) ( 1000000 * ( paDate->outputBufferDacTime - paDate->currentTime ) ); - p_buffer = aout_OutputNextBuffer( p_aout, out_date, true ); + p_buffer = aout_PacketNext( p_aout, out_date ); if ( p_buffer != NULL ) { @@ -149,12 +149,6 @@ static int paCallback( const void *inputBuffer, void *outputBuffer, } vlc_memcpy( outputBuffer, p_buffer->p_buffer, framesPerBuffer * p_sys->i_sample_size ); - /* aout_BufferFree may be dangereous here, but then so is - * aout_OutputNextBuffer (calls aout_BufferFree internally). - * one solution would be to link the no longer useful buffers - * in a second fifo (in aout_OutputNextBuffer too) and to - * wait until we are in Play to do the actual free. - */ aout_BufferFree( p_buffer ); } else @@ -328,6 +322,7 @@ static void Close ( vlc_object_t *p_this ) #endif msg_Dbg( p_aout, "portaudio closed"); + aout_PacketDestroy( p_aout ); free( p_sys ); } @@ -501,8 +496,8 @@ static int PAOpenStream( audio_output_t *p_aout ) /* Calculate the frame size in bytes */ p_sys->i_sample_size = 4 * i_channels; - p_aout->i_nb_samples = FRAME_SIZE; aout_FormatPrepare( &p_aout->format ); + aout_PacketInit( p_aout, &p_sys->packet, FRAME_SIZE ); aout_VolumeSoftInit( p_aout ); /* Check for channel reordering */ @@ -542,6 +537,7 @@ static int PAOpenStream( audio_output_t *p_aout ) paLastHostErrorInfo->errorText ); } p_sys->p_stream = 0; + aout_PacketDestroy( p_aout ); return VLC_EGENERIC; } @@ -550,6 +546,7 @@ static int PAOpenStream( audio_output_t *p_aout ) { msg_Err( p_aout, "Pa_StartStream() failed" ); Pa_CloseStream( p_sys->p_stream ); + aout_PacketDestroy( p_aout ); return VLC_EGENERIC; }