]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/distort.c
* Stringreview !!!
[vlc] / modules / video_filter / distort.c
index f4d8958e08a97c33fa0ba5e0356fb922f7f2565b..ab27a8280e322d9a17927d621a0981bb9c3e8548 100644 (file)
@@ -2,7 +2,7 @@
  * distort.c : Misc video effects plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: distort.c,v 1.11 2003/10/15 22:49:48 gbazin Exp $
+ * $Id: distort.c,v 1.14 2004/01/25 20:05:28 hartman Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -59,14 +59,17 @@ static int  SendEvents   ( vlc_object_t *, char const *,
 #define MODE_TEXT N_("Distort mode")
 #define MODE_LONGTEXT N_("Distort mode, one of \"wave\" and \"ripple\"")
 
-static char *mode_list[] = { "wave", "ripple", NULL };
+static char *mode_list[] = { "wave", "ripple" };
+static char *mode_list_text[] = { N_("Wave"), N_("Ripple") };
 
 vlc_module_begin();
-    add_category_hint( N_("Distort"), NULL, VLC_FALSE );
-    add_string_from_list( "distort-mode", "wave", mode_list, NULL,
-                          MODE_TEXT, MODE_LONGTEXT, VLC_FALSE );
-    set_description( _("miscellaneous distort video effects filter") );
+    set_description( _("Distort video filter") );
     set_capability( "video filter", 0 );
+
+    add_string( "distort-mode", "wave", NULL, MODE_TEXT, MODE_LONGTEXT,
+                VLC_FALSE );
+        change_string_list( mode_list, mode_list_text, 0 );
+
     add_shortcut( "distort" );
     set_callbacks( Create, Destroy );
 vlc_module_end();
@@ -112,53 +115,30 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
 
     p_vout->p_sys->i_mode = 0;
-    /* Look what method was requested from command line*/
-    if( !(psz_method = psz_method_tmp = config_GetPsz( p_vout, "filter" )) )
-    {
-        msg_Err( p_vout, "configuration variable %s empty", "filter" );
-        return VLC_EGENERIC;
-    }
-    while( *psz_method && *psz_method != ':' )
-    {
-        psz_method++;
-    }
 
-    if( !strcmp( psz_method, ":wave" ) )
+    if( !(psz_method = psz_method_tmp
+          = config_GetPsz( p_vout, "distort-mode" )) )
     {
+        msg_Err( p_vout, "configuration variable %s empty, using 'wave'",
+                         "distort-mode" );
         p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
     }
-    else if( !strcmp( psz_method, ":ripple" ) )
-    {
-        p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
-    }
-    free( psz_method_tmp );
-    if( !p_vout->p_sys->i_mode )
+    else
     {
-        /* No method given in commandline. Look what method was
-         requested in configuration system */
-        if( !(psz_method = psz_method_tmp
-              = config_GetPsz( p_vout, "distort-mode" )) )
+
+        if( !strcmp( psz_method, "wave" ) )
         {
-            msg_Err( p_vout, "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
-            {
-                msg_Err( p_vout, "no valid distort mode provided, "
-                                 "using 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
+        {
+            msg_Err( p_vout, "no valid distort mode provided, "
+                             "using wave" );
+            p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
         }
     }
     free( psz_method_tmp );