From 992e58248867bacc195e7a3a2a7fff04cf8f097e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 22 Feb 2017 10:42:36 +0100 Subject: [PATCH] lavfi: temporary workaround for FFmpeg av_buffersrc_parameters_set() bug The function ignores AVBufferSrcParameters.channel_layout. Set it manually using the API. --- player/lavfi.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 #include #include +#include #include #include #include @@ -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)