aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_init.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-06 21:40:43 +0200
committerMax Kellermann <max@duempel.org>2009-07-06 21:40:43 +0200
commitf5c2acf1d437eac0c3eedfbb30cfa453a753294c (patch)
treef35a00a27462702779eee1d6ecfd17dd52288efd /src/output_init.c
parent17e3054399ba649b6e2c6fa8e7a946c286eafe77 (diff)
downloadmpd-f5c2acf1d437eac0c3eedfbb30cfa453a753294c.tar.gz
mpd-f5c2acf1d437eac0c3eedfbb30cfa453a753294c.tar.xz
mpd-f5c2acf1d437eac0c3eedfbb30cfa453a753294c.zip
output_init: parse audio format earlier
Diffstat (limited to 'src/output_init.c')
-rw-r--r--src/output_init.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/output_init.c b/src/output_init.c
index 3b2c9d54f..238ca8081 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -78,11 +78,11 @@ bool
audio_output_init(struct audio_output *ao, const struct config_param *param,
GError **error)
{
- const char *format;
const struct audio_output_plugin *plugin = NULL;
if (param) {
const char *type = NULL;
+ const char *format;
type = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
if (type == NULL) {
@@ -109,6 +109,14 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
format = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
NULL);
+ ao->config_audio_format = format != NULL;
+ if (format != NULL) {
+ bool success =
+ audio_format_parse(&ao->out_audio_format,
+ format, error);
+ if (!success)
+ return false;
+ }
} else {
g_warning("No \"%s\" defined in config file\n",
CONF_AUDIO_OUTPUT);
@@ -121,7 +129,7 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
plugin->name);
ao->name = "default detected output";
- format = NULL;
+ ao->config_audio_format = false;
}
ao->plugin = plugin;
@@ -139,16 +147,6 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
filter_chain_append(ao->filter, ao->convert_filter);
- ao->config_audio_format = format != NULL;
- if (ao->config_audio_format) {
- bool ret;
-
- ret = audio_format_parse(&ao->out_audio_format, format,
- error);
- if (!ret)
- return false;
- }
-
ao->thread = NULL;
notify_init(&ao->notify);
ao->command = AO_COMMAND_NONE;