decoder/mad: make "gapless_mp3_playback" a block option

Remove another dependency on the config/Global library.
This commit is contained in:
Max Kellermann
2018-07-18 10:50:09 +02:00
parent 49efb6071c
commit fd80683ade
7 changed files with 44 additions and 21 deletions

View File

@@ -56,8 +56,17 @@ MigrateCurlProxyConfig(ConfigData &config) noexcept
"proxy_password");
}
static void
MigrateMadConfig(ConfigData &config) noexcept
{
MigrateParamToBlockParam(config, ConfigOption::GAPLESS_MP3_PLAYBACK,
ConfigBlockOption::DECODER, "plugin", "mad",
"gapless");
}
void
Migrate(ConfigData &config) noexcept
{
MigrateCurlProxyConfig(config);
MigrateMadConfig(config);
}

View File

@@ -68,7 +68,7 @@ const ConfigTemplate config_param_templates[] = {
{ "id3v1_encoding", false, true },
{ "metadata_to_use" },
{ "save_absolute_paths_in_playlists" },
{ "gapless_mp3_playback" },
{ "gapless_mp3_playback", false, true },
{ "auto_update" },
{ "auto_update_depth" },
{ "despotify_user", false, true },

View File

@@ -21,7 +21,7 @@
#include "MadDecoderPlugin.hxx"
#include "../DecoderAPI.hxx"
#include "input/InputStream.hxx"
#include "config/Global.hxx"
#include "config/Block.hxx"
#include "tag/Id3Scan.hxx"
#include "tag/Rva2.hxx"
#include "tag/Handler.hxx"
@@ -107,10 +107,10 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
}
static bool
mp3_plugin_init(gcc_unused const ConfigBlock &block)
mp3_plugin_init(const ConfigBlock &block)
{
gapless_playback = config_get_bool(ConfigOption::GAPLESS_MP3_PLAYBACK,
DEFAULT_GAPLESS_MP3_PLAYBACK);
gapless_playback = block.GetBlockValue("gapless",
DEFAULT_GAPLESS_MP3_PLAYBACK);
return true;
}