[vlc-devel] [PATCH 03/10] vout: control: add vout_control_PushMouse() to match other push calls

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 17 13:50:46 CEST 2020


---
 src/video_output/control.c      | 13 +++++++++++--
 src/video_output/control.h      |  5 ++---
 src/video_output/video_output.c |  6 +-----
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index fd0c80fe6eb..bc07b41f00f 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -29,7 +29,7 @@
 #include "vout_internal.h"
 
 /* */
-void vout_control_cmd_Init(vout_control_cmd_t *cmd, int type)
+static void vout_control_cmd_Init(vout_control_cmd_t *cmd, int type)
 {
     memset(cmd, 0, sizeof(*cmd));
     cmd->type = type;
@@ -77,7 +77,7 @@ void vout_control_Dead(vout_control_t *ctrl)
     vlc_mutex_unlock(&ctrl->lock);
 }
 
-void vout_control_Push(vout_control_t *ctrl, vout_control_cmd_t *cmd)
+static void vout_control_Push(vout_control_t *ctrl, vout_control_cmd_t *cmd)
 {
     vlc_mutex_lock(&ctrl->lock);
     if (!ctrl->is_dead) {
@@ -122,6 +122,15 @@ void vout_control_PushString(vout_control_t *ctrl, int type, const char *string)
     vout_control_Push(ctrl, &cmd);
 }
 
+void vout_control_PushMouse(vout_control_t *ctrl, int type, const vlc_mouse_t *mouse)
+{
+    vout_control_cmd_t cmd;
+
+    vout_control_cmd_Init(&cmd, type);
+    cmd.mouse = *mouse;
+    vout_control_Push(ctrl, &cmd);
+}
+
 void vout_control_Hold(vout_control_t *ctrl)
 {
     vlc_mutex_lock(&ctrl->lock);
diff --git a/src/video_output/control.h b/src/video_output/control.h
index d9bd878a99e..f91dd9f47b8 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -23,7 +23,7 @@
 #ifndef LIBVLC_VOUT_INTERNAL_CONTROL_H
 #define LIBVLC_VOUT_INTERNAL_CONTROL_H
 
-#include <vlc_viewpoint.h>
+#include <vlc_mouse.h>
 
 /* */
 enum {
@@ -44,7 +44,6 @@ typedef struct {
     };
 } vout_control_cmd_t;
 
-void vout_control_cmd_Init(vout_control_cmd_t *, int type);
 void vout_control_cmd_Clean(vout_control_cmd_t *);
 
 typedef struct {
@@ -65,10 +64,10 @@ void vout_control_Init(vout_control_t *);
 void vout_control_Clean(vout_control_t *);
 
 /* controls outside of the vout thread */
-void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
 void vout_control_PushVoid(vout_control_t *, int type);
 void vout_control_PushBool(vout_control_t *, int type, bool boolean);
 void vout_control_PushString(vout_control_t *, int type, const char *string);
+void vout_control_PushMouse(vout_control_t *, int type, const vlc_mouse_t *);
 void vout_control_Wake(vout_control_t *);
 void vout_control_Hold(vout_control_t *);
 void vout_control_Release(vout_control_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ea24ad6a15a..0e80d36daf1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -386,11 +386,7 @@ void vout_MouseState(vout_thread_t *vout, const vlc_mouse_t *mouse)
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
     assert(!sys->dummy);
     assert(mouse);
-    vout_control_cmd_t cmd;
-    vout_control_cmd_Init(&cmd, VOUT_CONTROL_MOUSE_STATE);
-    cmd.mouse = *mouse;
-
-    vout_control_Push(&sys->control, &cmd);
+    vout_control_PushMouse(&sys->control, VOUT_CONTROL_MOUSE_STATE, mouse);
 }
 
 void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )
-- 
2.26.2



More information about the vlc-devel mailing list