filter/ffmpeg: support double-precision samples

Insert an "aformat" filter which converts double-precision to
single-precision.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1235
This commit is contained in:
Max Kellermann
2021-08-24 13:42:00 +02:00
parent b5b40d8235
commit 8439119e24
4 changed files with 26 additions and 1 deletions

View File

@@ -81,7 +81,16 @@ PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)
auto &buffer_sink = Ffmpeg::MakeAudioBufferSink(*graph);
graph.ParseSingleInOut(graph_string, buffer_sink, buffer_src);
/* if the filter's output format is not supported by MPD, this
"aformat" filter is inserted at the end and takes care for
the required conversion */
auto &aformat = Ffmpeg::MakeAutoAformat(*graph);
int error = avfilter_link(&aformat, 0, &buffer_sink, 0);
if (error < 0)
throw MakeFfmpegError(error, "avfilter_link() failed");
graph.ParseSingleInOut(graph_string, aformat, buffer_src);
graph.CheckAndConfigure();
const auto out_audio_format =