Add support for config chain option parsing.
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 25 Mar 2007 14:48:56 +0000 (14:48 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 25 Mar 2007 14:48:56 +0000 (14:48 +0000)
modules/video_filter/clone.c
modules/video_filter/logo.c
modules/video_filter/panoramix.c
modules/video_filter/puzzle.c
modules/video_filter/transform.c
modules/video_filter/wall.c

index 98048b6..f6da249 100644 (file)
@@ -60,6 +60,8 @@ static int  SendEvents( vlc_object_t *, char const *,
 #define VOUTLIST_LONGTEXT N_("You can use specific video output modules " \
         "for the clones. Use a comma-separated list of modules." )
 
+#define CFG_PREFIX "clone-"
+
 vlc_module_begin();
     set_description( _("Clone video filter") );
     set_capability( "video filter", 0 );
@@ -67,13 +69,17 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
 
-    add_integer( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT, VLC_FALSE );
-    add_string ( "clone-vout-list", NULL, NULL, VOUTLIST_TEXT, VOUTLIST_LONGTEXT, VLC_TRUE );
+    add_integer( CFG_PREFIX "count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT, VLC_FALSE );
+    add_string ( CFG_PREFIX "vout-list", NULL, NULL, VOUTLIST_TEXT, VOUTLIST_LONGTEXT, VLC_TRUE );
 
     add_shortcut( "clone" );
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
+static const char *ppsz_filter_options[] = {
+    "count", "vout-list", NULL
+};
+
 /*****************************************************************************
  * vout_sys_t: Clone video output method descriptor
  *****************************************************************************
@@ -130,7 +136,11 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
-    psz_clonelist = config_GetPsz( p_vout, "clone-vout-list" );
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                       p_vout->p_cfg );
+
+    psz_clonelist = var_CreateGetNonEmptyString( p_vout,
+                                                 CFG_PREFIX "vout-list" );
     if( psz_clonelist )
     {
         int i_dummy;
@@ -178,7 +188,8 @@ static int Create( vlc_object_t *p_this )
     {
         /* No list was specified. We will use the default vout, and get
          * the number of clones from clone-count */
-        p_vout->p_sys->i_clones = config_GetInt( p_vout, "clone-count" );
+        p_vout->p_sys->i_clones =
+            var_CreateGetInteger( p_vout, CFG_PREFIX "count" );
         p_vout->p_sys->ppsz_vout_list = NULL;
     }
 
index 4c4978c..8857ad5 100644 (file)
@@ -304,7 +304,6 @@ static int Create( vlc_object_t *p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     vout_sys_t *p_sys;
-    vlc_value_t val;
     logo_list_t *p_logo_list;
 
     /* Allocate structure */
@@ -329,22 +328,25 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
-    p_logo_list->psz_filename = var_CreateGetStringCommand( p_this,
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                       p_vout->p_cfg );
+
+    p_logo_list->psz_filename = var_CreateGetStringCommand( p_vout,
                                                             "logo-file" );
     if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename )
     {
-        msg_Err( p_this, "logo file not specified" );
+        msg_Err( p_vout, "logo file not specified" );
         return 0;
     }
 
-    p_sys->pos = var_CreateGetIntegerCommand( p_this, "logo-position" );
-    p_sys->posx = var_CreateGetIntegerCommand( p_this, "logo-x" );
-    p_sys->posy = var_CreateGetIntegerCommand( p_this, "logo-y" );
+    p_sys->pos = var_CreateGetIntegerCommand( p_vout, "logo-position" );
+    p_sys->posx = var_CreateGetIntegerCommand( p_vout, "logo-x" );
+    p_sys->posy = var_CreateGetIntegerCommand( p_vout, "logo-y" );
     p_logo_list->i_delay = __MAX( __MIN(
-        var_CreateGetIntegerCommand( p_this, "logo-delay" ) , 60000 ), 0 );
-    p_logo_list->i_repeat = var_CreateGetIntegerCommand( p_this, "logo-repeat");
+        var_CreateGetIntegerCommand( p_vout, "logo-delay" ) , 60000 ), 0 );
+    p_logo_list->i_repeat = var_CreateGetIntegerCommand( p_vout, "logo-repeat");
     p_logo_list->i_alpha = __MAX( __MIN(
-        var_CreateGetIntegerCommand( p_this, "logo-transparency" ), 255 ), 0 );
+        var_CreateGetIntegerCommand( p_vout, "logo-transparency" ), 255 ), 0 );
 
     LoadLogoList( p_vout, p_logo_list );
 
