[vlc-devel] [PATCH] modules/video_filter/rotate.c: add pf_video_mouse input filter

Thomas Guillem thomas at gllm.fr
Mon Nov 30 09:41:26 CET 2020


Hello, applied, thanks !

PS: If you are the author, we don't need that the patch is signed-off by the same author.

On Sat, Nov 28, 2020, at 08:20, Yuri Sevatz wrote:
> I've placed the Signed-Off version for master, in a thread with "vlc-master" in the subject:
> 
>     [vlc-devel] [PATCH] vlc-master modules/video_filter/rotate.c: add pf_video_mouse input filter
> 
> It's the same patch otherwise.
> 
> 
> *From:* vlc-devel <vlc-devel-bounces at videolan.org> on behalf of Thomas Guillem <thomas at gllm.fr>
> *Sent:* Thursday, November 26, 2020 4:29 AM
> *To:* Mailing list for VLC media player developers <vlc-devel at videolan.org>
> *Subject:* Re: [vlc-devel] [PATCH] modules/video_filter/rotate.c: add pf_video_mouse input filter 
>  
> LGTM
> 
> On Wed, Nov 25, 2020, at 09:38, Yuri Sevatz wrote:
> > Add input rotation for mouse events in the rotate video filter.
> > 
> > Previously the rotate video filter would not rotate mouse events,
> > which would cause confusion if another video filter taking mouse
> > input was chained before rotate (e.g. zoom, puzzle, etc), and
> > clicks headed for those in-filter actions would have to go to
> > their pre-rotated positions in order for VLC to accept them.
> > ---
> >  modules/video_filter/rotate.c | 40 ++++++++++++++++++++++++++++++++++-
> >  1 file changed, 39 insertions(+), 1 deletion(-)
> > 
> > diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c
> > index e4232cce2c..35d2208321 100644
> > --- a/modules/video_filter/rotate.c
> > +++ b/modules/video_filter/rotate.c
> > @@ -35,6 +35,7 @@
> >  #include <vlc_common.h>
> >  #include <vlc_plugin.h>
> >  #include <vlc_filter.h>
> > +#include <vlc_mouse.h>
> >  #include <vlc_picture.h>
> >  #include "filter_picture.h"
> >  #include "../control/motionlib.h"
> > @@ -44,6 +45,8 @@
> >   *****************************************************************************/
> >  static int  Create    ( filter_t * );
> >  
> > +static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
> > +                  const vlc_mouse_t *p_old );
> >  static picture_t *FilterPacked( filter_t *, picture_t * );
> >  VIDEO_FILTER_WRAPPER_CLOSE(Filter, Destroy)
> >  
> > @@ -118,7 +121,7 @@ static void fetch_trigo( filter_sys_t *sys, int 
> > *i_sin, int *i_cos )
> >  
> >  static const struct vlc_filter_operations packed_filter_ops =
> >  {
> > -    .filter_video = FilterPacked, .close = Destroy,
> > +    .filter_video = FilterPacked, .video_mouse = Mouse, .close = Destroy,
> >  };
> >  
> >  /*****************************************************************************
> > @@ -198,6 +201,41 @@ static void Destroy( filter_t *p_filter )
> >      free( p_sys );
> >  }
> >  
> > +/*****************************************************************************
> > + *
> > + *****************************************************************************/
> > +static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
> > +                  const vlc_mouse_t *p_old )
> > +{
> > +    VLC_UNUSED( p_old );
> > +
> > +    const video_format_t *p_fmt = &p_filter->fmt_out.video;
> > +    filter_sys_t *p_sys = p_filter->p_sys;
> > +
> > +    const int i_x = p_mouse->i_x;
> > +    const int i_y = p_mouse->i_y;
> > +
> > +    if( p_sys->p_motion != NULL )
> > +    {
> > +        int i_angle = motion_get_angle( p_sys->p_motion );
> > +        store_trigo( p_sys, i_angle / 20.f );
> > +    }
> > +
> > +    int i_sin, i_cos;
> > +    fetch_trigo( p_sys, &i_sin, &i_cos );
> > +
> > +    p_mouse->i_x = ( p_fmt->i_visible_width >> 1 );
> > +    p_mouse->i_y = ( p_fmt->i_visible_height >> 1 );
> > +
> > +    const int i_rx = ( i_x - p_mouse->i_x );
> > +    const int i_ry = ( i_y - p_mouse->i_y );
> > +
> > +    p_mouse->i_x += ( ( i_rx * i_cos - i_ry * i_sin )>> 12 );
> > +    p_mouse->i_y += ( ( i_rx * i_sin + i_ry * i_cos )>> 12 );
> > +
> > +    return VLC_SUCCESS;
> > +}
> > +
> >  /*****************************************************************************
> >   *
> >   *****************************************************************************/
> > -- 
> > 2.29.2
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20201130/139f5a58/attachment.html>


More information about the vlc-devel mailing list