From 66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Mar 2009 18:23:23 +0100 Subject: output_plugin: replaced output_plugin.get_mixer() with mixer_plugin The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins. --- src/output_control.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/output_control.c') diff --git a/src/output_control.c b/src/output_control.c index 78800794f..d19ce3583 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -21,6 +21,7 @@ #include "output_api.h" #include "output_internal.h" #include "output_thread.h" +#include "mixer_control.h" #include #include @@ -61,6 +62,8 @@ audio_output_open(struct audio_output *ao, const struct audio_format *audio_format, const struct music_pipe *mp) { + bool open; + assert(mp != NULL); if (ao->fail_timer != NULL) { @@ -93,10 +96,16 @@ audio_output_open(struct audio_output *ao, if (ao->thread == NULL) audio_output_thread_start(ao); - if (!ao->open) + open = ao->open; + if (!open) { ao_command(ao, AO_COMMAND_OPEN); + open = ao->open; + } - return ao->open; + if (open && ao->mixer != NULL) + mixer_open(ao->mixer); + + return open; } bool @@ -139,6 +148,9 @@ void audio_output_close(struct audio_output *ao) { assert(!ao->open || ao->fail_timer == NULL); + if (ao->mixer != NULL) + mixer_close(ao->mixer); + if (ao->open) ao_command(ao, AO_COMMAND_CLOSE); else if (ao->fail_timer != NULL) { @@ -158,6 +170,9 @@ void audio_output_finish(struct audio_output *ao) g_thread_join(ao->thread); } + if (ao->mixer != NULL) + mixer_free(ao->mixer); + ao_plugin_finish(ao->plugin, ao->data); notify_deinit(&ao->notify); -- cgit v1.2.3