@@ -715,7 +717,6 @@ static int CreateFilter( vlc_object_t *p_this )
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-
     /* Hook used for callback variables */
     p_logo_list->psz_filename =
         var_CreateGetStringCommand( p_filter, "logo-file" );
index 62f74af..fcb4526 100644 (file)
@@ -87,6 +87,8 @@ static int  SendEvents( vlc_object_t *, char const *,
 #define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \
     "defaults to all")
 
+#define CFG_PREFIX "panoramix-"
+
 vlc_module_begin();
     set_description( N_("Panoramix: wall with overlap video filter") );
     set_shortname( _("Panoramix" ));
@@ -94,53 +96,55 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
 
-    add_integer( "panoramix-cols", -1, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_TRUE );
-    add_integer( "panoramix-rows", -1, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_TRUE );
+    add_integer( CFG_PREFIX "cols", -1, NULL,
+                 COLS_TEXT, COLS_LONGTEXT, VLC_TRUE );
+    add_integer( CFG_PREFIX "rows", -1, NULL,
+                 ROWS_TEXT, ROWS_LONGTEXT, VLC_TRUE );
 
 #ifdef OVERLAP
 #define OFFSET_X_TEXT N_("Offset X offset (automatic compensation)")
 #define OFFSET_X_LONGTEXT N_("Select if you want an automatic offset in horizontal (in case of misalignment due to autoratio control)")
