summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-11-04 20:08:48 +0100
committerMax Kellermann <max@musicpd.org>2020-11-04 20:15:19 +0100
commit226eb263001ebaa6bdaa3ca1c8087abf0d06e6e3 (patch)
tree81eede046dcb7fbc8307742e1d7def1ac93bb92c
parent2d606fa9895f195bb17db513fe1b467bfd5d498b (diff)
filter/ffmpeg: interleave the output AVFrame
If the FFmpeg filter outputs planar data, interleave it, just like the FFmpeg decoder plugin does.
-rw-r--r--NEWS1
-rw-r--r--src/filter/plugins/FfmpegFilter.cxx3
-rw-r--r--src/filter/plugins/FfmpegFilter.hxx3
3 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 756259edc..46c7d8324 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ ver 0.22.3 (not yet released)
- add option "as_directory", making CUE file expansion optional
* filter
- fix garbage after "Audio format not supported by filter" message
+ - ffmpeg: support planar output
ver 0.22.2 (2020/10/28)
* database
diff --git a/src/filter/plugins/FfmpegFilter.cxx b/src/filter/plugins/FfmpegFilter.cxx
index 1b841833a..cd076200b 100644
--- a/src/filter/plugins/FfmpegFilter.cxx
+++ b/src/filter/plugins/FfmpegFilter.cxx
@@ -18,6 +18,7 @@
*/
#include "FfmpegFilter.hxx"
+#include "lib/ffmpeg/Interleave.hxx"
#include "lib/ffmpeg/SampleFormat.hxx"
#include "util/ConstBuffer.hxx"
@@ -79,5 +80,5 @@ FfmpegFilter::FilterPCM(ConstBuffer<void> src)
/* TODO: call av_buffersink_get_frame() repeatedly? Not
possible with MPD's current Filter API */
- return {frame.GetData(0), frame->nb_samples * GetOutAudioFormat().GetFrameSize()};
+ return Ffmpeg::InterleaveFrame(*frame, interleave_buffer);
}
diff --git a/src/filter/plugins/FfmpegFilter.hxx b/src/filter/plugins/FfmpegFilter.hxx
index 8a048cffc..286780d9d 100644
--- a/src/filter/plugins/FfmpegFilter.hxx
+++ b/src/filter/plugins/FfmpegFilter.hxx
@@ -21,6 +21,7 @@
#define MPD_FFMPEG_FILTER__HXX
#include "filter/Filter.hxx"
+#include "lib/ffmpeg/Buffer.hxx"
#include "lib/ffmpeg/Filter.hxx"
#include "lib/ffmpeg/Frame.hxx"
@@ -32,6 +33,8 @@ class FfmpegFilter final : public Filter {
Ffmpeg::FilterContext buffer_src, buffer_sink;
Ffmpeg::Frame frame;
+ FfmpegBuffer interleave_buffer;
+
const int in_format, in_sample_rate, in_channels;
const size_t in_audio_frame_size;