From d78be1ab49d7483865f143f8d90cfafcefd0055b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 5 Jul 2009 18:44:37 +0200 Subject: output_init: moved mixer instantiation to separate function --- src/output_init.c | 19 ++++++++++++++----- 1 file 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; } -- cgit v1.2.3