[vlc-commits] commit: Let mouse events go through vout filter chain. (Laurent Aimar )

git at videolan.org git at videolan.org
Sat Apr 17 23:23:59 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Apr 13 22:26:00 2010 +0200| [4c3384da61ecd4acdc45fbc42b74593fecc7c901] | committer: Laurent Aimar 

Let mouse events go through vout filter chain.

It only works for vout display modules.

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

 src/video_output/display.c       |   12 ++++++++++++
 src/video_output/video_output.c  |    4 ++++
 src/video_output/vout_internal.h |    2 +-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 6d64e34..b910095 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1422,6 +1422,15 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
 #include "vout_internal.h"
 void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
 {
+    vlc_mouse_t tmp;
+
+    vlc_mutex_lock( &vout->p->vfilter_lock );
+    if (vout->p->p_vf2_chain) {
+        if (!filter_chain_MouseFilter(vout->p->p_vf2_chain, &tmp, m))
+            m = &tmp;
+    }
+    vlc_mutex_unlock( &vout->p->vfilter_lock );
+
     if (vlc_mouse_HasMoved(&vout->p->mouse, m)) {
         vout_SendEventMouseMoved(vout, m->i_x, m->i_y);
     }
@@ -1453,10 +1462,13 @@ static void DummyVoutSendDisplayEventMouse(vout_thread_t *vout, vlc_mouse_t *fal
 
     if (!vout->p) {
         p.mouse = *fallback;
+        vlc_mutex_init(&p.vfilter_lock);
+        p.p_vf2_chain = NULL;
         vout->p = &p;
     }
     vout_SendDisplayEventMouse(vout, m);
     if (vout->p == &p) {
+        vlc_mutex_destroy(&p.vfilter_lock);
         *fallback = p.mouse;
         vout->p = NULL;
     }
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 859bdb4..7ed3dc5 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1111,8 +1111,12 @@ static void* RunThread( void *p_this )
 
         p_filtered_picture = NULL;
         if( p_picture )
+        {
+            vlc_mutex_lock( &p_vout->p->vfilter_lock );
             p_filtered_picture = filter_chain_VideoFilter( p_vout->p->p_vf2_chain,
                                                            p_picture );
+            vlc_mutex_unlock( &p_vout->p->vfilter_lock );
+        }
 
         const bool b_snapshot = vout_snapshot_IsRequested( &p_vout->p->snapshot );
 
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index ffbe222..2fc6200 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -60,7 +60,7 @@ struct vout_thread_sys_t
     vlc_cond_t      picture_wait;
 
     /* */
-    vlc_mutex_t     vfilter_lock;         /**< video filter2 change lock */
+    vlc_mutex_t     vfilter_lock;         /**< video filter2 lock */
 
     /* */
     uint32_t        render_time;           /**< last picture render time */



More information about the vlc-commits mailing list