From 8fcb6e148f71380f54233c0f7b153afb95ee1dde Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Jan 2025 15:35:53 +0100 Subject: [PATCH] decoder/list: probe "ffmpeg" before "sndfile" and "audiofile" For FFmpeg's DTS-WAV support, see code comment. Closes https://github.com/MusicPlayerDaemon/MPD/issues/2158 --- NEWS | 2 ++ src/decoder/DecoderList.cxx | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 75ce69e6d..123e5e886 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ ver 0.23.17 (not yet released) - nfs: require libnfs 4.0 or later * database - inotify: trigger update after symlink was created +* decoder + - ffmpeg: prefer over sndfile and audiofile for its DTS-WAV support * support libfmt 11.1 ver 0.23.16 (2024/12/03) diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index 965380089..0504365b6 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -73,12 +73,6 @@ constexpr const struct DecoderPlugin *decoder_plugins[] = { #ifdef ENABLE_OPUS &opus_decoder_plugin, #endif -#ifdef ENABLE_SNDFILE - &sndfile_decoder_plugin, -#endif -#ifdef ENABLE_AUDIOFILE - &audiofile_decoder_plugin, -#endif #ifdef ENABLE_DSD &dsdiff_decoder_plugin, &dsf_decoder_plugin, @@ -120,6 +114,19 @@ constexpr const struct DecoderPlugin *decoder_plugins[] = { #ifdef ENABLE_FFMPEG &ffmpeg_decoder_plugin, #endif + + /* these WAV-decoding plugins are below ffmpeg_decoder_plugin + to give FFmpeg a chance to decode DTS-WAV files which is + technically DTS Coherent Acoustics (DCA) stream wrapped in + fake 16-bit stereo samples; neither libsndfile nor + libaudiofile detect this, but FFmpeg does */ +#ifdef ENABLE_SNDFILE + &sndfile_decoder_plugin, +#endif +#ifdef ENABLE_AUDIOFILE + &audiofile_decoder_plugin, +#endif + &pcm_decoder_plugin, nullptr };