summaryrefslogtreecommitdiff
path: root/src/filter
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-11-16 09:08:27 +0100
committerMax Kellermann <max@musicpd.org>2020-11-16 09:39:34 +0100
commit38b41fc3fdc11300296809c08313eca0d6698f76 (patch)
tree9eaf66168cfbc1c15b647db29de219a113b80e35 /src/filter
parent394f69bee16c567e13b2fbcd371614191ae0a8c3 (diff)
filter/ffmpeg: detect the output sample format
Some FFmpeg filters change the sample format, and since MPD assumes this never happens, this results in loud noise instead of music. This commit finally implements the TODO comment by sending one frame of silence to the filter and checking the output frame's format. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1009
Diffstat (limited to 'src/filter')
-rw-r--r--src/filter/plugins/FfmpegFilterPlugin.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/filter/plugins/FfmpegFilterPlugin.cxx b/src/filter/plugins/FfmpegFilterPlugin.cxx
index 168ff52bf..fcb255be0 100644
--- a/src/filter/plugins/FfmpegFilterPlugin.cxx
+++ b/src/filter/plugins/FfmpegFilterPlugin.cxx
@@ -23,6 +23,7 @@
#include "filter/Filter.hxx"
#include "filter/Prepared.hxx"
#include "lib/ffmpeg/Filter.hxx"
+#include "lib/ffmpeg/DetectFilterFormat.hxx"
#include "config/Block.hxx"
class PreparedFfmpegFilter final : public PreparedFilter {
@@ -60,7 +61,9 @@ PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)
graph.CheckAndConfigure();
- auto out_audio_format = in_audio_format; // TODO
+ const auto out_audio_format =
+ Ffmpeg::DetectFilterOutputFormat(in_audio_format, *buffer_src,
+ *buffer_sink);
return std::make_unique<FfmpegFilter>(in_audio_format,
out_audio_format,