xref: /OK3568_Linux_fs/buildroot/package/vlc/0007-Add-support-for-freerdp2.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 3780bbb20bf35aa8f21ac672da3f0c5f408468e9 Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Thu, 16 Aug 2018 12:27:40 +0200
4Subject: [PATCH] Add support for freerdp2
5
6Downloaded from
7https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/vlc/files/vlc-2.2.8-freerdp-2.patch
8
9Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10---
11 configure.ac         |  2 +-
12 modules/access/rdp.c | 51 ++++++++++++++-------------------------------------
13 2 files changed, 15 insertions(+), 38 deletions(-)
14
15diff --git a/configure.ac b/configure.ac
16index bfe43512a2..4808b8becf 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -1992,7 +1992,7 @@ PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client su
20
21 dnl  RDP/Remote Desktop access module
22 dnl
23-PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
24+PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp2 >= 1.0.1], (RDP/Remote Desktop client support) )
25
26 dnl
27 dnl  Real RTSP plugin
28diff --git a/modules/access/rdp.c b/modules/access/rdp.c
29index 2992090219..49986f5da9 100644
30--- a/modules/access/rdp.c
31+++ b/modules/access/rdp.c
32@@ -45,18 +45,6 @@
33 # include <freerdp/version.h>
34 #endif
35
36-#if !defined(FREERDP_VERSION_MAJOR) || \
37-    (defined(FREERDP_VERSION_MAJOR) && !(FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 1)))
38-# define SoftwareGdi sw_gdi
39-# define Fullscreen fullscreen
40-# define ServerHostname hostname
41-# define Username username
42-# define Password password
43-# define ServerPort port
44-# define EncryptionMethods encryption
45-# define ContextSize context_size
46-#endif
47-
48 #include <errno.h>
49 #ifdef HAVE_POLL
50 # include <poll.h>
51@@ -144,6 +132,7 @@ static void desktopResizeHandler( rdpContext *p_context )
52     vlcrdp_context_t * p_vlccontext = (vlcrdp_context_t *) p_context;
53     demux_sys_t *p_sys = p_vlccontext->p_demux->p_sys;
54     rdpGdi *p_gdi = p_context->gdi;
55+    unsigned bytesPerPixel;
56
57     if ( p_sys->es )
58     {
59@@ -153,17 +142,21 @@ static void desktopResizeHandler( rdpContext *p_context )
60
61     /* Now init and fill es format */
62     vlc_fourcc_t i_chroma;
63-    switch( p_gdi->bytesPerPixel )
64+    switch( p_gdi->dstFormat )
65     {
66         default:
67-        case 16:
68+            msg_Dbg( p_vlccontext->p_demux, "unhandled dstFormat %x bpp", p_gdi->dstFormat);
69+        case PIXEL_FORMAT_BGR16:
70             i_chroma = VLC_CODEC_RGB16;
71+            bytesPerPixel = 16;
72             break;
73-        case 24:
74+        case PIXEL_FORMAT_BGR24:
75             i_chroma = VLC_CODEC_RGB24;
76+            bytesPerPixel = 24;
77             break;
78-        case 32:
79+        case PIXEL_FORMAT_BGRA32:
80             i_chroma = VLC_CODEC_RGB32;
81+            bytesPerPixel = 32;
82             break;
83     }
84     es_format_t fmt;
85@@ -176,7 +169,7 @@ static void desktopResizeHandler( rdpContext *p_context )
86     fmt.video.i_height = p_gdi->height;
87     fmt.video.i_frame_rate_base = 1000;
88     fmt.video.i_frame_rate = 1000 * p_sys->f_fps;
89-    p_sys->i_framebuffersize = p_gdi->width * p_gdi->height * p_gdi->bytesPerPixel;
90+    p_sys->i_framebuffersize = p_gdi->width * p_gdi->height * bytesPerPixel;
91
92     if ( p_sys->p_block )
93         p_sys->p_block = block_Realloc( p_sys->p_block, 0, p_sys->i_framebuffersize );
94@@ -237,28 +230,19 @@ static bool postConnectHandler( freerdp *p_instance )
95     vlcrdp_context_t * p_vlccontext = (vlcrdp_context_t *) p_instance->context;
96
97     msg_Dbg( p_vlccontext->p_demux, "connected to desktop %dx%d (%d bpp)",
98-#if defined(FREERDP_VERSION_MAJOR) && (FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 1))
99              p_instance->settings->DesktopWidth,
100              p_instance->settings->DesktopHeight,
101              p_instance->settings->ColorDepth
102-#else
103-             p_instance->settings->width,
104-             p_instance->settings->height,
105-             p_instance->settings->color_depth
106-#endif
107              );
108
109     p_instance->update->DesktopResize = desktopResizeHandler;
110     p_instance->update->BeginPaint = beginPaintHandler;
111     p_instance->update->EndPaint = endPaintHandler;
112
113-    gdi_init( p_instance,
114-                CLRBUF_16BPP |
115-#if defined(FREERDP_VERSION_MAJOR) && defined(FREERDP_VERSION_MINOR) && \
116-    !(FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 2))
117-                CLRBUF_24BPP |
118-#endif
119-                CLRBUF_32BPP, NULL );
120+    if ( p_instance->settings->ColorDepth > 16 )
121+        gdi_init( p_instance, PIXEL_FORMAT_XRGB32);
122+    else
123+        gdi_init( p_instance, PIXEL_FORMAT_RGB16);
124
125     desktopResizeHandler( p_instance->context );
126     return true;
127@@ -432,10 +416,6 @@ static int Open( vlc_object_t *p_this )
128     if ( p_sys->f_fps <= 0 ) p_sys->f_fps = 1.0;
129     p_sys->i_frame_interval = 1000000 / p_sys->f_fps;
130
131-#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR < 2
132-    freerdp_channels_global_init();
133-#endif
134-
135     p_sys->p_instance = freerdp_new();
136     if ( !p_sys->p_instance )
137     {
138@@ -508,9 +488,6 @@ static void Close( vlc_object_t *p_this )
139
140     freerdp_disconnect( p_sys->p_instance );
141     freerdp_free( p_sys->p_instance );
142-#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR < 2
143-    freerdp_channels_global_uninit();
144-#endif
145
146     if ( p_sys->p_block )
147         block_Release( p_sys->p_block );
148--
1492.14.4
150
151