[new_pkg] freerdp2

This commit is contained in:
Developer 2024-06-21 20:34:08 -04:00
parent 298a1e2a96
commit 214b7ab593
3 changed files with 293 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 1ef7b9e3e06ef69e5145c6f11cc330078abaa9ea Mon Sep 17 00:00:00 2001
From: Armin Novak <anovak@thincast.com>
Date: Fri, 24 Nov 2023 19:40:52 +0100
Subject: [PATCH] [codec,dsp] fix ffmpeg deprecation warning
---
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 c5c30fb89ed2..c929b3c553a2 100644
--- a/libfreerdp/codec/dsp_ffmpeg.c
+++ b/libfreerdp/codec/dsp_ffmpeg.c
@@ -439,7 +439,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 = pp[y];
for (int x = 0; x < in->nb_samples; x++)

125
main/freerdp2/PKGBUILD Normal file
View File

@ -0,0 +1,125 @@
# Packager = Developer <dev@tuxcore.org>
_name=FreeRDP
pkgname=freerdp2
pkgver=2.11.5
pkgrel=3
pkgdesc="Free implementation of the Remote Desktop Protocol (RDP)"
arch=(x86_64)
url="https://www.freerdp.com/"
license=(Apache-2.0)
depends=(
glibc
libcups
libx11
libxcursor
libxext
libxdamage
libxfixes
libxkbcommon
libxi
libxinerama
libxkbfile
libxrandr
libxrender
libxtst
pcsclite
wayland
)
makedepends=(
alsa-lib
cmake
docbook-xsl
ffmpeg
icu
krb5
libjpeg-turbo
libpulse
libusb
openssl
pam
systemd
xmlto
xorgproto
)
provides=(
libfreerdp2.so
libfreerdp-client2.so
libfreerdp-server2
libfreerdp-shadow2.so
libfreerdp-shadow-subsystem2.so
libwinpr2.so
libwinpr-tools2.so
libuwac0.so
)
source=(
https://github.com/${_name,,}/${_name,,}/archive/$pkgver/${_name,,}-$pkgver.tar.gz
d0c5b1ae.patch
1ef7b9e3.patch
)
sha512sums=('7b89981a4d2773fdcf41f32d58ec7925765b3cedb7ebc77d54ded8c39f38d294f3adfdf5ab79ad23c5edd2cba456465ac9eafec437c004b5de7a9d76a6a94536'
'f7d231fa8aaf08a20b4bbdb153219e94ba6518eee3238f6c26f2c928cd33ad6c975d2c62acb706ad5b0352889b5a9849cffb6e03b2a2e760accd31c492f6a0a9'
'f5843f8daaa8225534b05dca3d6c1d26a25174d773c81495c73924298312d0c4aee39165a4fe0b4ba38676d40a6779b33443a761f094dd4e16c1303dec026841')
b2sums=('0b7365eccc625878c9543d8b6a92787b11e1c5463122e14536b2fb8ebc46d80b9e8b4274e6d5be8da0fe7a5a3578b907ff47267501b0fdc15dea64534a22f4a2'
'99f60d738ebb594b3f48895bac567c5a4ba8f1e6ceb2a21d421c842d08f267b49f870c70ca7862fea3340ab247bf232dffd7f4b83ebb9bded2bdec9207cc1d1b'
'a0157137a52f3f4817908d86b0a3ec575a7307ec05d3f2388a49fe40e9c40ea23aec4fdc6f926ac5b5c443d6d4063e2b35ad1e386577dcf5d5b208fc791a2605')
prepare() {
cd $_name-$pkgver
# Fix build with ffmpeg 7
patch -p1 -i ../d0c5b1ae.patch
patch -p1 -i ../1ef7b9e3.patch
}
build() {
# gcc14 buildfix
export CFLAGS+=" -Wno-incompatible-pointer-types -Wno-int-conversion"
export CXXFLAGS+=" -Wno-incompatible-pointer-types -Wno-int-conversion"
local cmake_options=(
-B build
-D CHANNEL_URBDRC_CLIENT=ON
-D CMAKE_INSTALL_PREFIX=/usr
-D CMAKE_INSTALL_LIBDIR=lib
-D CMAKE_BUILD_TYPE=None
-D CMAKE_SKIP_INSTALL_RPATH=ON
-D PROXY_PLUGINDIR=/usr/lib/freerdp2/server/proxy/plugins
-D WITH_CHANNELS=ON
-D WITH_CLIENT_CHANNELS=ON
-D WITH_CUPS=ON
-D WITH_DSP_FFMPEG=ON
-D WITH_FFMPEG=ON
-D WITH_ICU=ON
-D WITH_JPEG=ON
-D WITH_PCSC=ON
-D WITH_PULSE=ON
-D WITH_SERVER=ON
-D WITH_SERVER_CHANNELS=ON
-D WITH_SWSCALE=ON
-S $_name-$pkgver
-W no-dev
)
cmake "${cmake_options[@]}"
cmake --build build --verbose
}
check() {
ctest --test-dir build --output-on-failure
}
package() {
depends+=(
alsa-lib libasound.so
ffmpeg libavcodec.so libavutil.so libswresample.so libswscale.so
icu libicuuc.so
libjpeg-turbo libjpeg.so
libpulse libpulse.so
libusb libusb-1.0.so
openssl libcrypto.so libssl.so
pam libpam.so
systemd-libs libsystemd.so
)
DESTDIR="$pkgdir" cmake --install build
install -vDm 644 $_name-$pkgver/{ChangeLog,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}

View File

@ -0,0 +1,140 @@
From d0c5b1ae4289c7f3cde3fbc031cb4a3160df05ff 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] [codec,dsp] fix ffmpeg deprecations
---
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 2c93a667750e..ebba52b147d2 100644
--- a/libfreerdp/codec/dsp_ffmpeg.c
+++ b/libfreerdp/codec/dsp_ffmpeg.c
@@ -224,18 +224,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))
@@ -271,8 +270,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;
@@ -315,8 +318,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;
@@ -331,13 +338,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;
@@ -458,14 +473,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);
@@ -547,7 +568,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);
}
@@ -745,10 +771,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;