config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "db/PlaylistVector.hxx"
|
||||
#include "config/ConfigGlobal.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "tag/TagConfig.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "event/Loop.hxx"
|
||||
@@ -121,12 +122,12 @@ main(int argc, char **argv)
|
||||
/* do it */
|
||||
|
||||
const auto *path = config_get_param(ConfigOption::DB_FILE);
|
||||
config_param param("database", path != nullptr ? path->line : -1);
|
||||
ConfigBlock block(path != nullptr ? path->line : -1);
|
||||
if (path != nullptr)
|
||||
param.AddBlockParam("path", path->value.c_str(), path->line);
|
||||
block.AddBlockParam("path", path->value.c_str(), path->line);
|
||||
|
||||
Database *db = plugin->create(event_loop, database_listener,
|
||||
param, error);
|
||||
block, error);
|
||||
|
||||
if (db == nullptr) {
|
||||
cerr << error.GetMessage() << endl;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "pcm/Volume.hxx"
|
||||
#include "Main.hxx"
|
||||
#include "event/Loop.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
@@ -54,7 +54,7 @@ int main(int argc, gcc_unused char **argv)
|
||||
Mixer *mixer = mixer_new(event_loop, alsa_mixer_plugin,
|
||||
*(AudioOutput *)nullptr,
|
||||
*(MixerListener *)nullptr,
|
||||
config_param(), error);
|
||||
ConfigBlock(), error);
|
||||
if (mixer == NULL) {
|
||||
LogError(error, "mixer_new() failed");
|
||||
return EXIT_FAILURE;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include "encoder/ToOutputStream.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "AudioParser.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "fs/io/StdioOutputStream.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
@@ -60,11 +60,11 @@ int main(int argc, char **argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
config_param param;
|
||||
param.AddBlockParam("quality", "5.0", -1);
|
||||
ConfigBlock block;
|
||||
block.AddBlockParam("quality", "5.0", -1);
|
||||
|
||||
Error error;
|
||||
const auto encoder = encoder_init(*plugin, param, error);
|
||||
const auto encoder = encoder_init(*plugin, block, error);
|
||||
if (encoder == NULL) {
|
||||
LogError(error, "Failed to initialize encoder");
|
||||
return EXIT_FAILURE;
|
||||
|
@@ -50,8 +50,8 @@ mixer_set_volume(gcc_unused Mixer *mixer,
|
||||
static Filter *
|
||||
load_filter(const char *name)
|
||||
{
|
||||
const config_param *param =
|
||||
config_find_block(ConfigOption::AUDIO_FILTER, "name", name);
|
||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_FILTER,
|
||||
"name", name);
|
||||
if (param == NULL) {
|
||||
fprintf(stderr, "No such configured filter: %s\n", name);
|
||||
return nullptr;
|
||||
|
@@ -61,8 +61,8 @@ PlayerControl::~PlayerControl() {}
|
||||
static AudioOutput *
|
||||
load_audio_output(EventLoop &event_loop, const char *name)
|
||||
{
|
||||
const config_param *param =
|
||||
config_find_block(ConfigOption::AUDIO_OUTPUT, "name", name);
|
||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_OUTPUT,
|
||||
"name", name);
|
||||
if (param == NULL) {
|
||||
fprintf(stderr, "No such configured audio output: %s\n", name);
|
||||
return nullptr;
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include "encoder/EncoderInterface.hxx"
|
||||
#include "encoder/ToOutputStream.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "fs/io/StdioOutputStream.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "tag/TagBuilder.hxx"
|
||||
@@ -45,10 +45,10 @@ main(gcc_unused int argc, gcc_unused char **argv)
|
||||
const auto plugin = encoder_plugin_get("vorbis");
|
||||
assert(plugin != NULL);
|
||||
|
||||
config_param param;
|
||||
param.AddBlockParam("quality", "5.0", -1);
|
||||
ConfigBlock block;
|
||||
block.AddBlockParam("quality", "5.0", -1);
|
||||
|
||||
const auto encoder = encoder_init(*plugin, param, IgnoreError());
|
||||
const auto encoder = encoder_init(*plugin, block, IgnoreError());
|
||||
assert(encoder != NULL);
|
||||
|
||||
/* open the encoder */
|
||||
|
Reference in New Issue
Block a user