Commit a944ebff authored by Sam Hocevar's avatar Sam Hocevar

* ./plugins/filter/*: filters are now configurable through the configuration

    system. Patch from Sigmund Augdal <sigmunau@stud.ntnu.no>.
parent 09186fe6
......@@ -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 );
}
......
......@@ -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 );
}
......
......@@ -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
*****************************************************************************/
......
......@@ -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 );
......
......@@ -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 )
{
......
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