decoder/mad: remove option "gapless", always do gapless

Why would anybody want to keep the silence inserted by the codec?
Other plugins/codecs (such as Vorbis) have this hard-coded as well.
This commit is contained in:
Max Kellermann 2019-08-12 13:05:57 +02:00
parent d640961420
commit 831bc711ca
4 changed files with 2 additions and 32 deletions

1
NEWS
View File

@ -10,6 +10,7 @@ ver 0.22 (not yet released)
* archive * archive
- iso9660: support seeking - iso9660: support seeking
* decoder * decoder
- mad: remove option "gapless", always do gapless
- sidplay: add option "default_genre" - sidplay: add option "default_genre"
- sidplay: map SID name field to "Album" tag - sidplay: map SID name field to "Album" tag
* filter * filter

View File

@ -406,15 +406,6 @@ plugin should be enabled only if you have a bit-perfect playback path
to a DSD-capable DAC; for everybody else, playing back the ALAC copy to a DSD-capable DAC; for everybody else, playing back the ALAC copy
of the file is better. of the file is better.
.. list-table::
:widths: 20 80
:header-rows: 1
* - Setting
- Description
* - **gapless yes|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 <http://www.willwap.co.uk/Programs/vbrfix.php>`_ instead of disabling gapless MP3 playback. The default is to support gapless MP3 playback.
mad mad
--- ---

View File

@ -55,17 +55,8 @@ 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

@ -62,12 +62,8 @@ enum class MadDecoderMuteFrame {
/* the number of samples of silence the decoder inserts at start */ /* the number of samples of silence the decoder inserts at start */
static constexpr unsigned DECODERDELAY = 529; static constexpr unsigned DECODERDELAY = 529;
static constexpr bool DEFAULT_GAPLESS_MP3_PLAYBACK = true;
static constexpr Domain mad_domain("mad"); static constexpr Domain mad_domain("mad");
static bool gapless_playback;
gcc_const gcc_const
static SongTime static SongTime
ToSongTime(mad_timer_t t) noexcept ToSongTime(mad_timer_t t) noexcept
@ -100,14 +96,6 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_pcm &src,
*dest++ = mad_fixed_to_24_sample(src.samples[c][i]); *dest++ = mad_fixed_to_24_sample(src.samples[c][i]);
} }
static bool
mad_plugin_init(const ConfigBlock &block)
{
gapless_playback = block.GetBlockValue("gapless",
DEFAULT_GAPLESS_MP3_PLAYBACK);
return true;
}
class MadDecoder { class MadDecoder {
static constexpr size_t READ_BUFFER_SIZE = 40960; static constexpr size_t READ_BUFFER_SIZE = 40960;
@ -735,7 +723,7 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept
struct lame lame; struct lame lame;
if (parse_lame(&lame, &ptr, &bitlen)) { if (parse_lame(&lame, &ptr, &bitlen)) {
if (gapless_playback && input_stream.IsSeekable()) { if (input_stream.IsSeekable()) {
/* libmad inserts 529 samples of /* libmad inserts 529 samples of
silence at the beginning and silence at the beginning and
removes those 529 samples at the removes those 529 samples at the
@ -1030,6 +1018,5 @@ static const char *const mad_mime_types[] = { "audio/mpeg", nullptr };
constexpr DecoderPlugin mad_decoder_plugin = constexpr DecoderPlugin mad_decoder_plugin =
DecoderPlugin("mad", mad_decode, mad_decoder_scan_stream) DecoderPlugin("mad", mad_decode, mad_decoder_scan_stream)
.WithInit(mad_plugin_init)
.WithSuffixes(mad_suffixes) .WithSuffixes(mad_suffixes)
.WithMimeTypes(mad_mime_types); .WithMimeTypes(mad_mime_types);