-    add_bool( "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, VLC_TRUE );
+    add_bool( CFG_PREFIX "offset-x", 1, NULL, OFFSET_X_TEXT, OFFSET_X_LONGTEXT, VLC_TRUE );
 
 #define LENGTH_TEXT N_("length of the overlapping area (in %)")
 #define LENGTH_LONGTEXT N_("Select in percent the length of the blended zone")
-    add_integer_with_range( "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-length", 100, 0, 100, NULL, LENGTH_TEXT, LENGTH_LONGTEXT, VLC_TRUE );
 
 #define HEIGHT_TEXT N_("height of the overlapping area (in %)")
 #define HEIGHT_LONGTEXT N_("Select in percent the height of the blended zone (case of 2x2 wall)")
-    add_integer_with_range( "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-height", 100, 0, 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
 
 #define ATTENUATION_TEXT N_("Attenuation")
 #define ATTENUATION_LONGTEXT N_("Check this option if you want attenuate blended zone by this plug-in (if option is unchecked, attenuate is made by opengl)")
-    add_bool( "panoramix-attenuate", 1, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, VLC_FALSE );
+    add_bool( CFG_PREFIX "attenuate", 1, NULL, ATTENUATION_TEXT, ATTENUATION_LONGTEXT, VLC_FALSE );
 
 #define BEGIN_TEXT N_("Attenuation, begin (in %)")
 #define BEGIN_LONGTEXT N_("Select in percent the Lagrange coeff of the beginning blended zone")
-    add_integer_with_range( "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-begin", 0, 0, 100, NULL, BEGIN_TEXT, BEGIN_LONGTEXT, VLC_TRUE );
 
 #define MIDDLE_TEXT N_("Attenuation, middle (in %)")
 #define MIDDLE_LONGTEXT N_("Select in percent the Lagrange coeff of the middle of blended zone")
-    add_integer_with_range( "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, VLC_FALSE );
+    add_integer_with_range( CFG_PREFIX "bz-middle", 50, 0, 100, NULL, MIDDLE_TEXT, MIDDLE_LONGTEXT, VLC_FALSE );
 
 #define END_TEXT N_("Attenuation, end (in %)")
 #define END_LONGTEXT N_("Select in percent the Lagrange coeff of the end of blended zone")
-    add_integer_with_range( "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-end", 100, 0, 100, NULL, END_TEXT, END_LONGTEXT, VLC_TRUE );
 
 #define MIDDLE_POS_TEXT N_("middle position (in %)")
 #define MIDDLE_POS_LONGTEXT N_("Select in percent (50 is center) the position of the middle point (Lagrange) of blended zone")
-    add_integer_with_range( "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, VLC_FALSE );
+    add_integer_with_range( CFG_PREFIX "bz-middle-pos", 50, 1, 99, NULL, MIDDLE_POS_TEXT, MIDDLE_POS_LONGTEXT, VLC_FALSE );
 #ifdef GAMMA
 #define RGAMMA_TEXT N_("Gamma (Red) correction")
 #define RGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Red or Y component)")
-    add_float_with_range( "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, VLC_TRUE );
+    add_float_with_range( CFG_PREFIX "bz-gamma-red", 1, 0, 5, NULL, RGAMMA_TEXT, RGAMMA_LONGTEXT, VLC_TRUE );
 
 #define GGAMMA_TEXT N_("Gamma (Green) correction")
 #define GGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Green or U component)")
-    add_float_with_range( "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, VLC_TRUE );
+    add_float_with_range( CFG_PREFIX "bz-gamma-green", 1, 0, 5, NULL, GGAMMA_TEXT, GGAMMA_LONGTEXT, VLC_TRUE );
 
 #define BGAMMA_TEXT N_("Gamma (Blue) correction")
 #define BGAMMA_LONGTEXT N_("Select the gamma for the correction of blended zone (Blue or V component)")
-    add_float_with_range( "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, VLC_TRUE );
+    add_float_with_range( CFG_PREFIX "bz-gamma-blue", 1, 0, 5, NULL, BGAMMA_TEXT, BGAMMA_LONGTEXT, VLC_TRUE );
 #endif
 #define RGAMMA_BC_TEXT N_("Black Crush for Red")
 #define RGAMMA_BC_LONGTEXT N_("Select the Black Crush of blended zone (Red or Y component)")
@@ -169,31 +173,42 @@ vlc_module_begin();
 #define GGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Green or U component)")
 #define BGAMMA_WL_TEXT N_("White Level for Blue")
 #define BGAMMA_WL_LONGTEXT N_("Select the White Level of blended zone (Blue or V component)")
-    add_integer_with_range( "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, VLC_TRUE );
-    add_integer_with_range( "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-red", 140, 0, 255, NULL, RGAMMA_BC_TEXT, RGAMMA_BC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-green", 140, 0, 255, NULL, GGAMMA_BC_TEXT, GGAMMA_BC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blackcrush-blue", 140, 0, 255, NULL, BGAMMA_BC_TEXT, BGAMMA_BC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-red", 200, 0, 255, NULL, RGAMMA_WC_TEXT, RGAMMA_WC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-green", 200, 0, 255, NULL, GGAMMA_WC_TEXT, GGAMMA_WC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitecrush-blue", 200, 0, 255, NULL, BGAMMA_WC_TEXT, BGAMMA_WC_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-red", 150, 0, 255, NULL, RGAMMA_BL_TEXT, RGAMMA_BL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-green", 150, 0, 255, NULL, GGAMMA_BL_TEXT, GGAMMA_BL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-blacklevel-blue", 150, 0, 255, NULL, BGAMMA_BL_TEXT, BGAMMA_BL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-red", 0, 0, 255, NULL, RGAMMA_WL_TEXT, RGAMMA_WL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-green", 0, 0, 255, NULL, GGAMMA_WL_TEXT, GGAMMA_WL_LONGTEXT, VLC_TRUE );
+    add_integer_with_range( CFG_PREFIX "bz-whitelevel-blue", 0, 0, 255, NULL, BGAMMA_WL_TEXT, BGAMMA_WL_LONGTEXT, VLC_TRUE );
 #ifndef SYS_MINGW32
 #define XINERAMA_TEXT N_("Xinerama option")
 #define XINERAMA_LONGTEXT N_("Uncheck if you have not used xinerama")
-    add_bool( "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, VLC_TRUE );
+    add_bool( CFG_PREFIX "xinerama", 1, NULL, XINERAMA_TEXT, XINERAMA_LONGTEXT, VLC_TRUE );
 #endif
 #endif
 
-    add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, VLC_TRUE );
+    add_string( CFG_PREFIX "active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, VLC_TRUE );
 
     add_shortcut( "panoramix" );
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
+static const char *ppsz_filter_options[] = {
+    "cols", "rows", "offset-x", "bz-length", "bz-height", "attenuate",
+    "bz-begin", "bz-middle", "bz-end", "bz-middle-pos", "bz-gamma-red",
+    "bz-gamma-green", "bz-gamma-blue", "bz-blackcrush-red",
+    "bz-blackcrush-green", "bz-blackcrush-blue", "bz-whitecrush-red",
+    "bz-whitecrush-green", "bz-whitecrush-blue", "bz-blacklevel-red",
+    "bz-blacklevel-green", "bz-blacklevel-blue", "bz-whitelevel-red",
+    "bz-whitelevel-green", "bz-whitelevel-blue", "xinerama", "active",
+    NULL
+};
+
 /*****************************************************************************
  * vout_sys_t: Wall video output method descriptor
  *****************************************************************************
@@ -335,9 +350,12 @@ case VLC_FOURCC('c','y','u','v'):    // packed by 2
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                       p_vout->p_cfg );
+
     /* Look what method was requested */
-    p_vout->p_sys->i_col = var_CreateGetInteger( p_vout, "panoramix-cols" );
-    p_vout->p_sys->i_row = var_CreateGetInteger( p_vout, "panoramix-rows" );
+    p_vout->p_sys->i_col = var_CreateGetInteger( p_vout, CFG_PREFIX "cols" );
+    p_vout->p_sys->i_row = var_CreateGetInteger( p_vout, CFG_PREFIX "rows" );
 
 // OS dependant code :  Autodetect number of displays in wall
 #ifdef SYS_MINGW32
@@ -360,41 +378,41 @@ case VLC_FOURCC('c','y','u','v'):    // packed by 2
                 p_vout->p_sys->i_row = 1;
             }
         }
-        var_SetInteger( p_vout, "panoramix-cols", p_vout->p_sys->i_col);
-        var_SetInteger( p_vout, "panoramix-rows", p_vout->p_sys->i_row);
+        var_SetInteger( p_vout, CFG_PREFIX "cols", p_vout->p_sys->i_col);
+        var_SetInteger( p_vout, CFG_PREFIX "rows", p_vout->p_sys->i_row);
     }
 #endif
 
 #ifdef OVERLAP
-    p_vout->p_sys->i_offset_x = var_CreateGetInteger( p_vout, "offset-x" );
+    p_vout->p_sys->i_offset_x = var_CreateGetInteger( p_vout, CFG_PREFIX "offset-x" );
     if (p_vout->p_sys->i_col > 2) p_vout->p_sys->i_offset_x = 0; // offset-x is used in case of 2x1 wall & autocrop
     p_vout->p_sys->b_autocrop = !(var_CreateGetInteger( p_vout, "crop-ratio" ) == 0);
-    if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = var_CreateGetInteger( p_vout, "autocrop" );            
-    p_vout->p_sys->b_attenuate = var_CreateGetInteger( p_vout, "panoramix-attenuate");
-    p_vout->p_sys->bz_length = var_CreateGetInteger( p_vout, "bz-length" );
+    if (!p_vout->p_sys->b_autocrop) p_vout->p_sys->b_autocrop = var_CreateGetInteger( p_vout, "autocrop" );
+    p_vout->p_sys->b_attenuate = var_CreateGetInteger( p_vout, CFG_PREFIX "attenuate");
+    p_vout->p_sys->bz_length = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-length" );
     if (p_vout->p_sys->i_row > 1)
-        p_vout->p_sys->bz_height = var_CreateGetInteger( p_vout, "bz-height" );
+        p_vout->p_sys->bz_height = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-height" );
     else
         p_vout->p_sys->bz_height = 100;
-    p_vout->p_sys->bz_begin = var_CreateGetInteger( p_vout, "bz-begin" );
-    p_vout->p_sys->bz_middle = var_CreateGetInteger( p_vout, "bz-middle" );
-    p_vout->p_sys->bz_end = var_CreateGetInteger( p_vout, "bz-end" );
-    p_vout->p_sys->bz_middle_pos = var_CreateGetInteger( p_vout, "bz-middle-pos" );
+    p_vout->p_sys->bz_begin = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-begin" );
+    p_vout->p_sys->bz_middle = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-middle" );
+    p_vout->p_sys->bz_end = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-end" );
+    p_vout->p_sys->bz_middle_pos = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-middle-pos" );
     double d_p = 100.0 / p_vout->p_sys->bz_middle_pos;
     p_vout->p_sys->i_ratio_max = var_CreateGetInteger( p_vout, "autocrop-ratio-max" ); // in crop module with autocrop ...
-    p_vout->p_sys->i_ratio = var_CreateGetInteger( p_vout, "crop-ratio" ); // in crop module with manual ratio ...     
+    p_vout->p_sys->i_ratio = var_CreateGetInteger( p_vout, "crop-ratio" ); // in crop module with manual ratio ...
 
     p_vout->p_sys->a_2 = d_p * p_vout->p_sys->bz_begin - (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle + (double)(d_p / (d_p - 1)) * p_vout->p_sys->bz_end;
     p_vout->p_sys->a_1 = -(d_p + 1) * p_vout->p_sys->bz_begin + (double)(d_p * d_p / (d_p - 1)) * p_vout->p_sys->bz_middle - (double)(1 / (d_p - 1)) * p_vout->p_sys->bz_end;
     p_vout->p_sys->a_0 =  p_vout->p_sys->bz_begin;
 
 #ifdef GAMMA
-    p_vout->p_sys->f_gamma_red = var_CreateGetFloat( p_vout, "bz-gamma-red" );
-    p_vout->p_sys->f_gamma_green = var_CreateGetFloat( p_vout, "bz-gamma-green" );
-    p_vout->p_sys->f_gamma_blue = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
+    p_vout->p_sys->f_gamma_red = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-red" );
+    p_vout->p_sys->f_gamma_green = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
+    p_vout->p_sys->f_gamma_blue = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
 #endif
 #ifndef SYS_MINGW32
-    p_vout->p_sys->b_xinerama= var_CreateGetInteger( p_vout, "xinerama" );
+    p_vout->p_sys->b_xinerama= var_CreateGetInteger( p_vout, CFG_PREFIX "xinerama" );
 #endif
 #else
     p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
@@ -414,7 +432,8 @@ case VLC_FOURCC('c','y','u','v'):    // packed by 2
         return VLC_ENOMEM;
     }
 
-    psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
+    psz_method_tmp =
+    psz_method = var_CreateGetNonEmptyString( p_vout, CFG_PREFIX "active" );
 
     /* If no trailing vout are specified, take them all */
     if( psz_method == NULL )
@@ -538,18 +557,18 @@ static int AdjustHeight( vout_thread_t *p_vout )
             i_window_height = GetSystemMetrics(SM_CYSCREEN);
 #else
             Display *p_display = XOpenDisplay( "" );
-               if (p_vout->p_sys->b_xinerama)
-               {
-                   i_window_width = DisplayWidth(p_display, 0) / p_vout->p_sys->i_col;
-                   i_window_height = DisplayHeight(p_display, 0) / p_vout->p_sys->i_row;
-                }
-               else
-               {
-                   i_window_width = DisplayWidth(p_display, 0);
-                   i_window_height = DisplayHeight(p_display, 0);
-               }
-               XCloseDisplay( p_display );
-               free(p_display);
+            if (p_vout->p_sys->b_xinerama)
+            {
+                i_window_width = DisplayWidth(p_display, 0) / p_vout->p_sys->i_col;
+                i_window_height = DisplayHeight(p_display, 0) / p_vout->p_sys->i_row;
+             }
+            else
+            {
+                i_window_width = DisplayWidth(p_display, 0);
+                i_window_height = DisplayHeight(p_display, 0);
+            }
+               XCloseDisplay( p_display );
+               free(p_display);
 #endif
         var_SetInteger( p_vout, "width", i_window_width);
         var_SetInteger( p_vout, "height", i_window_height);
@@ -629,7 +648,7 @@ static int Init( vout_thread_t *p_vout )
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 #ifdef OVERLAP
     p_vout->p_sys->b_has_changed = p_vout->p_sys->b_attenuate;
-       int i_video_x = var_GetInteger( p_vout, "video-x");
+    int i_video_x = var_GetInteger( p_vout, "video-x");
     int i_video_y = var_GetInteger( p_vout, "video-y");
 #ifdef GAMMA
     if (p_vout->p_sys->b_attenuate)
@@ -640,21 +659,21 @@ static int Init( vout_thread_t *p_vout )
         float    f_BlackLevel[VOUT_MAX_PLANES];
         float    f_WhiteCrush[VOUT_MAX_PLANES];
         float    f_WhiteLevel[VOUT_MAX_PLANES];
-        p_vout->p_sys->f_gamma[0] = var_CreateGetFloat( p_vout, "bz-gamma-red" );
-        p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, "bz-gamma-green" );
-        p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
-        f_BlackCrush[0] = var_CreateGetInteger( p_vout, "bz-blackcrush-red" ) / 255.0;
-        f_BlackCrush[1] = var_CreateGetInteger( p_vout, "bz-blackcrush-green" ) / 255.0;
-        f_BlackCrush[2] = var_CreateGetInteger( p_vout, "bz-blackcrush-blue" ) / 255.0;
-        f_WhiteCrush[0] = var_CreateGetInteger( p_vout, "bz-whitecrush-red" ) / 255.0;
-        f_WhiteCrush[1] = var_CreateGetInteger( p_vout, "bz-whitecrush-green" ) / 255.0;
-        f_WhiteCrush[2] = var_CreateGetInteger( p_vout, "bz-whitecrush-blue" ) / 255.0;
-        f_BlackLevel[0] = var_CreateGetInteger( p_vout, "bz-blacklevel-red" ) / 255.0;
-        f_BlackLevel[1] = var_CreateGetInteger( p_vout, "bz-blacklevel-green" ) / 255.0;
-        f_BlackLevel[2] = var_CreateGetInteger( p_vout, "bz-blacklevel-blue" ) / 255.0;
-        f_WhiteLevel[0] = var_CreateGetInteger( p_vout, "bz-whitelevel-red" ) / 255.0;
-        f_WhiteLevel[1] = var_CreateGetInteger( p_vout, "bz-whitelevel-green" ) / 255.0;
-        f_WhiteLevel[2] = var_CreateGetInteger( p_vout, "bz-whitelevel-blue" ) / 255.0;
+        p_vout->p_sys->f_gamma[0] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-red" );
+        p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
+        p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
+        f_BlackCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-red" ) / 255.0;
+        f_BlackCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;
+        f_BlackCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;
+        f_WhiteCrush[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-red" ) / 255.0;
+        f_WhiteCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;
+        f_WhiteCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;
+        f_BlackLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-red" ) / 255.0;
+        f_BlackLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;
+        f_BlackLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;
+        f_WhiteLevel[0] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-red" ) / 255.0;
+        f_WhiteLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;
+        f_WhiteLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;
         switch (p_vout->render.i_chroma)
         {
         // planar YVU
@@ -665,16 +684,16 @@ static int Init( vout_thread_t *p_vout )
             case VLC_FOURCC('U','Y','N','V'):    // packed by 2
             case VLC_FOURCC('Y','4','2','2'):    // packed by 2
     //        case VLC_FOURCC('c','y','u','v'):    // packed by 2
-                p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, "bz-gamma-green" );
-                p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, "bz-gamma-blue" );
-                f_BlackCrush[2] = var_CreateGetInteger( p_vout, "bz-blackcrush-green" ) / 255.0;
-                f_BlackCrush[1] = var_CreateGetInteger( p_vout, "bz-blackcrush-blue" ) / 255.0;
-                f_WhiteCrush[2] = var_CreateGetInteger( p_vout, "bz-whitecrush-green" ) / 255.0;
-                f_WhiteCrush[1] = var_CreateGetInteger( p_vout, "bz-whitecrush-blue" ) / 255.0;
-                f_BlackLevel[2] = var_CreateGetInteger( p_vout, "bz-blacklevel-green" ) / 255.0;
-                f_BlackLevel[1] = var_CreateGetInteger( p_vout, "bz-blacklevel-blue" ) / 255.0;
-                f_WhiteLevel[2] = var_CreateGetInteger( p_vout, "bz-whitelevel-green" ) / 255.0;
-                f_WhiteLevel[1] = var_CreateGetInteger( p_vout, "bz-whitelevel-blue" ) / 255.0;
+                p_vout->p_sys->f_gamma[2] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-green" );
+                p_vout->p_sys->f_gamma[1] = var_CreateGetFloat( p_vout, CFG_PREFIX "bz-gamma-blue" );
+                f_BlackCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-green" ) / 255.0;
+                f_BlackCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blackcrush-blue" ) / 255.0;
+                f_WhiteCrush[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-green" ) / 255.0;
+                f_WhiteCrush[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitecrush-blue" ) / 255.0;
+                f_BlackLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-green" ) / 255.0;
+                f_BlackLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-blacklevel-blue" ) / 255.0;
+                f_WhiteLevel[2] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-green" ) / 255.0;
+                f_WhiteLevel[1] = var_CreateGetInteger( p_vout, CFG_PREFIX "bz-whitelevel-blue" ) / 255.0;
         // planar YUV
             case VLC_FOURCC('I','4','4','4'):
             case VLC_FOURCC('I','4','2','2'):
index cc83d7e..e2de62a 100644 (file)
@@ -63,6 +63,8 @@ static int  MouseEvent   ( vlc_object_t *, char const *,
 #define BLACKSLOT_TEXT N_("Make one tile a black slot")
 #define BLACKSLOT_LONGTEXT N_("Make one slot black. Other tiles can only be swapped with the black slot.")
 
+#define CFG_PREFIX "puzzle-"
+
 vlc_module_begin();
     set_description( _("Puzzle interactive game video filter") );
     set_shortname( _( "Puzzle" ));
@@ -70,16 +72,20 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
 
-    add_integer_with_range( "puzzle-rows", 4, 1, 128, NULL,
+    add_integer_with_range( CFG_PREFIX "rows", 4, 1, 128, NULL,
                             ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
-    add_integer_with_range( "puzzle-cols", 4, 1, 128, NULL,
+    add_integer_with_range( CFG_PREFIX "cols", 4, 1, 128, NULL,
                             COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
-    add_bool( "puzzle-black-slot", 0, NULL,
+    add_bool( CFG_PREFIX "black-slot", 0, NULL,
               BLACKSLOT_TEXT, BLACKSLOT_LONGTEXT, VLC_FALSE );
 
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
+static const char *ppsz_filter_options[] = {
+    "rows", "cols", "black-slot", NULL
+};
+
 /*****************************************************************************
  * vout_sys_t: Magnify video output method descriptor
  *****************************************************************************/
@@ -199,9 +205,13 @@ static int Create( vlc_object_t *p_this )
 
     p_vout->p_sys->p_image = image_HandlerCreate( p_vout );
 
-    p_vout->p_sys->i_rows = config_GetInt( p_vout, "puzzle-rows" );
-    p_vout->p_sys->i_cols = config_GetInt( p_vout, "puzzle-cols" );
-    p_vout->p_sys->b_blackslot = config_GetInt( p_vout, "puzzle-black-slot" );
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                       p_vout->p_cfg );
+
+    p_vout->p_sys->i_rows = var_CreateGetInteger( p_vout, CFG_PREFIX "rows" );
+    p_vout->p_sys->i_cols = var_CreateGetInteger( p_vout, CFG_PREFIX "cols" );
+    p_vout->p_sys->b_blackslot =
+                      var_CreateGetInteger( p_vout, CFG_PREFIX "black-slot" );
 
     p_vout->p_sys->pi_order = NULL;
     shuffle( p_vout->p_sys );
index c7deb77..1bcd257 100644 (file)
@@ -62,6 +62,8 @@ static const char *type_list_text[] = { N_("Rotate by 90 degrees"),
   N_("Rotate by 180 degrees"), N_("Rotate by 270 degrees"),
   N_("Flip horizontally"), N_("Flip vertically") };
 
+#define CFG_PREFIX "transform-"
+
 vlc_module_begin();
     set_description( _("Video transformation filter") );
     set_shortname( _("Transformation"));
@@ -69,7 +71,7 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
 
-    add_string( "transform-type", "90", NULL,
+    add_string( CFG_PREFIX "type", "90", NULL,
                           TYPE_TEXT, TYPE_LONGTEXT, VLC_FALSE);
         change_string_list( type_list, type_list_text, 0);
 
@@ -77,6 +79,10 @@ vlc_module_begin();
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
+static const char *ppsz_filter_options[] = {
+    "type", NULL
+};
+
 /*****************************************************************************
  * vout_sys_t: Transform video output method descriptor
  *****************************************************************************
@@ -123,8 +129,11 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                           p_vout->p_cfg );
+
     /* Look what method was requested */
-    psz_method = config_GetPsz( p_vout, "transform-type" );
+    psz_method = var_CreateGetNonEmptyString( p_vout, "transform-type" );
 
     if( psz_method == NULL )
     {
index 4d6aa0e..49a88d3 100644 (file)
@@ -66,6 +66,8 @@ static int  SendEvents( vlc_object_t *, char const *,
 #define ASPECT_LONGTEXT N_("Aspect ratio of the individual displays " \
    "building the wall.")
 
+#define CFG_PREFIX "wall-"
+
 vlc_module_begin();
     set_description( _("Wall video filter") );
     set_shortname( _("Image wall" ));
@@ -73,16 +75,20 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
 
-    add_integer( "wall-cols", 3, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
-    add_integer( "wall-rows", 3, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
-    add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT,
+    add_integer( CFG_PREFIX "cols", 3, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
+    add_integer( CFG_PREFIX "rows", 3, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
+    add_string( CFG_PREFIX "active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT,
                  VLC_TRUE );
-    add_string( "wall-element-aspect", "4:3", NULL, ASPECT_TEXT, ASPECT_LONGTEXT, VLC_FALSE );
+    add_string( CFG_PREFIX "element-aspect", "4:3", NULL, ASPECT_TEXT, ASPECT_LONGTEXT, VLC_FALSE );
 
     add_shortcut( "wall" );
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
+static const char *ppsz_filter_options[] = {
+    "cols", "rows", "active", "element-aspect", NULL
+};
+
 /*****************************************************************************
  * vout_sys_t: Wall video output method descriptor
  *****************************************************************************
@@ -150,9 +156,12 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_display = NULL;
     p_vout->pf_control = Control;
 
+    config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options,
+                       p_vout->p_cfg );
+
     /* Look what method was requested */
-    p_vout->p_sys->i_col = config_GetInt( p_vout, "wall-cols" );
-    p_vout->p_sys->i_row = config_GetInt( p_vout, "wall-rows" );
+    p_vout->p_sys->i_col = var_CreateGetInteger( p_vout, CFG_PREFIX "cols" );
+    p_vout->p_sys->i_row = var_CreateGetInteger( p_vout, CFG_PREFIX "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 ) );
@@ -170,7 +179,8 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     }
 
-    psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
+    psz_method_tmp =
+    psz_method = var_CreateGetNonEmptyString( p_vout, CFG_PREFIX "active" );
 
     /* If no trailing vout are specified, take them all */
     if( psz_method == NULL )
@@ -240,7 +250,8 @@ static int Init( vout_thread_t *p_vout )
     int i_vstart_rounded = 0, i_hstart_rounded = 0;
     char *psz_aspect;
 
-    psz_aspect = config_GetPsz( p_vout, "wall-element-aspect" );
+    psz_aspect = var_CreateGetNonEmptyString( p_vout,
+                                              CFG_PREFIX "element-aspect" );
     if( psz_aspect && *psz_aspect )
     {
         char *psz_parser = strchr( psz_aspect, ':' );
@@ -256,7 +267,6 @@ static int Init( vout_thread_t *p_vout )
         }
         free( psz_aspect );
     }
-    
 
     i_xpos = var_CreateGetInteger( p_vout, "video-x" );
     i_ypos = var_CreateGetInteger( p_vout, "video-y" );