From e686d19154d8de8f9884cd768ef5e600991076ef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 3 Mar 2010 20:29:33 +0100 Subject: output: added option "always_on" for radio stations Did you ever accidently click "stop" while feeding a radio station? This option sets the output device to "pause" to disable the "close" method. It falls back to "pause" then, which is specific to the plugin. Some plugins implement it by feeding silence. --- src/output_control.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/output_control.c') diff --git a/src/output_control.c b/src/output_control.c index b5d983ae1..17edc3d72 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -118,9 +118,13 @@ audio_output_open(struct audio_output *ao, if (ao->open && audio_format_equals(audio_format, &ao->in_audio_format)) { - assert(ao->pipe == mp); + assert(ao->pipe == mp || + (ao->always_on && ao->pause)); if (ao->pause) { + ao->chunk = NULL; + ao->pipe = mp; + /* unpause with the CANCEL command; this is a hack, but suits well for forcing the thread to leave the ao_pause() thread, and we need @@ -266,6 +270,15 @@ void audio_output_close(struct audio_output *ao) g_mutex_unlock(ao->mutex); } +void +audio_output_release(struct audio_output *ao) +{ + if (ao->always_on) + audio_output_pause(ao); + else + audio_output_close(ao); +} + void audio_output_finish(struct audio_output *ao) { audio_output_close(ao); -- cgit v1.2.3