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
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user