]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/distort.c
* modules/visualization/visual/:
[vlc] / modules / video_filter / distort.c
index e4768d3cb76cdc447ed177bd19e7a6876c922fcd..f4d8958e08a97c33fa0ba5e0356fb922f7f2565b 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * distort.c : Misc video effects plugin for vlc
  *****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: distort.c,v 1.5 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: distort.c,v 1.11 2003/10/15 22:49:48 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -50,19 +50,22 @@ static void Render    ( vout_thread_t *, picture_t * );
 static void DistortWave    ( vout_thread_t *, picture_t *, picture_t * );
 static void DistortRipple  ( vout_thread_t *, picture_t *, picture_t * );
 
+static int  SendEvents   ( vlc_object_t *, char const *,
+                           vlc_value_t, vlc_value_t, void * );
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define MODE_TEXT N_("distort mode")
+#define MODE_TEXT N_("Distort mode")
 #define MODE_LONGTEXT N_("Distort mode, one of \"wave\" and \"ripple\"")
 
 static char *mode_list[] = { "wave", "ripple", NULL };
 
 vlc_module_begin();
-    add_category_hint( N_("Miscellaneous"), NULL );
+    add_category_hint( N_("Distort"), NULL, VLC_FALSE );
     add_string_from_list( "distort-mode", "wave", mode_list, NULL,
-                          MODE_TEXT, MODE_LONGTEXT );
-    set_description( _("miscellaneous video effects module") );
+                          MODE_TEXT, MODE_LONGTEXT, VLC_FALSE );
+    set_description( _("miscellaneous distort video effects filter") );
     set_capability( "video filter", 0 );
     add_shortcut( "distort" );
     set_callbacks( Create, Destroy );
@@ -196,6 +199,10 @@ static int Init( vout_thread_t *p_vout )
 
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
+    ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
+    ADD_PARENT_CALLBACKS( SendEventsToChild );
+
     p_vout->p_sys->f_angle = 0.0;
     p_vout->p_sys->last_date = 0;
 
@@ -226,8 +233,12 @@ static void Destroy( vlc_object_t *p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
 
+    DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+    vlc_object_detach( p_vout->p_sys->p_vout );
     vout_Destroy( p_vout->p_sys->p_vout );
 
+    DEL_PARENT_CALLBACKS( SendEventsToChild );
+
     free( p_vout->p_sys );
 }
 
@@ -418,3 +429,25 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
         }
     }
 }
+
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+                       vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+    var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+    return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * SendEventsToChild: forward events to the child/children vout
+ *****************************************************************************/
+static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
+                       vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+    vout_thread_t *p_vout = (vout_thread_t *)p_this;
+    var_Set( p_vout->p_sys->p_vout, psz_var, newval );
+    return VLC_SUCCESS;
+}