[vlc-commits] vout: process SPU, filter and owner hooks

Rémi Denis-Courmont git at videolan.org
Mon Dec 31 17:40:18 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 30 20:46:54 2018 +0200| [43f027d3dcd3aa38361c7da89e26da3a465fb3a0] | committer: Rémi Denis-Courmont

vout: process SPU, filter and owner hooks

...in the video output code.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43f027d3dcd3aa38361c7da89e26da3a465fb3a0
---

 src/video_output/video_output.c | 47 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4393cf99da..eae33a6c31 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1344,16 +1344,53 @@ static void ThreadStep(vout_thread_t *vout, vlc_tick_t *duration)
     }
 }
 
-static void ThreadTranslateMouseState(vout_thread_t *vout,
-                                      const vlc_mouse_t *win_mouse)
+static void ThreadProcessMouseState(vout_thread_t *vout,
+                                    const vlc_mouse_t *win_mouse)
 {
-    vlc_mouse_t vid_mouse;
+    vlc_mouse_t vid_mouse, tmp1, tmp2, *m;
 
     /* Translate window coordinates to video coordinates */
     vout_display_TranslateMouseState(vout->p->display, &vid_mouse, win_mouse);
 
+    /* Let SPU handle the mouse */
+    if (likely(vout->p->spu != NULL)
+     && spu_ProcessMouse(vout->p->spu, &vid_mouse, &vout->p->display->source))
+        return;
+
     /* Then pass up the filter chains. */
-    vout_SendDisplayEventMouse(vout, &vid_mouse);
+    m = &vid_mouse;
+    vlc_mutex_lock(&vout->p->filter.lock);
+    if (vout->p->filter.chain_static && vout->p->filter.chain_interactive) {
+        if (!filter_chain_MouseFilter(vout->p->filter.chain_interactive,
+                                      &tmp1, m))
+            m = &tmp1;
+        if (!filter_chain_MouseFilter(vout->p->filter.chain_static,
+                                      &tmp2, m))
+            m = &tmp2;
+    }
+    vlc_mutex_unlock(&vout->p->filter.lock);
+
+    if (vlc_mouse_HasMoved(&vout->p->mouse, m))
+        var_SetCoords(vout, "mouse-moved", m->i_x, m->i_y);
+
+    if (vlc_mouse_HasButton(&vout->p->mouse, m)) {
+        var_SetInteger(vout, "mouse-button-down", m->i_pressed);
+
+        if (vlc_mouse_HasPressed(&vout->p->mouse, m, MOUSE_BUTTON_LEFT)) {
+            /* FIXME? */
+            int x, y;
+
+            var_GetCoords(vout, "mouse-moved", &x, &y);
+            var_SetCoords(vout, "mouse-clicked", x, y);
+        }
+    }
+
+    if (m->b_double_click)
+        var_ToggleBool(vout, "fullscreen");
+    vout->p->mouse = *m;
+
+    if (vout->p->mouse_event)
+        vout->p->mouse_event(m, vout->p->opaque);
 }
 
 static int ThreadStart(vout_thread_t *vout, vout_display_cfg_t *cfg)
@@ -1564,7 +1601,7 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
         ThreadStep(vout, cmd.time_ptr);
         break;
     case VOUT_CONTROL_MOUSE_STATE:
-        ThreadTranslateMouseState(vout, &cmd.mouse);
+        ThreadProcessMouseState(vout, &cmd.mouse);
         break;
     case VOUT_CONTROL_DISPLAY_SIZE:
         vout_SetDisplaySize(vout->p->display,



More information about the vlc-commits mailing list