Files
telephony/net/freeswitch/patches/066-04-mod_av-Add-support-for-FFmpeg-7.1.patch
Christian Marangi 40dcae69ef freeswitch: backport mod_av patch for FFmpeg 6.0+ support
Backport mod_av patch for FFmpeg 6.0+ support to fix compilation error
on x86 target.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-12-04 16:47:44 +01:00

34 lines
1.3 KiB
Diff

From 066b92c5894b07a4879a26a9f6a1cdcf59e016ea Mon Sep 17 00:00:00 2001
From: Andrey Volk <andywolk@gmail.com>
Date: Fri, 11 Jul 2025 13:39:48 +0300
Subject: [PATCH 4/4] [mod_av] Add support for FFmpeg 7.1
---
src/mod/applications/mod_av/avformat.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/src/mod/applications/mod_av/avformat.c
+++ b/src/mod/applications/mod_av/avformat.c
@@ -557,7 +557,21 @@ static switch_status_t add_stream(av_fil
switch ((*codec)->type) {
case AVMEDIA_TYPE_AUDIO:
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 13, 100)
+ /*
+ Changelog says 61.12.100 but commit changes version actually to 61.13.100
+ https://github.com/FFmpeg/FFmpeg/commit/3305767560a6303f474fffa3afb10c500059b455
+ */
+ {
+ const enum AVSampleFormat *sample_fmts = NULL;
+ int fmts_count = 0;
+ int ret = avcodec_get_supported_config(c, *codec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, (const void**)&sample_fmts, &fmts_count);
+
+ c->sample_fmt = (ret >= 0 && fmts_count && sample_fmts) ? sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
+ }
+#else
c->sample_fmt = (*codec)->sample_fmts ? (*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
+#endif
c->bit_rate = 128000;
c->sample_rate = mst->sample_rate = context->handle->samplerate;
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)