diff options
author | Max Kellermann <max@duempel.org> | 2009-03-01 13:31:32 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-01 13:31:32 +0100 |
commit | cb942eeb45e15d6b471625629dcb324e625cfac7 (patch) | |
tree | 689b1634c226efb886f2d17a2b5a539e0c2762ad /src/output_init.c | |
parent | af66f666c65cfdca3cf717a923a0e440bb75afe2 (diff) | |
download | mpd-cb942eeb45e15d6b471625629dcb324e625cfac7.tar.gz mpd-cb942eeb45e15d6b471625629dcb324e625cfac7.tar.xz mpd-cb942eeb45e15d6b471625629dcb324e625cfac7.zip |
output_init: moved code to audio_output_detect()
Diffstat (limited to '')
-rw-r--r-- | src/output_init.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/output_init.c b/src/output_init.c index a007dbd1b..4c052d943 100644 --- a/src/output_init.c +++ b/src/output_init.c @@ -41,6 +41,27 @@ if(bp) str = bp->value; \ } +static const struct audio_output_plugin * +audio_output_detect(void) +{ + const struct audio_output_plugin *plugin; + unsigned i; + + g_warning("Attempt to detect audio output device"); + + audio_output_plugins_for_each(plugin, i) { + if (plugin->test_default_device == NULL) + continue; + + g_warning("Attempting to detect a %s audio device", + plugin->name); + if (ao_plugin_test_default_device(plugin)) + return plugin; + } + + return NULL; +} + bool audio_output_init(struct audio_output *ao, const struct config_param *param) { @@ -63,29 +84,18 @@ audio_output_init(struct audio_output *ao, const struct config_param *param) "\"%s\" at line %i\n", type, param->line); } } else { - unsigned i; - g_warning("No \"%s\" defined in config file\n", CONF_AUDIO_OUTPUT); - g_warning("Attempt to detect audio output device\n"); - - audio_output_plugins_for_each(plugin, i) { - if (plugin->test_default_device) { - g_warning("Attempting to detect a %s audio " - "device\n", plugin->name); - if (ao_plugin_test_default_device(plugin)) { - g_warning("Successfully detected a %s " - "audio device\n", plugin->name); - break; - } - } - } + plugin = audio_output_detect(); if (plugin == NULL) { - g_warning("Unable to detect an audio device\n"); + g_warning("Unable to detect an audio device"); return false; } + g_message("Successfully detected a %s audio device", + plugin->name); + name = "default detected output"; } |