package/freerdp: fix build with ffmpeg 8.0

Added four upstream patches backported from FreeRDP 3.x.

The remaining build error:

/home/bernd/buildroot/output/build/freerdp-2.11.7-18-g0ee17e2f8e49d56ab5b90d5160fa8f87ffc445e0/
 channels/client/tables.c:129:22:
 error: initialization of ‘UINT (*)(void)’ {aka ‘unsigned int (*)(void)’}
 from incompatible pointer type ‘UINT (*)(void *)’ {aka ‘unsigned int (*)(void *)’}
 [-Wincompatible-pointer-types]
  129 |         { "oss", "", oss_freerdp_rdpsnd_client_subsystem_entry },

is fixed by adding -Wno-incompatible-pointer-types to CFLAGS due to
tables.c being dynamically created during the build and backporting the
supposed upstream fix
fe6d861a5c
is too invasive.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Bernd Kuhls
2026-01-06 20:30:14 +01:00
committed by Thomas Petazzoni
parent c8e0ccce0a
commit 5cb9002e81
5 changed files with 258 additions and 1 deletions

View File

@@ -0,0 +1,146 @@
From 83bda60872d2f8f4230de53a645112d8239b67ba Mon Sep 17 00:00:00 2001
From: Armin Novak <armin.novak@thincast.com>
Date: Wed, 7 Jun 2023 11:46:07 +0200
Subject: [PATCH] fix ffmpeg deprecations
Upstream: https://github.com/FreeRDP/FreeRDP/commit/d0c5b1ae4289c7f3cde3fbc031cb4a3160df05ff
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
libfreerdp/codec/dsp_ffmpeg.c | 54 +++++++++++++++++++++++++++--------
1 file changed, 42 insertions(+), 12 deletions(-)
diff --git a/libfreerdp/codec/dsp_ffmpeg.c b/libfreerdp/codec/dsp_ffmpeg.c
index 80df18833..22d6ce215 100644
--- a/libfreerdp/codec/dsp_ffmpeg.c
+++ b/libfreerdp/codec/dsp_ffmpeg.c
@@ -225,18 +225,17 @@ static void ffmpeg_close_context(FREERDP_DSP_CONTEXT* context)
static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
{
int ret;
- int layout;
- const AUDIO_FORMAT* format;
if (!context || context->isOpen)
return FALSE;
- format = &context->format;
+ const AUDIO_FORMAT* format = &context->format;
if (!format)
return FALSE;
-
- layout = av_get_default_channel_layout(format->nChannels);
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
+ const int layout = av_get_default_channel_layout(format->nChannels);
+#endif
context->id = ffmpeg_get_avcodec(format);
if (ffmpeg_codec_is_filtered(context->id, context->encoder))
@@ -270,8 +269,12 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
break;
}
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
context->context->channels = format->nChannels;
context->context->channel_layout = layout;
+#else
+ av_channel_layout_default(&context->context->ch_layout, format->nChannels);
+#endif
context->context->sample_rate = format->nSamplesPerSec;
context->context->block_align = format->nBlockAlign;
context->context->bit_rate = format->nAvgBytesPerSec * 8;
@@ -314,8 +317,12 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
if (!context->rcontext)
goto fail;
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
context->frame->channel_layout = layout;
context->frame->channels = format->nChannels;
+#else
+ av_channel_layout_default(&context->frame->ch_layout, format->nChannels);
+#endif
context->frame->sample_rate = format->nSamplesPerSec;
context->frame->format = AV_SAMPLE_FMT_S16;
@@ -330,13 +337,21 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
context->resampled->sample_rate = format->nSamplesPerSec;
}
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
context->resampled->channel_layout = layout;
context->resampled->channels = format->nChannels;
+#else
+ av_channel_layout_default(&context->resampled->ch_layout, format->nChannels);
+#endif
if (context->context->frame_size > 0)
{
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
context->buffered->channel_layout = context->resampled->channel_layout;
context->buffered->channels = context->resampled->channels;
+#else
+ av_channel_layout_copy(&context->buffered->ch_layout, &context->resampled->ch_layout);
+#endif
context->buffered->format = context->resampled->format;
context->buffered->nb_samples = context->context->frame_size;
@@ -477,14 +492,20 @@ static BOOL ffmpeg_fill_frame(AVFrame* frame, const AUDIO_FORMAT* inputFormat, c
size_t size)
{
int ret, bpp;
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
frame->channels = inputFormat->nChannels;
+ frame->channel_layout = av_get_default_channel_layout(frame->channels);
+#else
+ av_channel_layout_default(&frame->ch_layout, inputFormat->nChannels);
+#endif
frame->sample_rate = inputFormat->nSamplesPerSec;
frame->format = ffmpeg_sample_format(inputFormat);
- frame->channel_layout = av_get_default_channel_layout(frame->channels);
+
bpp = av_get_bytes_per_sample(frame->format);
frame->nb_samples = size / inputFormat->nChannels / bpp;
- if ((ret = avcodec_fill_audio_frame(frame, frame->channels, frame->format, data, size, 1)) < 0)
+ if ((ret = avcodec_fill_audio_frame(frame, inputFormat->nChannels, frame->format, data, size,
+ 1)) < 0)
{
const char* err = av_err2str(ret);
WLog_ERR(TAG, "Error during audio frame fill %s [%d]", err, ret);
@@ -566,7 +587,12 @@ static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVPacket* pkt, AVFrame* frame
}
{
- const size_t data_size = resampled->channels * resampled->nb_samples * 2;
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
+ const size_t channels = resampled->channels;
+#else
+ const size_t channels = resampled->ch_layout.nb_channels;
+#endif
+ const size_t data_size = channels * resampled->nb_samples * 2;
Stream_EnsureRemainingCapacity(out, data_size);
Stream_Write(out, resampled->data[0], data_size);
}
@@ -661,10 +687,14 @@ BOOL freerdp_dsp_ffmpeg_encode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT*
if (inSamples + (int)context->bufferedSamples > context->context->frame_size)
inSamples = context->context->frame_size - (int)context->bufferedSamples;
- rc =
- av_samples_copy(context->buffered->extended_data, context->resampled->extended_data,
- (int)context->bufferedSamples, copied, inSamples,
- context->context->channels, context->context->sample_fmt);
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
+ const int channels = context->context->channels;
+#else
+ const int channels = context->context->ch_layout.nb_channels;
+#endif
+ rc = av_samples_copy(context->buffered->extended_data,
+ context->resampled->extended_data, (int)context->bufferedSamples,
+ copied, inSamples, channels, context->context->sample_fmt);
rest -= inSamples;
copied += inSamples;
context->bufferedSamples += (UINT32)inSamples;
--
2.47.3

View File

@@ -0,0 +1,34 @@
From 83ba6817093ad1546053878c2e720d13f29f9126 Mon Sep 17 00:00:00 2001
From: Armin Novak <anovak@thincast.com>
Date: Fri, 24 Nov 2023 19:40:52 +0100
Subject: [PATCH] fix ffmpeg deprecation warning
Upstream: https://github.com/FreeRDP/FreeRDP/commit/1ef7b9e3e06ef69e5145c6f11cc330078abaa9ea
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
libfreerdp/codec/dsp_ffmpeg.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libfreerdp/codec/dsp_ffmpeg.c b/libfreerdp/codec/dsp_ffmpeg.c
index 22d6ce215..5c89af6b1 100644
--- a/libfreerdp/codec/dsp_ffmpeg.c
+++ b/libfreerdp/codec/dsp_ffmpeg.c
@@ -436,7 +436,13 @@ static BOOL ffmpeg_encode_frame(AVCodecContext* context, AVFrame* in, AVPacket*
if (in->format == AV_SAMPLE_FMT_FLTP)
{
uint8_t** pp = in->extended_data;
- for (int y = 0; y < in->channels; y++)
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
+ const int nr_channels = in->channels;
+#else
+ const int nr_channels = in->ch_layout.nb_channels;
+#endif
+
+ for (int y = 0; y < nr_channels; y++)
{
float* data = (float*)pp[y];
for (int x = 0; x < in->nb_samples; x++)
--
2.47.3

View File

@@ -0,0 +1,31 @@
From 9360089dfbcb6ee97a6b8f40c85f61e4108c80e4 Mon Sep 17 00:00:00 2001
From: endlesseden <endlesseden@users.noreply.github.com>
Date: Tue, 29 Apr 2025 16:11:03 +1000
Subject: [PATCH] FF_PROFILE Depreciation Fix
Upstream: https://github.com/FreeRDP/FreeRDP/commit/af45cb37e3b2d81a11637c4b2dfe82e8947c41ea
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
libfreerdp/codec/dsp_ffmpeg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libfreerdp/codec/dsp_ffmpeg.c b/libfreerdp/codec/dsp_ffmpeg.c
index 5c89af6b1..8955e894d 100644
--- a/libfreerdp/codec/dsp_ffmpeg.c
+++ b/libfreerdp/codec/dsp_ffmpeg.c
@@ -262,7 +262,11 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
break;
case AV_CODEC_ID_AAC:
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
context->context->profile = FF_PROFILE_AAC_MAIN;
+#else
+ context->context->profile = AV_PROFILE_AAC_MAIN;
+#endif
break;
default:
--
2.47.3

View File

@@ -0,0 +1,44 @@
From dcc8f415866e348ae86cfe85fde3c2d9285a7208 Mon Sep 17 00:00:00 2001
From: akallabeth <akallabeth@posteo.net>
Date: Tue, 28 Jan 2025 20:25:17 +0100
Subject: [PATCH] ignore EAGAIN for FFMPEG
Upstream: https://github.com/FreeRDP/FreeRDP/commit/726add2a982bfdf4cffef3cc95395c9a4b49385b
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[partially backported to stable-2.0 branch]
---
libfreerdp/codec/h264_ffmpeg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libfreerdp/codec/h264_ffmpeg.c b/libfreerdp/codec/h264_ffmpeg.c
index 9c445b825..da6bed08e 100644
--- a/libfreerdp/codec/h264_ffmpeg.c
+++ b/libfreerdp/codec/h264_ffmpeg.c
@@ -100,10 +100,10 @@ static void libavcodec_destroy_encoder(H264_CONTEXT* h264)
if (sys->codecEncoderContext)
{
- avcodec_close(sys->codecEncoderContext);
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)
avcodec_free_context(&sys->codecEncoderContext);
#else
+ avcodec_close(sys->codecEncoderContext);
av_free(sys->codecEncoderContext);
#endif
}
@@ -430,10 +430,10 @@ static void libavcodec_uninit(H264_CONTEXT* h264)
if (sys->codecDecoderContext)
{
- avcodec_close(sys->codecDecoderContext);
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 69, 100)
avcodec_free_context(&sys->codecDecoderContext);
#else
+ avcodec_close(sys->codecDecoderContext);
av_free(sys->codecDecoderContext);
#endif
}
--
2.47.3

View File

@@ -15,7 +15,9 @@ FREERDP_CPE_ID_VENDOR = freerdp
FREERDP_INSTALL_STAGING = YES
FREERDP_CONF_OPTS = -DWITH_MANPAGES=OFF -Wno-dev -DWITH_GSTREAMER_0_10=OFF
FREERDP_CONF_OPTS = \
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -Wno-incompatible-pointer-types" \
-DWITH_MANPAGES=OFF -Wno-dev -DWITH_GSTREAMER_0_10=OFF
ifeq ($(BR2_PACKAGE_FREERDP_GSTREAMER1),y)
FREERDP_CONF_OPTS += -DWITH_GSTREAMER_1_0=ON