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

1
NEWS
View File

@ -18,6 +18,7 @@ ver 0.21 (not yet released)
* decoder * decoder
- gme: try loading m3u sidecar files - gme: try loading m3u sidecar files
- hybrid_dsd: new decoder plugin - hybrid_dsd: new decoder plugin
- mad: move "gapless_mp3_playback" setting to "decoder" block
- pcm: support audio/L24 (RFC 3190) - pcm: support audio/L24 (RFC 3190)
* resampler * resampler
- soxr: flush resampler at end of song - soxr: flush resampler at end of song

View File

@ -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 character sets can be obtained by running "iconv \-l". The default is
determined from the locale when the db was originally created. determined from the locale when the db was originally created.
.TP .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> .B save_absolute_paths_in_playlists <yes or no>
This specifies whether relative or absolute paths for song filenames are used This specifies whether relative or absolute paths for song filenames are used
when saving playlists. The default is "no". when saving playlists. The default is "no".

View File

@ -96,14 +96,6 @@
# #
#log_level "default" #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 # Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup. # of starting playback after startup.
# #

View File

@ -3068,6 +3068,35 @@ run</programlisting>
playback path to a DSD-capable DAC; for everybody else, playback path to a DSD-capable DAC; for everybody else,
playing back the ALAC copy of the file is better. playing back the ALAC copy of the file is better.
</para> </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>
<section id="mad_decoder"> <section id="mad_decoder">

View File

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

View File

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

View File

@ -21,7 +21,7 @@
#include "MadDecoderPlugin.hxx" #include "MadDecoderPlugin.hxx"
#include "../DecoderAPI.hxx" #include "../DecoderAPI.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "config/Global.hxx" #include "config/Block.hxx"
#include "tag/Id3Scan.hxx" #include "tag/Id3Scan.hxx"
#include "tag/Rva2.hxx" #include "tag/Rva2.hxx"
#include "tag/Handler.hxx" #include "tag/Handler.hxx"
@ -107,10 +107,10 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
} }
static bool 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, gapless_playback = block.GetBlockValue("gapless",
DEFAULT_GAPLESS_MP3_PLAYBACK); DEFAULT_GAPLESS_MP3_PLAYBACK);
return true; return true;
} }