diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 22:12:56 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 22:12:56 +0200 |
commit | f18695eb45628ee9aaaec9d928490757567208a7 (patch) | |
tree | e15bf13ec3128d75e4fd7b0ec1b4898d240b4d90 /test | |
parent | d6b0ecac1b9a6c5ea95fc45aa546ce990f21cdf0 (diff) |
test/run_output: use struct ConfigData
Diffstat (limited to 'test')
-rw-r--r-- | test/run_output.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/test/run_output.cxx b/test/run_output.cxx index bf22d0657..9f9c5c1c6 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -22,7 +22,8 @@ #include "output/Registry.hxx" #include "output/OutputPlugin.hxx" #include "config/Param.hxx" -#include "config/Global.hxx" +#include "config/Data.hxx" +#include "config/File.hxx" #include "config/Option.hxx" #include "config/Block.hxx" #include "event/Thread.hxx" @@ -43,10 +44,11 @@ #include <stdio.h> static std::unique_ptr<AudioOutput> -load_audio_output(EventLoop &event_loop, const char *name) +LoadAudioOutput(const ConfigData &config, EventLoop &event_loop, + const char *name) { - const auto *block = config_find_block(ConfigBlockOption::AUDIO_OUTPUT, - "name", name); + const auto *block = config.FindBlock(ConfigBlockOption::AUDIO_OUTPUT, + "name", name); if (block == nullptr) throw FormatRuntimeError("No such configured audio output: %s", name); @@ -120,15 +122,15 @@ try { /* read configuration file (mpd.conf) */ - config_global_init(); - ReadConfigFile(config_path); + ConfigData config; + ReadConfigFile(config, config_path); EventThread io_thread; io_thread.Start(); /* initialize the audio output */ - auto ao = load_audio_output(io_thread.GetEventLoop(), argv[2]); + auto ao = LoadAudioOutput(config, io_thread.GetEventLoop(), argv[2]); /* parse the audio format */ @@ -141,10 +143,6 @@ try { /* cleanup and exit */ - ao.reset(); - - config_global_finish(); - return EXIT_SUCCESS; } catch (...) { PrintException(std::current_exception()); |