output_init: merge two local string variables
This commit is contained in:
parent
f5c2acf1d4
commit
13e725ab09
|
@ -81,21 +81,19 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
|
||||||
const struct audio_output_plugin *plugin = NULL;
|
const struct audio_output_plugin *plugin = NULL;
|
||||||
|
|
||||||
if (param) {
|
if (param) {
|
||||||
const char *type = NULL;
|
const char *p;
|
||||||
const char *format;
|
|
||||||
|
|
||||||
type = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
|
p = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
|
||||||
if (type == NULL) {
|
if (p == NULL) {
|
||||||
g_set_error(error, audio_output_quark(), 0,
|
g_set_error(error, audio_output_quark(), 0,
|
||||||
"Missing \"type\" configuration");
|
"Missing \"type\" configuration");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin = audio_output_plugin_get(type);
|
plugin = audio_output_plugin_get(p);
|
||||||
if (plugin == NULL) {
|
if (plugin == NULL) {
|
||||||
g_set_error(error, audio_output_quark(), 0,
|
g_set_error(error, audio_output_quark(), 0,
|
||||||
"No such audio output plugin: %s",
|
"No such audio output plugin: %s", p);
|
||||||
type);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,13 +105,13 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
format = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
|
p = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
|
||||||
NULL);
|
NULL);
|
||||||
ao->config_audio_format = format != NULL;
|
ao->config_audio_format = p != NULL;
|
||||||
if (format != NULL) {
|
if (p != NULL) {
|
||||||
bool success =
|
bool success =
|
||||||
audio_format_parse(&ao->out_audio_format,
|
audio_format_parse(&ao->out_audio_format,
|
||||||
format, error);
|
p, error);
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue