output_init: moved mixer instantiation to separate function

This commit is contained in:
Max Kellermann 2009-07-05 18:44:37 +02:00
parent 86e279f886
commit d78be1ab49

View File

@ -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;
}