]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/clone.c
* include/configuration.h: added a new flag to the configuration stucture to
[vlc] / modules / video_filter / clone.c
index d2fa5109ad550c216937ff11b3fc40174696b43d..5c0b775012d9e1425cbc0a20150227c6b6506025 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * clone.c : Clone video plugin for vlc
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: clone.c,v 1.4 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2002, 2003 VideoLAN
+ * $Id: clone.c,v 1.7 2003/02/20 01:52:46 sigmunau Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -44,16 +44,19 @@ static void Render    ( vout_thread_t *, picture_t * );
 
 static void RemoveAllVout  ( vout_thread_t *p_vout );
 
+static int  SendEvents( vlc_object_t *, char const *,
+                        vlc_value_t, vlc_value_t, void * );
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define COUNT_TEXT N_("Number of clones")
+#define COUNT_TEXT N_("number of clones")
 #define COUNT_LONGTEXT N_("Select the number of video windows in which to "\
     "clone the video")
 
 vlc_module_begin();
-    add_category_hint( N_("Miscellaneous"), NULL );
-    add_integer( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT );
+    add_category_hint( N_("Clone"), NULL, VLC_FALSE );
+    add_integer( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT, VLC_FALSE );
     set_description( _("image clone video module") );
     set_capability( "video filter", 0 );
     add_shortcut( "clone" );
@@ -86,7 +89,7 @@ static int Create( vlc_object_t *p_this )
     if( p_vout->p_sys == NULL )
     {
         msg_Err( p_vout, "out of memory" );
-        return( 1 );
+        return VLC_ENOMEM;
     }
 
     p_vout->pf_init = Init;
@@ -108,10 +111,10 @@ static int Create( vlc_object_t *p_this )
     {
         msg_Err( p_vout, "out of memory" );
         free( p_vout->p_sys );
-        return( 1 );
+        return VLC_ENOMEM;
     }
 
-    return( 0 );
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -144,13 +147,14 @@ static int Init( vout_thread_t *p_vout )
                              p_vout->p_sys->i_clones );
             p_vout->p_sys->i_clones = i_vout;
             RemoveAllVout( p_vout );
-            return 0;
+            return VLC_EGENERIC;
         }
+        ADD_CALLBACKS( p_vout->p_sys->pp_vout[ i_vout ], SendEvents );
     }
 
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
-    return( 0 );
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -257,7 +261,20 @@ static void RemoveAllVout( vout_thread_t *p_vout )
     while( p_vout->p_sys->i_clones )
     {
          --p_vout->p_sys->i_clones;
+         DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones],
+                        SendEvents );
          vout_Destroy( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
     }
 }
 
+/*****************************************************************************
+ * 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;
+}
+