X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faudio_output%2Fportaudio.c;h=74afad6048485257111dafe8cd9c3bb7733267e9;hb=5b63839284565821b5aff349378eddbb9d7f1ee0;hp=4e382dd593641177d9fb85be78ef24137047baae;hpb=37a2578ce4265f4ed495290923e3fa674c662656;p=vlc diff --git a/modules/audio_output/portaudio.c b/modules/audio_output/portaudio.c index 4e382dd593..74afad6048 100644 --- a/modules/audio_output/portaudio.c +++ b/modules/audio_output/portaudio.c @@ -77,21 +77,16 @@ struct aout_sys_t uint32_t i_channels; }; -static const uint32_t pi_channels_in[] = - { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, - AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, - AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, - AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 }; static const uint32_t pi_channels_out[] = { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, AOUT_CHAN_CENTER, AOUT_CHAN_LFE, - AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, + AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER, AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, 0 }; #ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN static bool b_init = 0; static pa_thread_t *pa_thread; -static void PORTAUDIOThread( pa_thread_t * ); +static void* PORTAUDIOThread( vlc_object_t * ); #endif /***************************************************************************** @@ -216,10 +211,10 @@ static int Open( vlc_object_t * p_this ) pa_thread->p_aout = p_aout; pa_thread->b_error = false; vlc_mutex_init( &pa_thread->lock_wait ); - vlc_cond_init( p_aout, &pa_thread->wait ); + vlc_cond_init( &pa_thread->wait ); pa_thread->b_wait = false; vlc_mutex_init( &pa_thread->lock_signal ); - vlc_cond_init( p_aout, &pa_thread->signal ); + vlc_cond_init( &pa_thread->signal ); pa_thread->b_signal = false; /* Create PORTAUDIOThread */ @@ -515,7 +510,7 @@ static int PAOpenStream( aout_instance_t *p_aout ) p_aout->output.p_sys->i_channels = i_channels; p_aout->output.p_sys->b_chan_reorder = - aout_CheckChannelReorder( pi_channels_in, pi_channels_out, + aout_CheckChannelReorder( NULL, pi_channels_out, i_channel_mask, i_channels, p_aout->output.p_sys->pi_chan_table ); @@ -572,13 +567,15 @@ static void Play( aout_instance_t * p_aout ) * PORTAUDIOThread: all interactions with libportaudio.a are handled * in this single thread. Otherwise libportaudio.a is _not_ happy :-( *****************************************************************************/ -static void PORTAUDIOThread( pa_thread_t *pa_thread ) +static void* PORTAUDIOThread( vlc_object_t *p_this ) { + pa_thread_t *pa_thread = (pa_thread_t*)p_this; aout_instance_t *p_aout; aout_sys_t *p_sys; int i_err; + int canc = vlc_savecancel (); - while( !pa_thread->b_die ) + while( vlc_object_alive (pa_thread) ) { /* Wait for start of stream */ vlc_mutex_lock( &pa_thread->lock_signal ); @@ -649,5 +646,7 @@ static void PORTAUDIOThread( pa_thread_t *pa_thread ) vlc_cond_signal( &pa_thread->wait ); vlc_mutex_unlock( &pa_thread->lock_wait ); } + vlc_restorecancel (canc); + return NULL; } #endif