diff options
author | Max Kellermann <max@duempel.org> | 2014-01-28 11:39:12 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-29 08:10:46 +0100 |
commit | 4657a3bd0fd97583e23cd65b80db71a71345fc13 (patch) | |
tree | c0aed4a1e4ef57d4686b400efd17069e2bf9958c /src/output/Init.cxx | |
parent | cb7366f47245bf259cef0b8c863eb3b724cff683 (diff) |
output: move functions into the AudioOutput struct
Diffstat (limited to 'src/output/Init.cxx')
-rw-r--r-- | src/output/Init.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/output/Init.cxx b/src/output/Init.cxx index 3ba191ed7..372bb4276 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -147,14 +147,11 @@ audio_output_load_mixer(AudioOutput *ao, } bool -ao_base_init(AudioOutput *ao, - const config_param ¶m, Error &error) +AudioOutput::Configure(const config_param ¶m, Error &error) { - assert(ao != nullptr); - if (!param.IsNull()) { - ao->name = param.GetBlockValue(AUDIO_OUTPUT_NAME); - if (ao->name == nullptr) { + name = param.GetBlockValue(AUDIO_OUTPUT_NAME); + if (name == nullptr) { error.Set(config_domain, "Missing \"name\" configuration"); return false; @@ -163,26 +160,26 @@ ao_base_init(AudioOutput *ao, const char *p = param.GetBlockValue(AUDIO_OUTPUT_FORMAT); if (p != nullptr) { bool success = - audio_format_parse(ao->config_audio_format, + audio_format_parse(config_audio_format, p, true, error); if (!success) return false; } else - ao->config_audio_format.Clear(); + config_audio_format.Clear(); } else { - ao->name = "default detected output"; + name = "default detected output"; - ao->config_audio_format.Clear(); + config_audio_format.Clear(); } - ao->tags = param.GetBlockValue("tags", true); - ao->always_on = param.GetBlockValue("always_on", false); - ao->enabled = param.GetBlockValue("enabled", true); + tags = param.GetBlockValue("tags", true); + always_on = param.GetBlockValue("always_on", false); + enabled = param.GetBlockValue("enabled", true); /* set up the filter chain */ - ao->filter = filter_chain_new(); - assert(ao->filter != nullptr); + filter = filter_chain_new(); + assert(filter != nullptr); /* create the normalization filter (if configured) */ @@ -192,12 +189,12 @@ ao_base_init(AudioOutput *ao, IgnoreError()); assert(normalize_filter != nullptr); - filter_chain_append(*ao->filter, "normalize", + filter_chain_append(*filter, "normalize", autoconvert_filter_new(normalize_filter)); } Error filter_error; - filter_chain_parse(*ao->filter, + filter_chain_parse(*filter, param.GetBlockValue(AUDIO_FILTERS, ""), filter_error); @@ -206,7 +203,7 @@ ao_base_init(AudioOutput *ao, if (filter_error.IsDefined()) FormatError(filter_error, "Failed to initialize filter chain for '%s'", - ao->name); + name); /* done */ |