output_all: move _lock_signal() to output_control.c
Better name, better documentation.
This commit is contained in:
parent
8b0b4ff086
commit
2be6184c8d
@ -205,30 +205,14 @@ static void audio_output_wait_all(void)
|
||||
notify_wait(&audio_output_client_notify);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal the audio output if it is open, and set the "allow_play"
|
||||
* flag. This function locks the mutex.
|
||||
*/
|
||||
static void
|
||||
audio_output_lock_signal(struct audio_output *ao)
|
||||
{
|
||||
g_mutex_lock(ao->mutex);
|
||||
|
||||
ao->allow_play = true;
|
||||
if (audio_output_is_open(ao))
|
||||
g_cond_signal(ao->cond);
|
||||
|
||||
g_mutex_unlock(ao->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals all audio outputs which are open.
|
||||
*/
|
||||
static void
|
||||
audio_output_signal_all(void)
|
||||
audio_output_allow_play_all(void)
|
||||
{
|
||||
for (unsigned i = 0; i < num_audio_outputs; ++i)
|
||||
audio_output_lock_signal(&audio_outputs[i]);
|
||||
audio_output_allow_play(&audio_outputs[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -533,7 +517,7 @@ audio_output_all_cancel(void)
|
||||
/* the audio outputs are now waiting for a signal, to
|
||||
synchronize the cleared music pipe */
|
||||
|
||||
audio_output_signal_all();
|
||||
audio_output_allow_play_all();
|
||||
|
||||
/* invalidate elapsed_time */
|
||||
|
||||
|
@ -267,6 +267,18 @@ void audio_output_cancel(struct audio_output *ao)
|
||||
g_mutex_unlock(ao->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
audio_output_allow_play(struct audio_output *ao)
|
||||
{
|
||||
g_mutex_lock(ao->mutex);
|
||||
|
||||
ao->allow_play = true;
|
||||
if (audio_output_is_open(ao))
|
||||
g_cond_signal(ao->cond);
|
||||
|
||||
g_mutex_unlock(ao->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
audio_output_release(struct audio_output *ao)
|
||||
{
|
||||
|
@ -72,11 +72,17 @@ audio_output_drain_async(struct audio_output *ao);
|
||||
|
||||
/**
|
||||
* Clear the "allow_play" flag and send the "CANCEL" command
|
||||
* asynchronously. To finish the operation, the caller has to set the
|
||||
* "allow_play" flag and signal the thread.
|
||||
* asynchronously. To finish the operation, the caller has to call
|
||||
* audio_output_allow_play().
|
||||
*/
|
||||
void audio_output_cancel(struct audio_output *ao);
|
||||
|
||||
/**
|
||||
* Set the "allow_play" and signal the thread.
|
||||
*/
|
||||
void
|
||||
audio_output_allow_play(struct audio_output *ao);
|
||||
|
||||
void audio_output_close(struct audio_output *ao);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user