summaryrefslogtreecommitdiffstats
path: root/player/lavfi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-22 10:42:36 +0100
committerwm4 <wm4@nowhere>2017-02-22 10:43:35 +0100
commit992e58248867bacc195e7a3a2a7fff04cf8f097e (patch)
treedd132103e00a6c842a0bad717c99e60dde8e48ee /player/lavfi.c
parentc824a023c4f640dd72d4c5dc1511eb53055d7535 (diff)
downloadmpv-992e58248867bacc195e7a3a2a7fff04cf8f097e.tar.bz2
mpv-992e58248867bacc195e7a3a2a7fff04cf8f097e.tar.xz
lavfi: temporary workaround for FFmpeg av_buffersrc_parameters_set() bug
The function ignores AVBufferSrcParameters.channel_layout. Set it manually using the API.
Diffstat (limited to 'player/lavfi.c')
-rw-r--r--player/lavfi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/player/lavfi.c b/player/lavfi.c
index 2573a92833..5183b0e690 100644
--- a/player/lavfi.c
+++ b/player/lavfi.c
@@ -28,6 +28,7 @@
#include <libavutil/mathematics.h>
#include <libavutil/rational.h>
#include <libavutil/error.h>
+#include <libavutil/opt.h>
#include <libavfilter/avfilter.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
@@ -444,6 +445,14 @@ static bool init_pads(struct lavfi *c)
goto error;
}
+ if (pad->type == STREAM_AUDIO) {
+ char layout[80];
+ snprintf(layout, sizeof(layout), "%lld",
+ (long long)params->channel_layout);
+ av_opt_set(pad->buffer, "channel_layout", layout,
+ AV_OPT_SEARCH_CHILDREN);
+ }
+
int ret = av_buffersrc_parameters_set(pad->buffer, params);
av_free(params);
if (ret < 0)