From 3e71220efcc11afaedb33a1cb2c9d3cd2cb50228 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Mon, 7 Nov 2022 17:44:14 +0100 Subject: Fix support for building with ffmpeg < 5.0 Seems like the new audio channel api was not as backwards compatible as we thought. Therefore we need to reintroduce the usage of the old api to make older ffmpeg version be able to compile Blender. This change is only intended to stick around for two releases or so. After that we hope that most Linux distros ship ffmpeg >=5.0 so we can switch to it. Reviewed By: Sergey Differential Revision: http://developer.blender.org/D16408 --- intern/ffmpeg/tests/ffmpeg_codecs.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'intern/ffmpeg/tests') diff --git a/intern/ffmpeg/tests/ffmpeg_codecs.cc b/intern/ffmpeg/tests/ffmpeg_codecs.cc index 10cbe4b938b..cd06917f59b 100644 --- a/intern/ffmpeg/tests/ffmpeg_codecs.cc +++ b/intern/ffmpeg/tests/ffmpeg_codecs.cc @@ -3,6 +3,8 @@ #include "testing/testing.h" extern "C" { +#include "ffmpeg_compat.h" + #include #include #include @@ -40,7 +42,11 @@ bool test_acodec(const AVCodec *codec, AVSampleFormat fmt) if (ctx) { ctx->sample_fmt = fmt; ctx->sample_rate = 48000; +#ifdef FFMPEG_USE_OLD_CHANNEL_VARS + ctx->channel_layout = AV_CH_LAYOUT_MONO; +#else av_channel_layout_from_mask(&ctx->ch_layout, AV_CH_LAYOUT_MONO); +#endif ctx->bit_rate = 128000; int open = avcodec_open2(ctx, codec, NULL); if (open >= 0) { -- cgit v1.2.3