aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-26 18:23:23 +0100
committerMax Kellermann <max@duempel.org>2009-03-26 18:23:23 +0100
commit66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58 (patch)
treec138f37dfc13af01df8606ed7a8f882964a32f27 /src/output_control.c
parent209c8a540c80faffb6b04ac6e7fed64a03c679ac (diff)
downloadmpd-66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58.tar.gz
mpd-66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58.tar.xz
mpd-66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58.zip
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.
Diffstat (limited to 'src/output_control.c')
-rw-r--r--src/output_control.c19
1 files changed, 17 insertions, 2 deletions
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 <assert.h>
#include <stdlib.h>
@@ -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);