test/run_output: use struct ConfigData
This commit is contained in:
parent
d6b0ecac1b
commit
f18695eb45
@ -22,7 +22,8 @@
|
|||||||
#include "output/Registry.hxx"
|
#include "output/Registry.hxx"
|
||||||
#include "output/OutputPlugin.hxx"
|
#include "output/OutputPlugin.hxx"
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/Global.hxx"
|
#include "config/Data.hxx"
|
||||||
|
#include "config/File.hxx"
|
||||||
#include "config/Option.hxx"
|
#include "config/Option.hxx"
|
||||||
#include "config/Block.hxx"
|
#include "config/Block.hxx"
|
||||||
#include "event/Thread.hxx"
|
#include "event/Thread.hxx"
|
||||||
@ -43,10 +44,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static std::unique_ptr<AudioOutput>
|
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,
|
const auto *block = config.FindBlock(ConfigBlockOption::AUDIO_OUTPUT,
|
||||||
"name", name);
|
"name", name);
|
||||||
if (block == nullptr)
|
if (block == nullptr)
|
||||||
throw FormatRuntimeError("No such configured audio output: %s",
|
throw FormatRuntimeError("No such configured audio output: %s",
|
||||||
name);
|
name);
|
||||||
@ -120,15 +122,15 @@ try {
|
|||||||
|
|
||||||
/* read configuration file (mpd.conf) */
|
/* read configuration file (mpd.conf) */
|
||||||
|
|
||||||
config_global_init();
|
ConfigData config;
|
||||||
ReadConfigFile(config_path);
|
ReadConfigFile(config, config_path);
|
||||||
|
|
||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
io_thread.Start();
|
io_thread.Start();
|
||||||
|
|
||||||
/* initialize the audio output */
|
/* 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 */
|
/* parse the audio format */
|
||||||
|
|
||||||
@ -141,10 +143,6 @@ try {
|
|||||||
|
|
||||||
/* cleanup and exit */
|
/* cleanup and exit */
|
||||||
|
|
||||||
ao.reset();
|
|
||||||
|
|
||||||
config_global_finish();
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
PrintException(std::current_exception());
|
PrintException(std::current_exception());
|
||||||
|
Loading…
Reference in New Issue
Block a user