[vlc-commits] video_output: make a function per push command
Steve Lhomme
git at videolan.org
Tue Jan 19 08:56:39 UTC 2021
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Dec 17 10:07:23 2020 +0100| [fea1432f039d0c9a7a7b063bb30eda88b44f23cc] | committer: Steve Lhomme
video_output: make a function per push command
We pass the mouse data directly to vout_control_PushMouse(). No need to know
about vout_control_cmd_Init in video_output.c. It doesn't create commands
anymore.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fea1432f039d0c9a7a7b063bb30eda88b44f23cc
---
src/video_output/control.c | 25 ++++++++++++++-----------
src/video_output/control.h | 11 +++--------
src/video_output/video_output.c | 11 +++++------
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/src/video_output/control.c b/src/video_output/control.c
index 3b7fabb07e..fa5210bba9 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -29,13 +29,6 @@
#include "vout_internal.h"
#include "control.h"
-/* */
-void vout_control_cmd_Init(vout_control_cmd_t *cmd, int type)
-{
- memset(cmd, 0, sizeof(*cmd));
- cmd->type = type;
-}
-
/* */
void vout_control_Init(vout_control_t *ctrl)
{
@@ -63,7 +56,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) {
@@ -73,6 +66,15 @@ void vout_control_Push(vout_control_t *ctrl, vout_control_cmd_t *cmd)
vlc_mutex_unlock(&ctrl->lock);
}
+void vout_control_PushMouse(vout_control_t *ctrl, const vlc_mouse_t *video_mouse)
+{
+ vout_control_cmd_t cmd = {
+ VOUT_CONTROL_MOUSE_STATE, *video_mouse,
+ };
+
+ vout_control_Push(ctrl, &cmd);
+}
+
void vout_control_Wake(vout_control_t *ctrl)
{
vlc_mutex_lock(&ctrl->lock);
@@ -81,11 +83,12 @@ void vout_control_Wake(vout_control_t *ctrl)
vlc_mutex_unlock(&ctrl->lock);
}
-void vout_control_PushVoid(vout_control_t *ctrl, int type)
+void vout_control_PushTerminate(vout_control_t *ctrl)
{
- vout_control_cmd_t cmd;
+ vout_control_cmd_t cmd = {
+ VOUT_CONTROL_TERMINATE, {0},
+ };
- vout_control_cmd_Init(&cmd, type);
vout_control_Push(ctrl, &cmd);
}
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 6fb299e139..5976a0f675 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -34,14 +34,9 @@ enum {
typedef struct {
int type;
-
- union {
- vlc_mouse_t mouse;
- };
+ vlc_mouse_t mouse;
} vout_control_cmd_t;
-void vout_control_cmd_Init(vout_control_cmd_t *, int type);
-
typedef struct {
vlc_mutex_t lock;
vlc_cond_t wait_request;
@@ -60,8 +55,8 @@ 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_PushMouse(vout_control_t *, const vlc_mouse_t *);
+void vout_control_PushTerminate(vout_control_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 57ee54e6e8..29b8b140e0 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -382,18 +382,17 @@ 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);
/* Translate window coordinates to video coordinates */
vlc_mutex_lock(&sys->display_lock);
+ vlc_mouse_t video_mouse;
if (sys->display)
- vout_display_TranslateMouseState(sys->display, &cmd.mouse, mouse);
+ vout_display_TranslateMouseState(sys->display, &video_mouse, mouse);
else
- cmd.mouse = *mouse;
+ video_mouse = *mouse;
vlc_mutex_unlock(&sys->display_lock);
- vout_control_Push(&sys->control, &cmd);
+ vout_control_PushMouse(&sys->control, &video_mouse);
}
void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )
@@ -1972,7 +1971,7 @@ void vout_StopDisplay(vout_thread_t *vout)
{
vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
- vout_control_PushVoid(&sys->control, VOUT_CONTROL_TERMINATE);
+ vout_control_PushTerminate(&sys->control);
vlc_join(sys->thread, NULL);
vout_ReleaseDisplay(sys);
More information about the vlc-commits
mailing list