]> git.sesse.net Git - vlc/commitdiff
* ./plugins/filter/*: filters are now configurable through the configuration
authorSam Hocevar <sam@videolan.org>
Mon, 27 May 2002 19:35:41 +0000 (19:35 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 27 May 2002 19:35:41 +0000 (19:35 +0000)
    system. Patch from Sigmund Augdal <sigmunau@stud.ntnu.no>.

plugins/filter/clone.c
plugins/filter/deinterlace.c
plugins/filter/distort.c
plugins/filter/transform.c
plugins/filter/wall.c

index 2a85275a35aa1439e61d58bdee1268f068377693..2e866587bbf096bf4264db1c80ee75e29bbf46bd 100644 (file)
@@ -2,7 +2,7 @@
  * clone.c : Clone video plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: clone.c,v 1.2 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: clone.c,v 1.3 2002/05/27 19:35:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -44,6 +44,9 @@ static void vout_getfunctions( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_INTEGER ( "clone_count", 2, NULL, N_("Number of clones"),
+              N_("Select the number of videowindows in which to clone the video") )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -109,7 +112,6 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method, *psz_method_orig;
 
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
@@ -120,27 +122,7 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    if( !(psz_method = psz_method_orig = config_GetPszVariable( "filter" )) )
-    {
-        intf_ErrMsg( "vout error: configuration variable %s empty", "filter" );
-        return( 1 );
-    }
-
-    while( *psz_method && *psz_method != ':' )
-    {
-        psz_method++;
-    }
-
-    if( *psz_method )
-    {
-        p_vout->p_sys->i_clones = atoi( psz_method + 1 );
-    }
-    else
-    {
-        intf_ErrMsg( "vout error: "
-                     "no valid clone count provided, using clone:2" );
-        p_vout->p_sys->i_clones = 2;
-    }
+    p_vout->p_sys->i_clones = config_GetIntVariable( "clone_count" );
 
     p_vout->p_sys->i_clones = __MAX( 1, __MIN( 99, p_vout->p_sys->i_clones ) );
 
@@ -152,13 +134,10 @@ static int vout_Create( vout_thread_t *p_vout )
     if( p_vout->p_sys->pp_vout == NULL )
     {
         intf_ErrMsg( "vout error: out of memory" );
-        free( psz_method_orig );
         free( p_vout->p_sys );
         return( 1 );
     }
 
-    free( psz_method_orig );
-
     return( 0 );
 }
 
index 7174cd7eed36a17eff7617a59dbfcb7afe6e0bf9..fa058713ccc62308b7ac67364a388331c20642d4 100644 (file)
@@ -2,7 +2,7 @@
  * deinterlace.c : deinterlacer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.10 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: deinterlace.c,v 1.11 2002/05/27 19:35:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -49,6 +49,9 @@ static void *memblend( void *, const void *, const void *, size_t );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_STRING  ( "deinterlace_mode", "bob", NULL, N_("Deinterlace mode"),
+              N_("one of 'bob' and 'blend'") )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -113,7 +116,7 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method, *psz_method_tmp;
+    char *psz_method;
 
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
@@ -124,24 +127,18 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    if( !(psz_method = psz_method_tmp
-          = config_GetPszVariable( "filter" )) )
+    if( !(psz_method = config_GetPszVariable( "filter" )) )
     {
         intf_ErrMsg( "vout error: configuration variable %s empty",
                      "filter" );
         return( 1 );
     }
 
-    while( *psz_method && *psz_method != ':' )
-    {
-        psz_method++;
-    }
-
-    if( !strcmp( psz_method, ":bob" ) )
+    if( !strcmp( psz_method, "bob" ) )
     {
         p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
     }
-    else if( !strcmp( psz_method, ":blend" ) )
+    else if( !strcmp( psz_method, "blend" ) )
     {
         p_vout->p_sys->i_mode = DEINTERLACE_MODE_BLEND;
     }
@@ -152,7 +149,7 @@ static int vout_Create( vout_thread_t *p_vout )
         p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
     }
 
-    free( psz_method_tmp );
+    free( psz_method );
 
     return( 0 );
 }
index b25bc8eca5a4e452f28ad01b5a526d936a4bf85f..e646aa1b7707309252628ee0786b66430c0e5f73 100644 (file)
@@ -2,7 +2,7 @@
  * distort.c : Misc video effects plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: distort.c,v 1.11 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: distort.c,v 1.12 2002/05/27 19:35:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -49,6 +49,9 @@ static void vout_getfunctions( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_STRING  ( "distort_mode", "wave", NULL, N_("distort mode"),
+              N_("one of \"wave\" and \"ripple\"") )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -130,8 +133,8 @@ static int vout_Create( vout_thread_t *p_vout )
         intf_ErrMsg("error: %s", strerror(ENOMEM) );
         return( 1 );
     }
-
-    /* Look what method was requested */
+    p_vout->p_sys->i_mode = 0;
+    /* Look what method was requested from command line*/
     if( !(psz_method = psz_method_tmp
           = config_GetPszVariable( "filter" )) )
     {
@@ -139,7 +142,6 @@ static int vout_Create( vout_thread_t *p_vout )
                      "filter" );
         return( 1 );
     }
