Commit f5bcfe6d authored by Antoine Cellerier's avatar Antoine Cellerier

Add support for config chain option parsing.

parent 15267bb4
......@@ -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;
}
......
......@@ -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" );
......
This diff is collapsed.
......@@ -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 );
......
......@@ -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 )
{
......
......@@ -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, ':' );
......@@ -257,7 +268,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" );
if( i_xpos < 0 ) i_xpos = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment