]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/remoteosd.c
Sepia improve by being done in YUV
[vlc] / modules / video_filter / remoteosd.c
index f11ec0798acdfa21ecc3551bd4758d367c0b4816..488b3717efc7475b5a6163d1e7a15a92b2027f95 100644 (file)
@@ -122,20 +122,20 @@ vlc_module_begin ()
     add_shortcut( "rmtosd" )
     set_callbacks( CreateFilter, DestroyFilter )
 
-    add_string( RMTOSD_CFG "host", "myvdr", NULL, RMTOSD_HOST_TEXT,
+    add_string( RMTOSD_CFG "host", "myvdr", RMTOSD_HOST_TEXT,
         RMTOSD_HOST_LONGTEXT, false )
     add_integer_with_range( RMTOSD_CFG "port", 20001, 1, 0xFFFF, NULL,
         RMTOSD_PORT_TEXT, RMTOSD_PORT_LONGTEXT, false )
-    add_password( RMTOSD_CFG "password", "", NULL, RMTOSD_PASSWORD_TEXT,
+    add_password( RMTOSD_CFG "password", "", RMTOSD_PASSWORD_TEXT,
         RMTOSD_PASSWORD_LONGTEXT, false )
     add_integer_with_range( RMTOSD_CFG "update", RMTOSD_UPDATE_DEFAULT,
         RMTOSD_UPDATE_MIN, RMTOSD_UPDATE_MAX, NULL, RMTOSD_UPDATE_TEXT,
         RMTOSD_UPDATE_LONGTEXT, true )
-    add_bool( RMTOSD_CFG "vnc-polling", false, NULL,
+    add_bool( RMTOSD_CFG "vnc-polling", false,
               RMTOSD_POLL_TEXT , RMTOSD_POLL_LONGTEXT, false )
-    add_bool( RMTOSD_CFG "mouse-events", false, NULL,
+    add_bool( RMTOSD_CFG "mouse-events", false,
               RMTOSD_MOUSE_TEXT , RMTOSD_MOUSE_LONGTEXT, false )
-    add_bool( RMTOSD_CFG "key-events", false, NULL,
+    add_bool( RMTOSD_CFG "key-events", false,
               RMTOSD_KEYS_TEXT , RMTOSD_KEYS_LONGTEXT, false )
     add_integer_with_range( RMTOSD_CFG "alpha", 255, 0, 255, NULL,
         RMTOSD_ALPHA_TEXT, RMTOSD_ALPHA_LONGTEXT, true )
@@ -222,8 +222,6 @@ struct filter_sys_t
 
     picture_t     *p_pic;              /* The picture with OSD data from VNC */
 
-    vout_thread_t *p_vout;             /* Pointer to video-out thread */
-
     int           i_socket;            /* Socket used for VNC */
 
     uint16_t      i_vnc_width;          /* The with of the VNC screen */
@@ -309,13 +307,7 @@ static int CreateFilter ( vlc_object_t *p_this )
     p_filter->pf_sub_filter = Filter;
     p_filter->pf_sub_mouse  = MouseEvent;
 
-    p_sys->p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT, FIND_PARENT );
-
-    if( p_sys->p_vout )
-    {
-        var_AddCallback( p_sys->p_vout->p_libvlc, "key-pressed",
-                         KeyEvent, p_this );
-    }
+    var_AddCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this );
 
     es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
     p_filter->fmt_out.i_priority = 0;
@@ -326,7 +318,7 @@ static int CreateFilter ( vlc_object_t *p_this )
     p_sys->p_worker_thread = vlc_object_create( p_this,
                                                 sizeof( vlc_object_t ) );
     vlc_object_attach( p_sys->p_worker_thread, p_this );
-    if( vlc_thread_create( p_sys->p_worker_thread, "vnc worker thread",
+    if( vlc_thread_create( p_sys->p_worker_thread,
                            vnc_worker_thread, VLC_THREAD_PRIORITY_LOW ) )
     {
         vlc_object_release( p_sys->p_worker_thread );
@@ -363,13 +355,7 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     stop_osdvnc( p_filter );
 
-    if( p_sys->p_vout )
-    {
-        var_DelCallback( p_sys->p_vout->p_libvlc, "key-pressed",
-                         KeyEvent, p_this );
-
-        vlc_object_release( p_sys->p_vout );
-    }
+    var_DelCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this );
 
     var_Destroy( p_this, RMTOSD_CFG "host" );
     var_Destroy( p_this, RMTOSD_CFG "port" );
@@ -701,7 +687,6 @@ static void* vnc_worker_thread( vlc_object_t *p_thread_obj )
                                                  sizeof( vlc_object_t ) );
     vlc_object_attach( p_update_request_thread, p_filter );
     if( vlc_thread_create( p_update_request_thread,
-                           "vnc update request thread",
                            update_request_thread, VLC_THREAD_PRIORITY_LOW ) )
     {
         vlc_object_release( p_update_request_thread );
@@ -804,8 +789,8 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
     udr.w = htons(p_sys->i_vnc_width);
     udr.h = htons(p_sys->i_vnc_height);
 
-    if( write_exact(p_filter, p_sys->i_socket, (char*)&udr,
-           sz_rfbFramebufferUpdateRequestMsg) == false)
+    if( !write_exact(p_filter, p_sys->i_socket, (char*)&udr,
+                     sz_rfbFramebufferUpdateRequestMsg) )
     {
         msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
         p_sys->b_continue = false;
@@ -820,8 +805,8 @@ static void* update_request_thread( vlc_object_t *p_thread_obj )
         while( vlc_object_alive( p_thread_obj ) )
         {
             msleep( i_poll_interval_microsec );
-            if( write_exact(p_filter, p_sys->i_socket, (char*)&udr,
-                   sz_rfbFramebufferUpdateRequestMsg) == false)
+            if( !write_exact(p_filter, p_sys->i_socket, (char*)&udr,
+                             sz_rfbFramebufferUpdateRequestMsg))
             {
                 msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
                 break;
@@ -1013,7 +998,7 @@ static bool process_server_message ( filter_t *p_filter,
             msg->scme.nColours = htons(msg->scme.nColours);
             msg->scme.firstColour = htons(msg->scme.firstColour);
             int i_datasize;
-            if ( p_sys->b_alpha_from_vnc == true )
+            if ( p_sys->b_alpha_from_vnc )
             {
                 i_datasize = 2 * msg->scme.nColours * 4;
             }
@@ -1042,7 +1027,7 @@ static bool process_server_message ( filter_t *p_filter,
             for (int i = 0; i < msg->scme.nColours; i++)
             {
                 i_color_index = i+msg->scme.firstColour;
-                if ( p_sys->b_alpha_from_vnc == true )
+                if ( p_sys->b_alpha_from_vnc )
                 {
                     i_alpha = p_sys->read_buffer[i_offset];
                     i_offset += 2;
@@ -1385,11 +1370,11 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
     if( !p_sys->b_vnc_key_events )
         return VLC_SUCCESS;
 
-    msg_Dbg( p_this, "key pressed (%d) ", newval.i_int );
+    msg_Dbg( p_this, "key pressed (%"PRId64") ", newval.i_int );
 
     if ( !newval.i_int )
     {
-        msg_Err( p_this, "Received invalid key event %d", newval.i_int );
+        msg_Err( p_this, "Received invalid key event 0" );
         return VLC_EGENERIC;
     }