aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-05 18:44:37 +0200
committerMax Kellermann <max@duempel.org>2009-07-05 18:44:37 +0200
commitd78be1ab49d7483865f143f8d90cfafcefd0055b (patch)
treeac1e9803e3bcd8905986eb77e28751286a7fafdc
parent86e279f886aaf9f94076ce6b0170a79055aba821 (diff)
downloadmpd-d78be1ab49d7483865f143f8d90cfafcefd0055b.tar.gz
mpd-d78be1ab49d7483865f143f8d90cfafcefd0055b.tar.xz
mpd-d78be1ab49d7483865f143f8d90cfafcefd0055b.zip
output_init: moved mixer instantiation to separate function
-rw-r--r--src/output_init.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/output_init.c b/src/output_init.c
index 04609bb76..d72893ba8 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -56,6 +56,19 @@ audio_output_detect(GError **error)
return NULL;
}
+static struct mixer *
+audio_output_load_mixer(const struct config_param *param,
+ const struct mixer_plugin *plugin)
+{
+ if (!config_get_block_bool(param, "mixer_enabled", true))
+ return NULL;
+
+ if (plugin == NULL)
+ return NULL;
+
+ return mixer_new(plugin, param);
+}
+
bool
audio_output_init(struct audio_output *ao, const struct config_param *param,
GError **error)
@@ -135,11 +148,7 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
if (ao->data == NULL)
return false;
- if (plugin->mixer_plugin != NULL &&
- config_get_block_bool(param, "mixer_enabled", true))
- ao->mixer = mixer_new(plugin->mixer_plugin, param);
- else
- ao->mixer = NULL;
+ ao->mixer = audio_output_load_mixer(param, plugin->mixer_plugin);
return true;
}