[vlc-commits] remoteosd: factor code
Rémi Denis-Courmont
git at videolan.org
Thu Jul 9 20:34:17 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 9 19:53:43 2015 +0300| [323539bde6b7d9830aa15233f44710bafd568a7a] | committer: Rémi Denis-Courmont
remoteosd: factor code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=323539bde6b7d9830aa15233f44710bafd568a7a
---
modules/video_filter/remoteosd.c | 46 ++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c
index 09ff915..b36f06b 100644
--- a/modules/video_filter/remoteosd.c
+++ b/modules/video_filter/remoteosd.c
@@ -625,6 +625,25 @@ static bool handshaking ( filter_t *p_filter )
}
+static int write_update_request(filter_t *p_filter, bool incremental)
+{
+ filter_sys_t *p_sys = p_filter->p_sys;
+ rfbFramebufferUpdateRequestMsg udr;
+
+ udr.type = rfbFramebufferUpdateRequest;
+ udr.incremental = incremental;
+ udr.x = 0;
+ udr.y = 0;
+ udr.w = htons(p_sys->i_vnc_width);
+ udr.h = htons(p_sys->i_vnc_height);
+
+ int w = write_exact(p_filter, p_sys->i_socket, (char*)&udr,
+ sz_rfbFramebufferUpdateRequestMsg);
+ if( !w )
+ msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
+ return w;
+}
+
static void* vnc_worker_thread( void *obj )
{
filter_t* p_filter = (filter_t*)obj;
@@ -758,37 +777,16 @@ static void* update_request_thread( void *obj )
filter_sys_t *p_sys = p_filter->p_sys;
msg_Dbg( p_filter, "VNC update request thread started" );
-
- rfbFramebufferUpdateRequestMsg udr;
- udr.type = rfbFramebufferUpdateRequest;
- udr.incremental = 0;
- udr.x = 0;
- udr.y = 0;
- udr.w = htons(p_sys->i_vnc_width);
- udr.h = htons(p_sys->i_vnc_height);
-
- int w = write_exact(p_filter, p_sys->i_socket, (char*)&udr,
- sz_rfbFramebufferUpdateRequestMsg);
-
- if( !w )
- {
- msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
+ if( !write_update_request( p_filter, false ) )
return NULL;
- }
-
- udr.incremental = 1;
if( p_sys->b_vnc_poll)
{
for( ;; )
{
msleep( p_sys->i_vnc_poll_interval * 1000 );
- if( !write_exact(p_filter, p_sys->i_socket, (char*)&udr,
- sz_rfbFramebufferUpdateRequestMsg))
- {
- msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
- break;
- }
+ if( !write_update_request( p_filter, true ) )
+ return NULL;
}
}
else
More information about the vlc-commits
mailing list