diff --git a/net/freerdp/Makefile b/net/freerdp/Makefile index c0ac5e1075e4..7d107187cd4d 100644 --- a/net/freerdp/Makefile +++ b/net/freerdp/Makefile @@ -1,159 +1,157 @@ PORTNAME= freerdp DISTVERSION= 2.11.7 PORTREVISION= 5 CATEGORIES= net comms MASTER_SITES= https://pub.freerdp.com/releases/ \ https://github.com/FreeRDP/FreeRDP/releases/download/${DISTVERSION}/ PATCH_SITES= https://github.com/FreeRDP/FreeRDP/commit/ -PATCHFILES+= 61983cd6dcb86097d91b7ef405abc1266444a368.patch:-p1 # ffmpeg6 support: AVPicture - # https://github.com/FreeRDP/FreeRDP/pull/8941 PATCHFILES+= 78cdb555c57c33b7f331cb280ac2f615cb87fa74.patch:-p1 # add additional neon check # https://github.com/FreeRDP/FreeRDP/issues/9746 MAINTAINER= vvd@FreeBSD.org COMMENT= Free implementation of Remote Desktop Protocol WWW= https://www.freerdp.com/ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE LIB_DEPENDS= libepoll-shim.so:devel/libepoll-shim USES= cmake compiler:c++11-lib cpe localbase pathfix pkgconfig ssl BROKEN_SSL= libressl-devel BROKEN_SSL_REASON_libressl-devel= fails to compile: no member named 'alert_dispatch' in 'struct ssl3_state_st' USE_LDCONFIG= yes PATCHVERSION= ${DISTVERSION} MAJORVERSION= ${DISTVERSION:R:R} CMAKE_ARGS+= ${CMAKE_ARGS_${ARCH}} CMAKE_ON= WITH_CHANNELS WITH_OPENSSL WITH_OSS WITH_ZLIB CHANNEL_URBDRC_CLIENT CMAKE_OFF= WITH_DSP_EXPERIMENTAL WITH_GPROF WITH_GSSAPI WITH_GSTREAMER_0_10 WITH_IPP \ WITH_LIBSYSTEMD WITH_MBEDTLS WITH_OPENCL WITH_OPENSLES WITH_PROFILER \ WITH_SAMPLE WITH_SANITIZE_ADDRESS WITH_SANITIZE_MEMORY \ WITH_SANITIZE_THREAD WITH_SERVER WITH_SERVER_INTERFACE \ WITH_SMARTCARD_INSPECT WITH_THIRD_PARTY WITH_VALGRIND_MEMCHECK PORTSCOUT= limit:^2\. PLIST_SUB+= PATCHVERSION="${PATCHVERSION}" PLIST_SUB+= MAJORVERSION="${MAJORVERSION}" OPTIONS_DEFINE= ALSA BROKENFOCUS CUPS FAAC FAAD FFMPEG GSM GSTREAMER \ ICU JPEG LAME MANPAGES OPENH264 PCSC \ PULSEAUDIO SOXR WAYLAND X11 OPTIONS_DEFINE_aarch64= NEON OPTIONS_DEFINE_amd64= SSE OPTIONS_DEFINE_armv6= NEON OPTIONS_DEFINE_armv7= NEON OPTIONS_DEFINE_i386= SSE OPTIONS_DEFAULT= CUPS GSTREAMER ICU MANPAGES SWSCALE WAYLAND X11 OPTIONS_DEFAULT_aarch64= NEON OPTIONS_DEFAULT_amd64= SSE OPTIONS_DEFAULT_armv7= NEON OPTIONS_RADIO= SCALE OPTIONS_RADIO_SCALE= CAIRO SWSCALE OPTIONS_SUB= yes BROKENFOCUS_DESC= Work around focus bug in some WMs (PR \#254908) CAIRO_DESC= Use CAIRO image library for screen resizing NEON_DESC= Enable Media Processing Engine instructions OPENH264_DESC= H.264 video codec support via OpenH264 PCSC_DESC= Smart card support (smart card device redirection) SWSCALE_DESC= Use SWScale image library for screen resizing (recommended) WAYLAND_DESC= Build FreeRDP Wayland client X11_DESC= Build FreeRDP X11 client ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_CMAKE_BOOL= WITH_ALSA BROKENFOCUS_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-focusbug.diff CAIRO_USES= gnome CAIRO_USE= gnome=cairo CAIRO_CMAKE_BOOL= WITH_CAIRO CUPS_LIB_DEPENDS= libcups.so:print/cups CUPS_CMAKE_BOOL= WITH_CUPS FAAC_LIB_DEPENDS= libfaac.so:audio/faac FAAC_CMAKE_BOOL= WITH_FAAC FAAD_LIB_DEPENDS= libfaad.so:audio/faad FAAD_CMAKE_BOOL= WITH_FAAD2 FFMPEG_LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ libavutil.so:multimedia/ffmpeg FFMPEG_CMAKE_BOOL= WITH_FFMPEG WITH_DSP_FFMPEG GSM_LIB_DEPENDS= libgsm.so:audio/gsm GSM_CMAKE_BOOL= WITH_GSM GSTREAMER_LIB_DEPENDS= libgstbase-1.0.so:multimedia/gstreamer1 GSTREAMER_USES= gettext gnome gstreamer xorg GSTREAMER_USE= gnome=glib20 xorg=x11,xext,xorgproto,xrandr GSTREAMER_CMAKE_BOOL= WITH_GSTREAMER_1_0 CHANNEL_TSMF ICU_LIB_DEPENDS= libicuuc.so:devel/icu ICU_CMAKE_BOOL= WITH_ICU JPEG_USES= jpeg JPEG_CMAKE_BOOL= WITH_JPEG LAME_LIB_DEPENDS= libmp3lame.so:audio/lame LAME_CMAKE_BOOL= WITH_LAME MANPAGES_BUILD_DEPENDS= xmlto:textproc/xmlto MANPAGES_CMAKE_BOOL= WITH_MANPAGES NEON_CMAKE_BOOL= WITH_NEON OPENH264_LIB_DEPENDS= libopenh264.so:multimedia/openh264 OPENH264_CMAKE_BOOL= WITH_OPENH264 # LoadLibraryA("libpcsclite.so") PCSC_RUN_DEPENDS= ${LOCALBASE}/lib/libpcsclite.so:devel/pcsc-lite PCSC_CMAKE_BOOL= WITH_PCSC PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_CMAKE_BOOL= WITH_PULSE SOXR_LIB_DEPENDS= libsoxr.so:audio/libsoxr SOXR_CMAKE_BOOL= WITH_SOXR SSE_CMAKE_BOOL= WITH_SSE2 SWSCALE_LIB_DEPENDS= libswscale.so:multimedia/ffmpeg SWSCALE_CMAKE_BOOL= WITH_SWSCALE WAYLAND_CATEGORIES= wayland WAYLAND_BUILD_DEPENDS= ${LOCALBASE}/include/linux/input.h:devel/evdev-proto WAYLAND_LIB_DEPENDS= libwayland-client.so:graphics/wayland \ libwayland-cursor.so:graphics/wayland \ libxkbcommon.so:x11/libxkbcommon WAYLAND_CMAKE_BOOL= WITH_WAYLAND X11_USES= xorg X11_USE= xorg=x11,xcursor,xext,xorgproto,xfixes,xi,xinerama,xkbfile,xrandr,xrender,xv X11_CMAKE_ON= -DWITH_X11:BOOL=ON -DWITH_XCURSOR:BOOL=ON \ -DWITH_XEXT:BOOL=ON -DWITH_XFIXES:BOOL=ON \ -DWITH_XI:BOOL=ON -DWITH_XINERAMA:BOOL=ON \ -DWITH_XKBFILE:BOOL=ON -DWITH_XRANDR:BOOL=ON \ -DWITH_XRENDER:BOOL=ON -DWITH_XSHM:BOOL=ON \ -DWITH_XV:BOOL=ON X11_CMAKE_OFF= -DWITH_X11:BOOL=OFF -DWITH_XKBFILE:BOOL=OFF post-patch: @${REINPLACE_CMD} -e 's|gsm/gsm.h|gsm.h|' \ ${WRKSRC}/cmake/FindGSM.cmake \ ${WRKSRC}/libfreerdp/codec/dsp.c pre-configure: ${CP} ${FILESDIR}/mntent.h ${WRKSRC}/rdtk/include ${CP} ${FILESDIR}/mntent_compat.c ${WRKSRC}/channels/rdpdr/client .include diff --git a/net/freerdp/distinfo b/net/freerdp/distinfo index 417e4a4ab8ce..c142d3e221bd 100644 --- a/net/freerdp/distinfo +++ b/net/freerdp/distinfo @@ -1,7 +1,5 @@ -TIMESTAMP = 1713795208 +TIMESTAMP = 1767400000 SHA256 (freerdp-2.11.7.tar.gz) = 5a2d54e1ca0f1facd1632bcc94c73b9f071a80c5fdbbb3f26e79f02aaa586ca3 SIZE (freerdp-2.11.7.tar.gz) = 7337520 -SHA256 (61983cd6dcb86097d91b7ef405abc1266444a368.patch) = be68ff4ab63c15592ff576af34d4592340b70e7b6d7b5ef3cfe5ba97b5fdccf2 -SIZE (61983cd6dcb86097d91b7ef405abc1266444a368.patch) = 2826 SHA256 (78cdb555c57c33b7f331cb280ac2f615cb87fa74.patch) = d49ea1c5a0fdb644b32fd61479dfca6770c0bb6446bbe9d274e5ae4f62f0a00b SIZE (78cdb555c57c33b7f331cb280ac2f615cb87fa74.patch) = 966 diff --git a/net/freerdp/files/patch-channels_tsmf_client_ffmpeg_tsmf__ffmpeg.c b/net/freerdp/files/patch-channels_tsmf_client_ffmpeg_tsmf__ffmpeg.c new file mode 100644 index 000000000000..3ede3f15e466 --- /dev/null +++ b/net/freerdp/files/patch-channels_tsmf_client_ffmpeg_tsmf__ffmpeg.c @@ -0,0 +1,83 @@ +--- channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c.orig 2024-04-22 09:26:59 UTC ++++ channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +@@ -32,6 +32,8 @@ + + #include + #include ++#include ++#include + + #include "tsmf_constants.h" + #include "tsmf_decoder.h" +@@ -125,7 +127,11 @@ static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder + TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*)decoder; + mdecoder->codec_context->sample_rate = media_type->SamplesPerSecond.Numerator; + mdecoder->codec_context->bit_rate = media_type->BitRate; ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ mdecoder->codec_context->ch_layout.nb_channels = media_type->Channels; ++#else + mdecoder->codec_context->channels = media_type->Channels; ++#endif + mdecoder->codec_context->block_align = media_type->BlockAlign; + #if LIBAVCODEC_VERSION_MAJOR < 55 + #ifdef AV_CPU_FLAG_SSE2 +@@ -393,9 +399,9 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* dec + mdecoder->frame->linesize[2], mdecoder->frame->linesize[3], + mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width, + mdecoder->codec_context->height); +- mdecoder->decoded_size = +- avpicture_get_size(mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width, +- mdecoder->codec_context->height); ++ mdecoder->decoded_size = av_image_get_buffer_size(mdecoder->codec_context->pix_fmt, ++ mdecoder->codec_context->width, ++ mdecoder->codec_context->height, 1); + mdecoder->decoded_data = calloc(1, mdecoder->decoded_size); + + if (!mdecoder->decoded_data) +@@ -406,11 +412,12 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* dec + #else + frame = av_frame_alloc(); + #endif +- avpicture_fill((AVPicture*)frame, mdecoder->decoded_data, mdecoder->codec_context->pix_fmt, +- mdecoder->codec_context->width, mdecoder->codec_context->height); +- av_picture_copy((AVPicture*)frame, (AVPicture*)mdecoder->frame, +- mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width, +- mdecoder->codec_context->height); ++ av_image_fill_arrays(frame->data, frame->linesize, mdecoder->decoded_data, ++ mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width, ++ mdecoder->codec_context->height, 1); ++ av_image_copy(frame->data, frame->linesize, (const uint8_t**)mdecoder->frame->data, ++ mdecoder->frame->linesize, mdecoder->codec_context->pix_fmt, ++ mdecoder->codec_context->width, mdecoder->codec_context->height); + av_free(frame); + } + +@@ -497,11 +504,26 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* dec + av_init_packet(&pkt); + pkt.data = (BYTE*)src; + pkt.size = src_size; ++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 101) + len = avcodec_decode_audio4(mdecoder->codec_context, decoded_frame, &got_frame, &pkt); +- ++#else ++ len = avcodec_send_packet(mdecoder->codec_context, &pkt); ++ if (len > 0) ++ { ++ do ++ { ++ len = avcodec_receive_frame(mdecoder->codec_context, decoded_frame); ++ } while (len == AVERROR(EAGAIN)); ++ } ++#endif + if (len >= 0 && got_frame) + { +- frame_size = av_samples_get_buffer_size(NULL, mdecoder->codec_context->channels, ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ const int channels = mdecoder->codec_context->ch_layout.nb_channels; ++#else ++ const int channels = mdecoder->codec_context->channels; ++#endif ++ frame_size = av_samples_get_buffer_size(NULL, channels, + decoded_frame->nb_samples, + mdecoder->codec_context->sample_fmt, 1); + memcpy(dst, decoded_frame->data[0], frame_size); diff --git a/net/freerdp/files/patch-libfreerdp_codec_dsp__ffmpeg.c b/net/freerdp/files/patch-libfreerdp_codec_dsp__ffmpeg.c new file mode 100644 index 000000000000..3730a78f69bb --- /dev/null +++ b/net/freerdp/files/patch-libfreerdp_codec_dsp__ffmpeg.c @@ -0,0 +1,158 @@ +--- libfreerdp/codec/dsp_ffmpeg.c.orig 2024-04-22 09:26:59 UTC ++++ libfreerdp/codec/dsp_ffmpeg.c +@@ -225,7 +225,6 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* c + static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context) + { + int ret; +- int layout; + const AUDIO_FORMAT* format; + + if (!context || context->isOpen) +@@ -236,7 +235,6 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* c + if (!format) + return FALSE; + +- layout = av_get_default_channel_layout(format->nChannels); + context->id = ffmpeg_get_avcodec(format); + + if (ffmpeg_codec_is_filtered(context->id, context->encoder)) +@@ -263,15 +261,26 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* c + break; + + case AV_CODEC_ID_AAC: ++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102) + context->context->profile = FF_PROFILE_AAC_MAIN; ++#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(62, 11, 100) ++ context->context->profile = AV_PROFILE_AAC_MAIN; ++#else ++ context->context->profile = AV_PROFILE_AAC_LOW; ++#endif + break; + + default: + break; + } + ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ av_channel_layout_default(&context->context->ch_layout, format->nChannels); ++#else + context->context->channels = format->nChannels; ++ const int64_t layout = av_get_default_channel_layout(format->nChannels); + context->context->channel_layout = layout; ++#endif + context->context->sample_rate = format->nSamplesPerSec; + context->context->block_align = format->nBlockAlign; + context->context->bit_rate = format->nAvgBytesPerSec * 8; +@@ -314,8 +323,12 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* c + if (!context->rcontext) + goto fail; + ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ av_channel_layout_default(&context->frame->ch_layout, format->nChannels); ++#else + context->frame->channel_layout = layout; + context->frame->channels = format->nChannels; ++#endif + context->frame->sample_rate = format->nSamplesPerSec; + context->frame->format = AV_SAMPLE_FMT_S16; + +@@ -330,13 +343,23 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* c + context->resampled->sample_rate = format->nSamplesPerSec; + } + ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ av_channel_layout_default(&context->resampled->ch_layout, format->nChannels); ++#else + context->resampled->channel_layout = layout; + context->resampled->channels = format->nChannels; ++#endif + + if (context->context->frame_size > 0) + { ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ ret = av_channel_layout_copy(&context->buffered->ch_layout, &context->resampled->ch_layout); ++ if (ret != 0) ++ goto fail; ++#else + context->buffered->channel_layout = context->resampled->channel_layout; + context->buffered->channels = context->resampled->channels; ++#endif + context->buffered->format = context->resampled->format; + context->buffered->nb_samples = context->context->frame_size; + +@@ -421,7 +444,12 @@ static BOOL ffmpeg_encode_frame(AVCodecContext* contex + 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++) +@@ -477,14 +505,21 @@ static BOOL ffmpeg_fill_frame(AVFrame* frame, const AU + size_t size) + { + int ret, bpp; ++ ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ av_channel_layout_default(&frame->ch_layout, inputFormat->nChannels); ++#else + frame->channels = inputFormat->nChannels; ++ frame->channel_layout = av_get_default_channel_layout(frame->channels); ++#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,8 +601,15 @@ static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVP + } + + { +- const size_t data_size = resampled->channels * resampled->nb_samples * 2; +- Stream_EnsureRemainingCapacity(out, data_size); ++ ++#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100) ++ const size_t nrchannels = resampled->ch_layout.nb_channels; ++#else ++ const size_t nrchannels = resampled->channels; ++#endif ++ const size_t data_size = nrchannels * resampled->nb_samples * 2; ++ if (!Stream_EnsureRemainingCapacity(out, data_size)) ++ return FALSE; + Stream_Write(out, resampled->data[0], data_size); + } + } +@@ -661,10 +703,15 @@ BOOL freerdp_dsp_ffmpeg_encode(FREERDP_DSP_CONTEXT* co + 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 size_t nrchannels = context->context->ch_layout.nb_channels; ++#else ++ const size_t nrchannels = context->context->channels; ++#endif ++ ++ rc = av_samples_copy(context->buffered->extended_data, ++ context->resampled->extended_data, (int)context->bufferedSamples, ++ copied, inSamples, nrchannels, context->context->sample_fmt); + rest -= inSamples; + copied += inSamples; + context->bufferedSamples += (UINT32)inSamples;