X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fportaudio.c;h=73080248cf106df8ff5bdf52e8db713e34c0b8de;hb=12ade3e3bc975d5426ba4af155b7372c31093b31;hp=9229ac70c5711aa708f7ca5f59fb2806d6c53b23;hpb=b745d0316c8fcc8e49a82e150a3e9dc4ed25d588;p=vlc diff --git a/modules/audio_output/portaudio.c b/modules/audio_output/portaudio.c index 9229ac70c5..73080248cf 100644 --- a/modules/audio_output/portaudio.c +++ b/modules/audio_output/portaudio.c @@ -57,6 +57,7 @@ typedef struct pa_thread_t vlc_cond_t signal; vlc_mutex_t lock_signal; bool b_signal; + bool b_error; } pa_thread_t; @@ -105,16 +106,17 @@ static int PAOpenStream( aout_instance_t * ); #define DEVICE_TEXT N_("Output device") #define DEVICE_LONGTEXT N_("Portaudio identifier for the output device") -vlc_module_begin(); - set_shortname( "PortAudio" ); - set_description( N_("PORTAUDIO audio output") ); - set_category( CAT_AUDIO ); - set_subcategory( SUBCAT_AUDIO_AOUT ); +vlc_module_begin () + set_shortname( "PortAudio" ) + set_description( N_("PORTAUDIO audio output") ) + set_category( CAT_AUDIO ) + set_subcategory( SUBCAT_AUDIO_AOUT ) add_integer( "portaudio-audio-device", 0, NULL, - DEVICE_TEXT, DEVICE_LONGTEXT, false ); - set_capability( "audio output", 0 ); - set_callbacks( Open, Close ); -vlc_module_end(); + 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 () /* This routine will be called by the PortAudio engine when audio is needed. * It may called at interrupt level on some machines so don't do anything @@ -125,6 +127,8 @@ static int paCallback( const void *inputBuffer, void *outputBuffer, const PaStreamCallbackTimeInfo *paDate, PaStreamCallbackFlags statusFlags, void *p_cookie ) { + VLC_UNUSED( inputBuffer ); VLC_UNUSED( statusFlags ); + struct aout_sys_t *p_sys = (struct aout_sys_t*) p_cookie; aout_instance_t *p_aout = p_sys->p_aout; aout_buffer_t *p_buffer; @@ -139,7 +143,7 @@ static int paCallback( const void *inputBuffer, void *outputBuffer, if( p_sys->b_chan_reorder ) { /* Do the channel reordering here */ - aout_ChannelReorder( p_buffer->p_buffer, p_buffer->i_nb_bytes, + aout_ChannelReorder( p_buffer->p_buffer, p_buffer->i_buffer, p_sys->i_channels, p_sys->pi_chan_table, p_sys->i_bits_per_sample ); } @@ -168,13 +172,11 @@ static int Open( vlc_object_t * p_this ) { aout_instance_t *p_aout = (aout_instance_t *)p_this; struct aout_sys_t * p_sys; - vlc_value_t val; - int i_err; msg_Dbg( p_aout, "entering Open()"); /* Allocate p_sys structure */ - p_sys = (aout_sys_t *)malloc( sizeof(aout_sys_t) ); + p_sys = malloc( sizeof(aout_sys_t) ); if( p_sys == NULL ) return VLC_ENOMEM; p_sys->p_aout = p_aout; @@ -183,13 +185,13 @@ static int Open( vlc_object_t * p_this ) p_aout->output.pf_play = Play; /* Retrieve output device id from config */ - var_Create( p_aout, "portaudio-audio-device", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT); - var_Get( p_aout, "portaudio-audio-device", &val ); - p_sys->i_device_id = val.i_int; + p_sys->i_device_id = var_CreateGetInteger( p_aout, "portaudio-audio-device" ); #ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN if( !b_init ) { + int i_err; + /* Test device */ if( PAOpenDevice( p_aout ) != VLC_SUCCESS ) { @@ -219,7 +221,7 @@ static int Open( vlc_object_t * p_this ) /* Create PORTAUDIOThread */ if( vlc_thread_create( pa_thread, "aout", PORTAUDIOThread, - VLC_THREAD_PRIORITY_OUTPUT, false ) ) + VLC_THREAD_PRIORITY_OUTPUT ) ) { msg_Err( p_aout, "cannot create PORTAUDIO thread" ); return VLC_EGENERIC; @@ -281,7 +283,6 @@ static void Close ( vlc_object_t *p_this ) { aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_sys_t *p_sys = p_aout->output.p_sys; - int i_err; msg_Dbg( p_aout, "closing portaudio"); @@ -302,7 +303,7 @@ static void Close ( vlc_object_t *p_this ) #else - i_err = Pa_StopStream( p_sys->p_stream ); + int i_err = Pa_StopStream( p_sys->p_stream ); if( i_err != paNoError ) { msg_Err( p_aout, "Pa_StopStream: %d (%s)", i_err, @@ -391,7 +392,7 @@ static int PAOpenDevice( aout_instance_t *p_aout ) if( p_sys->deviceInfo->maxOutputChannels >= 1 ) { val.i_int = AOUT_VAR_MONO; - text.psz_string = N_("Mono"); + text.psz_string = _("Mono"); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); msg_Dbg( p_aout, "device supports 1 channel" ); @@ -399,7 +400,7 @@ static int PAOpenDevice( aout_instance_t *p_aout ) if( p_sys->deviceInfo->maxOutputChannels >= 2 ) { val.i_int = AOUT_VAR_STEREO; - text.psz_string = N_("Stereo"); + text.psz_string = _("Stereo"); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, @@ -410,7 +411,7 @@ static int PAOpenDevice( aout_instance_t *p_aout ) if( p_sys->deviceInfo->maxOutputChannels >= 4 ) { val.i_int = AOUT_VAR_2F2R; - text.psz_string = N_("2 Front 2 Rear"); + text.psz_string = _("2 Front 2 Rear"); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); msg_Dbg( p_aout, "device supports 4 channels" ); @@ -418,7 +419,7 @@ static int PAOpenDevice( aout_instance_t *p_aout ) if( p_sys->deviceInfo->maxOutputChannels >= 5 ) { val.i_int = AOUT_VAR_3F2R; - text.psz_string = N_("3 Front 2 Rear"); + text.psz_string = _("3 Front 2 Rear"); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); msg_Dbg( p_aout, "device supports 5 channels" ); @@ -426,20 +427,18 @@ static int PAOpenDevice( aout_instance_t *p_aout ) if( p_sys->deviceInfo->maxOutputChannels >= 6 ) { val.i_int = AOUT_VAR_5_1; - text.psz_string = "5.1"; + text.psz_string = _("5.1"); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); msg_Dbg( p_aout, "device supports 5.1 channels" ); } var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL ); - - val.b_bool = true; - var_Set( p_aout, "intf-change", val ); + var_SetBool( p_aout, "intf-change", true ); } /* Audio format is paFloat32 (always supported by portaudio v19) */ - p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2'); + p_aout->output.output.i_format = VLC_CODEC_FL32; return VLC_SUCCESS; @@ -560,6 +559,7 @@ static int PAOpenStream( aout_instance_t *p_aout ) *****************************************************************************/ static void Play( aout_instance_t * p_aout ) { + VLC_UNUSED( p_aout ); } #ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN