output_init: parse audio format earlier
This commit is contained in:
parent
17e3054399
commit
f5c2acf1d4
|
@ -78,11 +78,11 @@ bool
|
||||||
audio_output_init(struct audio_output *ao, const struct config_param *param,
|
audio_output_init(struct audio_output *ao, const struct config_param *param,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *format;
|
|
||||||
const struct audio_output_plugin *plugin = NULL;
|
const struct audio_output_plugin *plugin = NULL;
|
||||||
|
|
||||||
if (param) {
|
if (param) {
|
||||||
const char *type = NULL;
|
const char *type = NULL;
|
||||||
|
const char *format;
|
||||||
|
|
||||||
type = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
|
type = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
|
||||||
if (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,
|
format = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
|
||||||
NULL);
|
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 {
|
} else {
|
||||||
g_warning("No \"%s\" defined in config file\n",
|
g_warning("No \"%s\" defined in config file\n",
|
||||||
CONF_AUDIO_OUTPUT);
|
CONF_AUDIO_OUTPUT);
|
||||||
|
@ -121,7 +129,7 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
|
||||||
plugin->name);
|
plugin->name);
|
||||||
|
|
||||||
ao->name = "default detected output";
|
ao->name = "default detected output";
|
||||||
format = NULL;
|
ao->config_audio_format = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ao->plugin = plugin;
|
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);
|
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;
|
ao->thread = NULL;
|
||||||
notify_init(&ao->notify);
|
notify_init(&ao->notify);
|
||||||
ao->command = AO_COMMAND_NONE;
|
ao->command = AO_COMMAND_NONE;
|
||||||
|
|
Loading…
Reference in New Issue