test/run_filter: use struct ConfigData
This commit is contained in:
parent
61a119b607
commit
d6b0ecac1b
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/Global.hxx"
|
#include "config/Data.hxx"
|
||||||
|
#include "config/File.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "AudioParser.hxx"
|
#include "AudioParser.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
@ -50,9 +51,9 @@ mixer_set_volume(gcc_unused Mixer *mixer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::unique_ptr<PreparedFilter>
|
static std::unique_ptr<PreparedFilter>
|
||||||
load_filter(const char *name)
|
LoadFilter(const ConfigData &config, const char *name)
|
||||||
{
|
{
|
||||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_FILTER,
|
const auto *param = config.FindBlock(ConfigBlockOption::AUDIO_FILTER,
|
||||||
"name", name);
|
"name", name);
|
||||||
if (param == NULL)
|
if (param == NULL)
|
||||||
throw FormatRuntimeError("No such configured filter: %s",
|
throw FormatRuntimeError("No such configured filter: %s",
|
||||||
@ -76,8 +77,8 @@ try {
|
|||||||
|
|
||||||
/* read configuration file (mpd.conf) */
|
/* read configuration file (mpd.conf) */
|
||||||
|
|
||||||
config_global_init();
|
ConfigData config;
|
||||||
ReadConfigFile(config_path);
|
ReadConfigFile(config, config_path);
|
||||||
|
|
||||||
/* parse the audio format */
|
/* parse the audio format */
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ try {
|
|||||||
|
|
||||||
/* initialize the filter */
|
/* initialize the filter */
|
||||||
|
|
||||||
auto prepared_filter = load_filter(argv[2]);
|
auto prepared_filter = LoadFilter(config, argv[2]);
|
||||||
|
|
||||||
/* open the filter */
|
/* open the filter */
|
||||||
|
|
||||||
@ -118,8 +119,6 @@ try {
|
|||||||
|
|
||||||
/* cleanup and exit */
|
/* cleanup and exit */
|
||||||
|
|
||||||
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