X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fremoteosd.c;h=07f75a59694312dfafd5b6324ca0725aa2d11aba;hb=40b4d780a427e29a936e267090d6809e2ce98fd3;hp=69bb931c0e2e0320e70d31efa9ef06d5cace6545;hpb=27cdd6eb494feb8da6ea6fd4112b1b066b5f4f3a;p=vlc diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c index 69bb931c0e..07f75a5969 100644 --- a/modules/video_filter/remoteosd.c +++ b/modules/video_filter/remoteosd.c @@ -55,9 +55,7 @@ #include #include -#include "filter_common.h" #include -#include #include #include @@ -77,7 +75,7 @@ #define RMTOSD_PORT_TEXT N_("VNC Port") #define RMTOSD_PORT_LONGTEXT N_( \ - "VNC portnumber." ) + "VNC port number." ) #define RMTOSD_PASSWORD_TEXT N_("VNC Password") #define RMTOSD_PASSWORD_LONGTEXT N_( \ @@ -124,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 ) @@ -154,8 +152,10 @@ vlc_module_end () /* subfilter functions */ static subpicture_t *Filter( filter_t *, mtime_t ); -static int MouseEvent ( vlc_object_t *p_this, char const *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *p_data ); +static int MouseEvent( filter_t *, + const vlc_mouse_t *, + const vlc_mouse_t *, + const video_format_t * ); static int KeyEvent( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ); @@ -307,15 +307,12 @@ static int CreateFilter ( vlc_object_t *p_this ) /* Attach subpicture filter callback */ 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, "mouse-moved", - MouseEvent, p_this ); - var_AddCallback( p_sys->p_vout, "mouse-button-down", - MouseEvent, p_this ); var_AddCallback( p_sys->p_vout->p_libvlc, "key-pressed", KeyEvent, p_this ); } @@ -368,10 +365,6 @@ static void DestroyFilter( vlc_object_t *p_this ) if( p_sys->p_vout ) { - var_DelCallback( p_sys->p_vout, "mouse-moved", - MouseEvent, p_this ); - var_DelCallback( p_sys->p_vout, "mouse-button-down", - MouseEvent, p_this ); var_DelCallback( p_sys->p_vout->p_libvlc, "key-pressed", KeyEvent, p_this ); @@ -1320,38 +1313,33 @@ static inline bool raw_line( filter_sys_t* p_sys, /***************************************************************************** * MouseEvent: callback for mouse events *****************************************************************************/ -static int MouseEvent( vlc_object_t *p_this, char const *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *p_data ) +static int MouseEvent( filter_t *p_filter, + const vlc_mouse_t *p_old, + const vlc_mouse_t *p_new, + const video_format_t *p_fmt ) { - VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(psz_var); - - filter_t *p_filter = (filter_t *)p_data; filter_sys_t *p_sys = p_filter->p_sys; + VLC_UNUSED(p_old); if( !p_sys->b_vnc_mouse_events ) return VLC_SUCCESS; - vout_thread_t *p_vout = (vout_thread_t*)p_sys->p_vout; - int i_x, i_y; - int i_v; - - - i_v = var_GetInteger( p_sys->p_vout, "mouse-button-down" ); - i_y = var_GetInteger( p_sys->p_vout, "mouse-y" ); - i_x = var_GetInteger( p_sys->p_vout, "mouse-x" ); + int i_v = p_new->i_pressed; + int i_x = p_new->i_x; + int i_y = p_new->i_y; vlc_mutex_lock( &p_sys->lock ); - const int v_h = p_vout->fmt_in.i_visible_height; + const int v_h = p_fmt->i_visible_height; const int v_w = p_sys->i_vnc_width * v_h / p_sys->i_vnc_height; - const int v_x = (p_vout->fmt_in.i_visible_width-v_w)/2; + const int v_x = (p_fmt->i_visible_width-v_w)/2; i_x -= v_x; if( i_y < 0 || i_x < 0 || i_y >= v_h || i_x >= v_w ) { vlc_mutex_unlock( &p_sys->lock ); - msg_Dbg( p_this, "invalid mouse event? x=%d y=%d btn=%x", i_x, i_y, i_v ); + msg_Dbg( p_filter, "invalid mouse event? x=%d y=%d btn=%x", i_x, i_y, i_v ); return VLC_SUCCESS; } if( !p_sys->b_connection_active ) @@ -1361,7 +1349,7 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, } #ifdef VNC_DEBUG - msg_Dbg( p_this, "mouse event x=%d y=%d btn=%x", i_x, i_y, i_v ); + msg_Dbg( p_filter, "mouse event x=%d y=%d btn=%x", i_x, i_y, i_v ); #endif /* */ @@ -1380,7 +1368,7 @@ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, vlc_mutex_unlock( &p_sys->lock ); - return VLC_SUCCESS; + return VLC_EGENERIC; } /***************************************************************************** @@ -1397,11 +1385,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; }