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:
@@ -38,14 +38,14 @@ static constexpr Domain adplug_domain("adplug");
|
||||
static unsigned sample_rate;
|
||||
|
||||
static bool
|
||||
adplug_init(const config_param ¶m)
|
||||
adplug_init(const ConfigBlock &block)
|
||||
{
|
||||
FormatDebug(adplug_domain, "adplug %s",
|
||||
CAdPlug::get_version().c_str());
|
||||
|
||||
Error error;
|
||||
|
||||
sample_rate = param.GetBlockValue("sample_rate", 48000u);
|
||||
sample_rate = block.GetBlockValue("sample_rate", 48000u);
|
||||
if (!audio_check_sample_rate(sample_rate, error)) {
|
||||
LogError(error);
|
||||
return false;
|
||||
|
@@ -43,7 +43,7 @@ audiofile_error_func(long, const char *msg)
|
||||
}
|
||||
|
||||
static bool
|
||||
audiofile_init(const config_param &)
|
||||
audiofile_init(const ConfigBlock &)
|
||||
{
|
||||
afSetErrorHandler(audiofile_error_func);
|
||||
return true;
|
||||
|
@@ -72,9 +72,9 @@ struct DsdiffMetaData {
|
||||
static bool lsbitfirst;
|
||||
|
||||
static bool
|
||||
dsdiff_init(const config_param ¶m)
|
||||
dsdiff_init(const ConfigBlock &block)
|
||||
{
|
||||
lsbitfirst = param.GetBlockValue("lsbitfirst", false);
|
||||
lsbitfirst = block.GetBlockValue("lsbitfirst", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@ FfmpegOpenInput(AVIOContext *pb,
|
||||
}
|
||||
|
||||
static bool
|
||||
ffmpeg_init(gcc_unused const config_param ¶m)
|
||||
ffmpeg_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
FfmpegInit();
|
||||
return true;
|
||||
|
@@ -291,7 +291,7 @@ flac_decode(Decoder &decoder, InputStream &input_stream)
|
||||
}
|
||||
|
||||
static bool
|
||||
oggflac_init(gcc_unused const config_param ¶m)
|
||||
oggflac_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
return !!FLAC_API_SUPPORTS_OGG_FLAC;
|
||||
}
|
||||
|
@@ -73,17 +73,17 @@ fluidsynth_mpd_log_function(int level, char *message, gcc_unused void *data)
|
||||
}
|
||||
|
||||
static bool
|
||||
fluidsynth_init(const config_param ¶m)
|
||||
fluidsynth_init(const ConfigBlock &block)
|
||||
{
|
||||
Error error;
|
||||
|
||||
sample_rate = param.GetBlockValue("sample_rate", 48000u);
|
||||
sample_rate = block.GetBlockValue("sample_rate", 48000u);
|
||||
if (!audio_check_sample_rate(sample_rate, error)) {
|
||||
LogError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
soundfont_path = param.GetBlockValue("soundfont",
|
||||
soundfont_path = block.GetBlockValue("soundfont",
|
||||
"/usr/share/sounds/sf2/FluidR3_GM.sf2");
|
||||
|
||||
fluid_set_log_function(LAST_LOG_LEVEL,
|
||||
|
@@ -107,7 +107,7 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
|
||||
}
|
||||
|
||||
static bool
|
||||
mp3_plugin_init(gcc_unused const config_param ¶m)
|
||||
mp3_plugin_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
gapless_playback = config_get_bool(ConfigOption::GAPLESS_MP3_PLAYBACK,
|
||||
DEFAULT_GAPLESS_MP3_PLAYBACK);
|
||||
|
@@ -109,15 +109,15 @@ static bool mikmod_loop;
|
||||
static unsigned mikmod_sample_rate;
|
||||
|
||||
static bool
|
||||
mikmod_decoder_init(const config_param ¶m)
|
||||
mikmod_decoder_init(const ConfigBlock &block)
|
||||
{
|
||||
static char params[] = "";
|
||||
|
||||
mikmod_loop = param.GetBlockValue("loop", false);
|
||||
mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u);
|
||||
mikmod_loop = block.GetBlockValue("loop", false);
|
||||
mikmod_sample_rate = block.GetBlockValue("sample_rate", 44100u);
|
||||
if (!audio_valid_sample_rate(mikmod_sample_rate))
|
||||
FormatFatalError("Invalid sample rate in line %d: %u",
|
||||
param.line, mikmod_sample_rate);
|
||||
block.line, mikmod_sample_rate);
|
||||
|
||||
md_device = 0;
|
||||
md_reverb = 0;
|
||||
|
@@ -41,12 +41,12 @@ static constexpr offset_type MODPLUG_FILE_LIMIT = 100 * 1024 * 1024;
|
||||
static int modplug_loop_count;
|
||||
|
||||
static bool
|
||||
modplug_decoder_init(const config_param ¶m)
|
||||
modplug_decoder_init(const ConfigBlock &block)
|
||||
{
|
||||
modplug_loop_count = param.GetBlockValue("loop_count", 0);
|
||||
modplug_loop_count = block.GetBlockValue("loop_count", 0);
|
||||
if (modplug_loop_count < -1)
|
||||
FormatFatalError("Invalid loop count in line %d: %i",
|
||||
param.line, modplug_loop_count);
|
||||
block.line, modplug_loop_count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@
|
||||
static constexpr Domain mpg123_domain("mpg123");
|
||||
|
||||
static bool
|
||||
mpd_mpg123_init(gcc_unused const config_param ¶m)
|
||||
mpd_mpg123_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
mpg123_init();
|
||||
|
||||
|
@@ -61,7 +61,7 @@ IsOpusTags(const ogg_packet &packet)
|
||||
}
|
||||
|
||||
static bool
|
||||
mpd_opus_init(gcc_unused const config_param ¶m)
|
||||
mpd_opus_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
LogDebug(opus_domain, opus_get_version_string());
|
||||
|
||||
|
@@ -64,22 +64,22 @@ sidplay_load_songlength_db(const Path path)
|
||||
}
|
||||
|
||||
static bool
|
||||
sidplay_init(const config_param ¶m)
|
||||
sidplay_init(const ConfigBlock &block)
|
||||
{
|
||||
/* read the songlengths database file */
|
||||
Error error;
|
||||
const auto database_path = param.GetBlockPath("songlength_database", error);
|
||||
const auto database_path = block.GetBlockPath("songlength_database", error);
|
||||
if (!database_path.IsNull())
|
||||
songlength_database = sidplay_load_songlength_db(database_path);
|
||||
else if (error.IsDefined())
|
||||
FatalError(error);
|
||||
|
||||
default_songlength = param.GetBlockValue("default_songlength", 0u);
|
||||
default_songlength = block.GetBlockValue("default_songlength", 0u);
|
||||
|
||||
all_files_are_containers =
|
||||
param.GetBlockValue("all_files_are_containers", true);
|
||||
block.GetBlockValue("all_files_are_containers", true);
|
||||
|
||||
filter_setting = param.GetBlockValue("filter", true);
|
||||
filter_setting = block.GetBlockValue("filter", true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@
|
||||
static constexpr Domain sndfile_domain("sndfile");
|
||||
|
||||
static bool
|
||||
sndfile_init(gcc_unused const config_param ¶m)
|
||||
sndfile_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
LogDebug(sndfile_domain, sf_version_string());
|
||||
return true;
|
||||
|
@@ -194,7 +194,7 @@ vorbis_interleave(float *dest, const float *const*src,
|
||||
/* public */
|
||||
|
||||
static bool
|
||||
vorbis_init(gcc_unused const config_param ¶m)
|
||||
vorbis_init(gcc_unused const ConfigBlock &block)
|
||||
{
|
||||
#ifndef HAVE_TREMOR
|
||||
LogDebug(vorbis_domain, vorbis_version_string());
|
||||
|
@@ -38,11 +38,11 @@ static constexpr Domain wildmidi_domain("wildmidi");
|
||||
static constexpr unsigned WILDMIDI_SAMPLE_RATE = 48000;
|
||||
|
||||
static bool
|
||||
wildmidi_init(const config_param ¶m)
|
||||
wildmidi_init(const ConfigBlock &block)
|
||||
{
|
||||
Error error;
|
||||
const AllocatedPath path =
|
||||
param.GetBlockPath("config_file",
|
||||
block.GetBlockPath("config_file",
|
||||
"/etc/timidity/timidity.cfg",
|
||||
error);
|
||||
if (path.IsNull())
|
||||
|
Reference in New Issue
Block a user