summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-07-18 10:50:09 +0200
committerMax Kellermann <max@musicpd.org>2018-07-18 10:50:09 +0200
commitfd80683ade480d6417d66d0fc882b598738002f8 (patch)
treec16065c8fb2cd2b79c5b1e8f1b01d4fdfd12dfd3
parent49efb6071cbb42384ba8abb7a4696a375c1f8f36 (diff)
decoder/mad: make "gapless_mp3_playback" a block option
Remove another dependency on the config/Global library.
-rw-r--r--NEWS1
-rw-r--r--doc/mpd.conf.58
-rw-r--r--doc/mpdconf.example8
-rw-r--r--doc/user.xml29
-rw-r--r--src/config/Migrate.cxx9
-rw-r--r--src/config/Templates.cxx2
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx8
7 files changed, 44 insertions, 21 deletions
diff --git a/NEWS b/NEWS
index 817824d2e..e586519e3 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ ver 0.21 (not yet released)
* decoder
- gme: try loading m3u sidecar files
- hybrid_dsd: new decoder plugin
+ - mad: move "gapless_mp3_playback" setting to "decoder" block
- pcm: support audio/L24 (RFC 3190)
* resampler
- soxr: flush resampler at end of song
diff --git a/doc/mpd.conf.5 b/doc/mpd.conf.5
index 787394774..74cfd5b48 100644
--- a/doc/mpd.conf.5
+++ b/doc/mpd.conf.5
@@ -127,14 +127,6 @@ This specifies the character set used for the filesystem. A list of supported
character sets can be obtained by running "iconv \-l". The default is
determined from the locale when the db was originally created.
.TP
-.B gapless_mp3_playback <yes or no>
-This specifies whether to support gapless playback of MP3s which have the
-necessary headers. Useful if your MP3s have headers with incorrect
-information. If you have such MP3s, it is highly recommended that you fix them
-using vbrfix (available from <http://www.willwap.co.uk/Programs/vbrfix.php>)
-instead of disabling gapless MP3 playback. The default is to support gapless
-MP3 playback.
-.TP
.B save_absolute_paths_in_playlists <yes or no>
This specifies whether relative or absolute paths for song filenames are used
when saving playlists. The default is "no".
diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index 504ecd825..4684c7c37 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -96,14 +96,6 @@
#
#log_level "default"
#
-# If you have a problem with your MP3s ending abruptly it is recommended that
-# you set this argument to "no" to attempt to fix the problem. If this solves
-# the problem, it is highly recommended to fix the MP3 files with vbrfix
-# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
-# point gapless MP3 playback can be enabled.
-#
-#gapless_mp3_playback "yes"
-#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
diff --git a/doc/user.xml b/doc/user.xml
index 57200c267..dad61f286 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -3068,6 +3068,35 @@ run</programlisting>
playback path to a DSD-capable DAC; for everybody else,
playing back the ALAC copy of the file is better.
</para>
+
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Setting</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <varname>gapless</varname>
+ <parameter>yes|no</parameter>
+ </entry>
+ <entry>
+ This specifies whether to support gapless playback
+ of MP3s which have the necessary headers. Useful if
+ your MP3s have headers with incorrect information.
+ If you have such MP3s, it is highly recommended that
+ you fix them using <ulink
+ url="http://www.willwap.co.uk/Programs/vbrfix.php"><application>vbrfix</application></ulink>
+ instead of disabling gapless MP3 playback. The
+ default is to support gapless MP3 playback.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</section>
<section id="mad_decoder">
diff --git a/src/config/Migrate.cxx b/src/config/Migrate.cxx
index 9c1ebf7df..fa401dd2d 100644
--- a/src/config/Migrate.cxx
+++ b/src/config/Migrate.cxx
@@ -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);
}
diff --git a/src/config/Templates.cxx b/src/config/Templates.cxx
index f09321a74..3c2d78aae 100644
--- a/src/config/Templates.cxx
+++ b/src/config/Templates.cxx
@@ -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 },
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index 65c840424..4ad0efc0d 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -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;
}