1
mirror of https://github.com/mpv-player/mpv synced 2024-11-07 01:47:00 +01:00

lavfi: temporary workaround for FFmpeg av_buffersrc_parameters_set() bug

The function ignores AVBufferSrcParameters.channel_layout. Set it
manually using the API.
This commit is contained in:
wm4 2017-02-22 10:42:36 +01:00
parent c824a023c4
commit 992e582488

View File

@ -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)