From 6e21e24caed1a9497e876e4b89b12687aa73d6ad Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 29 Sep 2008 16:43:55 +0200 Subject: audio_output: added method pause() pause() puts the audio output into pause mode: if supported, it may perform a special action, which keeps the device open, but does not play anything. Output plugins like "shout" might want to play silence during pause, so their clients won't be disconnected. Plugins which do not support pausing will simply be closed, and have to be reopened when unpaused. This pach includes an implementation for the shout plugin, which sends silence chunks. --- src/output_thread.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/output_thread.c') diff --git a/src/output_thread.c b/src/output_thread.c index 4bc5d8fcb..c2f4f6d3c 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -63,6 +63,20 @@ static void ao_play(struct audio_output *ao) ao_command_finished(ao); } +static void ao_pause(struct audio_output *ao) +{ + if (ao->plugin->pause != NULL) { + /* pause is supported */ + ao_command_finished(ao); + ao->plugin->pause(ao->data); + } else { + /* pause is not supported - simply close the device */ + ao->plugin->close(ao->data); + ao->open = 0; + ao_command_finished(ao); + } +} + static void *audio_output_task(void *arg) { struct audio_output *ao = arg; @@ -95,6 +109,10 @@ static void *audio_output_task(void *arg) ao_play(ao); break; + case AO_COMMAND_PAUSE: + ao_pause(ao); + break; + case AO_COMMAND_CANCEL: ao->plugin->cancel(ao->data); ao_command_finished(ao); -- cgit v1.2.3