<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Please disregard thread -- I was trying to get both a VLC-master and a VLC-3.0 review going in parallel.<br>
<br>
(See follow-up thread. Still learning!)<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Yuri Sevatz <yuri_sevatz@hotmail.com><br>
<b>Sent:</b> Wednesday, November 25, 2020 3:42 AM<br>
<b>To:</b> vlc-devel@videolan.org <vlc-devel@videolan.org><br>
<b>Cc:</b> Yuri Sevatz <yuri_sevatz@hotmail.com><br>
<b>Subject:</b> [PATCH] modules/video_filter/rotate.c: add pf_video_mouse input filter</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Add input rotation for mouse events in the rotate video filter.<br>
<br>
Previously the rotate video filter would not rotate mouse events,<br>
which would cause confusion if another video filter taking mouse<br>
input was chained before rotate (e.g. zoom, puzzle, etc), and<br>
clicks headed for those in-filter actions would have to go to<br>
their pre-rotated positions in order for VLC to accept them.<br>
<br>
Signed-off-by: Yuri Sevatz <yuri_sevatz@hotmail.com><br>
---<br>
modules/video_filter/rotate.c | 40 +++++++++++++++++++++++++++++++++++<br>
1 file changed, 40 insertions(+)<br>
<br>
diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c<br>
index 84e66b0249..83844cbfc5 100644<br>
--- a/modules/video_filter/rotate.c<br>
+++ b/modules/video_filter/rotate.c<br>
@@ -36,6 +36,7 @@<br>
#include <vlc_plugin.h><br>
#include <vlc_atomic.h><br>
#include <vlc_filter.h><br>
+#include <vlc_mouse.h><br>
#include <vlc_picture.h><br>
#include "filter_picture.h"<br>
#include "../control/motionlib.h"<br>
@@ -46,6 +47,8 @@<br>
static int Create ( vlc_object_t * );<br>
static void Destroy ( vlc_object_t * );<br>
<br>
+static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,<br>
+ const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );<br>
static picture_t *Filter( filter_t *, picture_t * );<br>
static picture_t *FilterPacked( filter_t *, picture_t * );<br>
<br>
@@ -149,6 +152,9 @@ static int Create( vlc_object_t *p_this )<br>
return VLC_EGENERIC;<br>
}<br>
<br>
+ /* Add mouse filter */<br>
+ p_filter->pf_video_mouse = Mouse;<br>
+<br>
/* Allocate structure */<br>
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );<br>
if( p_filter->p_sys == NULL )<br>
@@ -198,6 +204,40 @@ static void Destroy( vlc_object_t *p_this )<br>
free( p_sys );<br>
}<br>
<br>
+/*****************************************************************************<br>
+ *<br>
+ *****************************************************************************/<br>
+static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,<br>
+ const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )<br>
+{<br>
+ VLC_UNUSED( p_old );<br>
+<br>
+ const video_format_t *p_fmt = &p_filter->fmt_out.video;<br>
+ filter_sys_t *p_sys = p_filter->p_sys;<br>
+<br>
+ *p_mouse = *p_new;<br>
+<br>
+ if( p_sys->p_motion != NULL )<br>
+ {<br>
+ int i_angle = motion_get_angle( p_sys->p_motion );<br>
+ store_trigo( p_sys, i_angle / 20.f );<br>
+ }<br>
+<br>
+ int i_sin, i_cos;<br>
+ fetch_trigo( p_sys, &i_sin, &i_cos );<br>
+<br>
+ p_mouse->i_x = ( p_fmt->i_visible_width >> 1 );<br>
+ p_mouse->i_y = ( p_fmt->i_visible_height >> 1 );<br>
+<br>
+ const int i_rx = ( p_new->i_x - p_mouse->i_x );<br>
+ const int i_ry = ( p_new->i_y - p_mouse->i_y );<br>
+<br>
+ p_mouse->i_x += ( ( i_rx * i_cos - i_ry * i_sin )>> 12 );<br>
+ p_mouse->i_y += ( ( i_rx * i_sin + i_ry * i_cos )>> 12 );<br>
+<br>
+ return VLC_SUCCESS;<br>
+}<br>
+<br>
/*****************************************************************************<br>
*<br>
*****************************************************************************/<br>
-- <br>
2.29.2<br>
<br>
</div>
</span></font></div>
</body>
</html>