-
     while( *psz_method && *psz_method != ':' )
     {
         psz_method++;
@@ -153,18 +155,43 @@ static int vout_Create( vout_thread_t *p_vout )
     {
         p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
     }
-    else
+    free( psz_method_tmp );
+    if( !p_vout->p_sys->i_mode )
     {
-        intf_ErrMsg( "filter error: no valid distort mode provided, "
-                     "using distort:wave" );
-        p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
+        /* No method given in commandline. Look what method was
+         requested in configuration system */
+        if( !(psz_method = psz_method_tmp
+              = config_GetPszVariable( "distort_mode" )) )
+        {
+            intf_ErrMsg( "vout error: configuration variable %s empty "
+                         "using wave",
+                         "distort_mode" );
+            p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
+        }
+        else {
+        
+            if( !strcmp( psz_method, "wave" ) )
+            {
+                p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
+            }
+            else if( !strcmp( psz_method, "ripple" ) )
+            {
+                p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
+            }
+            
+            else
+            {
+                intf_ErrMsg( "filter error: no valid distort mode provided, "
+                             "using distort:wave" );
+                p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
+            }
+        }
     }
-
     free( psz_method_tmp );
-
+    
     return( 0 );
 }
-
+    
 /*****************************************************************************
  * vout_Init: initialize Distort video thread output method
  *****************************************************************************/
index d98d5a96038bd51f4a6dbbd0fb62929cbf47522a..7af68eabbbbd82fc13a97753f0604afec49761c8 100644 (file)
@@ -2,7 +2,7 @@
  * transform.c : transform image plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: transform.c,v 1.10 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: transform.c,v 1.11 2002/05/27 19:35:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -50,6 +50,9 @@ static void vout_getfunctions( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_STRING("transform_type", "90", NULL, N_("Transform type"),
+           N_("One of '90', '180', '270', 'hflip' and 'vflip'"))
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -126,51 +129,51 @@ static int vout_Create( vout_thread_t *p_vout )
 
     /* Look what method was requested */
     if( !(psz_method = psz_method_tmp
-          = config_GetPszVariable( "filter" )) )
+          = config_GetPszVariable( "transform_type" )) )
     {
         intf_ErrMsg( "vout error: configuration variable %s empty",
-                     "filter" );
-        return( 1 );
-    }
-
-    while( *psz_method && *psz_method != ':' )
-    {
-        psz_method++;
-    }
-
-    if( !strcmp( psz_method, ":hflip" ) )
-    {
-        p_vout->p_sys->i_mode = TRANSFORM_MODE_HFLIP;
-        p_vout->p_sys->b_rotation = 0;
-    }
-    else if( !strcmp( psz_method, ":vflip" ) )
-    {
-        p_vout->p_sys->i_mode = TRANSFORM_MODE_VFLIP;
-        p_vout->p_sys->b_rotation = 0;
-    }
-    else if( !strcmp( psz_method, ":90" ) )
-    {
+                     "transform_type" );
+        intf_ErrMsg( "filter error: no valid transform mode provided, "
+                     "using '90'" );
         p_vout->p_sys->i_mode = TRANSFORM_MODE_90;
         p_vout->p_sys->b_rotation = 1;
     }
