diff options
Diffstat (limited to 'src/output_thread.c')
-rw-r--r-- | src/output_thread.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/output_thread.c b/src/output_thread.c index 6f9e9586a..b3c134413 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -105,6 +105,26 @@ ao_close(struct audio_output *ao) g_debug("closed plugin=%s name=\"%s\"", ao->plugin->name, ao->name); } +static void +ao_reopen(struct audio_output *ao) +{ + if (!ao->config_audio_format) { + if (ao->open) { + const struct music_pipe *mp = ao->pipe; + ao_close(ao); + ao->pipe = mp; + } + + /* no audio format is configured: copy in->out, let + the output's open() method determine the effective + out_audio_format */ + ao->out_audio_format = ao->in_audio_format; + } + + if (!ao->open) + ao_open(ao); +} + static bool ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk) { @@ -237,6 +257,11 @@ static gpointer audio_output_task(gpointer arg) ao_command_finished(ao); break; + case AO_COMMAND_REOPEN: + ao_reopen(ao); + ao_command_finished(ao); + break; + case AO_COMMAND_CLOSE: assert(ao->open); assert(ao->pipe != NULL); |