-    else if( !strcmp( psz_method, ":180" ) )
-    {
-        p_vout->p_sys->i_mode = TRANSFORM_MODE_180;
-        p_vout->p_sys->b_rotation = 0;
-    }
-    else if( !strcmp( psz_method, ":270" ) )
-    {
-        p_vout->p_sys->i_mode = TRANSFORM_MODE_270;
-        p_vout->p_sys->b_rotation = 1;
-    }
     else
     {
-        intf_ErrMsg( "filter error: no valid transform mode provided, "
-                     "using transform:90" );
-        p_vout->p_sys->i_mode = TRANSFORM_MODE_90;
-        p_vout->p_sys->b_rotation = 1;
+        if( !strcmp( psz_method, "hflip" ) )
+        {
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_HFLIP;
+            p_vout->p_sys->b_rotation = 0;
+        }
+        else if( !strcmp( psz_method, "vflip" ) )
+        {
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_VFLIP;
+            p_vout->p_sys->b_rotation = 0;
+        }
+        else if( !strcmp( psz_method, "90" ) )
+        {
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_90;
+            p_vout->p_sys->b_rotation = 1;
+        }
+        else if( !strcmp( psz_method, "180" ) )
+        {
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_180;
+            p_vout->p_sys->b_rotation = 0;
+        }
+        else if( !strcmp( psz_method, "270" ) )
+        {
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_270;
+            p_vout->p_sys->b_rotation = 1;
+        }
+        else
+        {
+            intf_ErrMsg( "filter error: no valid transform mode provided, "
+                         "using '90'" );
+            p_vout->p_sys->i_mode = TRANSFORM_MODE_90;
+            p_vout->p_sys->b_rotation = 1;
+        }
     }
-
+    
     free( psz_method_tmp );
 
     return( 0 );
index 2599dcdb32bc4ae7926f999688c1932a2fb9d23a..e2326fa6588e573ae97f4cb70f4f0b502aa1e3bd 100644 (file)
@@ -2,7 +2,7 @@
  * wall.c : Wall video plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: wall.c,v 1.17 2002/05/19 12:57:32 gbazin Exp $
+ * $Id: wall.c,v 1.18 2002/05/27 19:35:41 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -44,6 +44,15 @@ static void vout_getfunctions( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_INTEGER ( "wall_cols", 3, NULL, N_("Number of columns"),
+              N_("Select the number of horizontal videowindows in which "
+                 "to split the video") )
+ADD_INTEGER ( "wall_rows", 3, NULL, N_("Number of rows"),
+              N_("Select the number of vertical videowindows in which "
+                 "to split the video") )
+ADD_STRING ( "wall_active", NULL, NULL, N_("Active windows"),
+             N_("comma separated list of active windows, defaults to all") )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -129,73 +138,8 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    if( !(psz_method = psz_method_tmp
-          = config_GetPszVariable( "filter" )) )
-    {
-        intf_ErrMsg( "vout error: configuration variable %s empty",
-                     "filter" );
-        return( 1 );
-    }
-
-    while( *psz_method && *psz_method != ':' )
-    {
-        psz_method++;
-    }
-
-    if( *psz_method )
-    {
-        psz_method++;
-        psz_tmp = psz_method;
-
-        while( *psz_tmp && *psz_tmp != 'x' && *psz_tmp != ':' )
-        {
-            psz_tmp++;
-        }
-
-        if( *psz_tmp == 'x' )
-        {
-           *psz_tmp = '\0';
-           p_vout->p_sys->i_col = atoi( psz_method );
-
-           psz_tmp++;
-           psz_method = psz_tmp;
-
-           while(  *psz_tmp && *psz_tmp != ':' )
-           {
-              psz_tmp++;
-           }
-
-           if( *psz_tmp )
-           {
-               *psz_tmp = '\0';
-               p_vout->p_sys->i_row = atoi( psz_method );
-               psz_method = psz_tmp + 1;
-           }
-           else
-           {
-               p_vout->p_sys->i_row = atoi( psz_method );
-               psz_method = NULL;
-           }
-        }
-        else if( *psz_tmp == ':' )
-        { 
-            p_vout->p_sys->i_col = p_vout->p_sys->i_row = atoi( psz_method );
-            psz_method = psz_tmp + 1;
-        }
-        else
-        { 
-            p_vout->p_sys->i_col = p_vout->p_sys->i_row = atoi( psz_method );
-            psz_method = NULL;
-        }
-    }
-    else
-    {
-        intf_ErrMsg( "filter error: no valid wall size provided, "
-                     "using wall:3x3" );
-        p_vout->p_sys->i_col = 3;
-        p_vout->p_sys->i_row = 3;
-        psz_method = NULL;
-    }
+    p_vout->p_sys->i_col = config_GetIntVariable( "wall_cols" );
+    p_vout->p_sys->i_row = config_GetIntVariable( "wall_rows" );
 
     p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
     p_vout->p_sys->i_row = __MAX( 1, __MIN( 15, p_vout->p_sys->i_row ) );
@@ -214,6 +158,8 @@ static int vout_Create( vout_thread_t *p_vout )
         return( 1 );
     }
 
+    psz_method_tmp = psz_method = config_GetPszVariable( "wall_active" );
+
     /* If no trailing vout are specified, take them all */
     if( psz_method == NULL )
     {