Commit 98d70ea8 authored by Antoine Cellerier's avatar Antoine Cellerier

use config chain stuff in logo, rss and mosaic sub filters too.

parent 9786ac41
......@@ -90,6 +90,8 @@ static int LogoCallback( vlc_object_t *, char const *,
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values, eg 6 = top-right).")
#define CFG_PREFIX "logo-"
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
......@@ -104,15 +106,15 @@ vlc_module_begin();
add_shortcut( "logo" );
set_callbacks( Create, Destroy );
add_file( "logo-file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, VLC_FALSE );
add_integer( "logo-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
add_integer( "logo-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
add_file( CFG_PREFIX "file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
/* default to 1000 ms per image, continuously cycle through them */
add_integer( "logo-delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, VLC_TRUE );
add_integer( "logo-repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE );
add_integer_with_range( "logo-transparency", 255, 0, 255, NULL,
add_integer( CFG_PREFIX "delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE );
add_integer_with_range( CFG_PREFIX "transparency", 255, 0, 255, NULL,
TRANS_TEXT, TRANS_LONGTEXT, VLC_FALSE );
add_integer( "logo-position", 6, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "position", 6, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
/* subpicture filter submodule */
......@@ -123,6 +125,10 @@ vlc_module_begin();
add_shortcut( "logo" );
vlc_module_end();
static const char *ppsz_filter_options[] = {
"file", "x", "y", "delay", "repeat", "transparency", "position", NULL
};
/*****************************************************************************
* Structure to hold the set of individual logo image names, times,
* transparencies
......@@ -722,6 +728,10 @@ static int CreateFilter( vlc_object_t *p_this )
return VLC_ENOMEM;
}
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
/* Hook used for callback variables */
p_logo_list->psz_filename =
var_CreateGetString( p_filter->p_libvlc_global , "logo-file" );
......
......@@ -182,6 +182,7 @@ static char *ppsz_align_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
#define CFG_PREFIX "mosaic-"
vlc_module_begin();
set_description( N_("Mosaic video sub filter") );
......@@ -191,42 +192,48 @@ vlc_module_begin();
set_capability( "sub filter", 0 );
set_callbacks( CreateFilter, DestroyFilter );
add_integer( "mosaic-alpha", 255, NULL, ALPHA_TEXT, ALPHA_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-height", 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-width", 100, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-align", 5, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE);
add_integer( CFG_PREFIX "alpha", 255, NULL, ALPHA_TEXT, ALPHA_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "height", 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "width", 100, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "align", 5, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE);
change_integer_list( pi_align_values, ppsz_align_descriptions, 0 );
add_integer( "mosaic-xoffset", 0, NULL, XOFFSET_TEXT, XOFFSET_LONGTEXT, VLC_TRUE );
add_integer( "mosaic-yoffset", 0, NULL, YOFFSET_TEXT, YOFFSET_LONGTEXT, VLC_TRUE );
add_integer( "mosaic-vborder", 0, NULL, VBORDER_TEXT, VBORDER_LONGTEXT, VLC_TRUE );
add_integer( "mosaic-hborder", 0, NULL, HBORDER_TEXT, HBORDER_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "xoffset", 0, NULL, XOFFSET_TEXT, XOFFSET_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "yoffset", 0, NULL, YOFFSET_TEXT, YOFFSET_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "vborder", 0, NULL, VBORDER_TEXT, VBORDER_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "hborder", 0, NULL, HBORDER_TEXT, HBORDER_LONGTEXT, VLC_TRUE );
add_integer( "mosaic-position", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "position", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer( "mosaic-rows", 2, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-cols", 2, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
add_bool( "mosaic-keep-aspect-ratio", 0, NULL, AR_TEXT, AR_LONGTEXT, VLC_FALSE );
add_bool( "mosaic-keep-picture", 0, NULL, KEEP_TEXT, KEEP_LONGTEXT, VLC_FALSE );
add_string( "mosaic-order", "", NULL, ORDER_TEXT, ORDER_LONGTEXT, VLC_FALSE );
add_string( "mosaic-offsets", "", NULL, OFFSETS_TEXT, OFFSETS_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-delay", 0, NULL, DELAY_TEXT, DELAY_LONGTEXT,
add_integer( CFG_PREFIX "rows", 2, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "cols", 2, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
add_bool( CFG_PREFIX "keep-aspect-ratio", 0, NULL, AR_TEXT, AR_LONGTEXT, VLC_FALSE );
add_bool( CFG_PREFIX "keep-picture", 0, NULL, KEEP_TEXT, KEEP_LONGTEXT, VLC_FALSE );
add_string( CFG_PREFIX "order", "", NULL, ORDER_TEXT, ORDER_LONGTEXT, VLC_FALSE );
add_string( CFG_PREFIX "offsets", "", NULL, OFFSETS_TEXT, OFFSETS_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "delay", 0, NULL, DELAY_TEXT, DELAY_LONGTEXT,
VLC_FALSE );
add_bool( "mosaic-bs", 0, NULL, BLUESCREEN_TEXT,
add_bool( CFG_PREFIX "bs", 0, NULL, BLUESCREEN_TEXT,
BLUESCREEN_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-bsu", 120, NULL, BLUESCREENU_TEXT,
add_integer( CFG_PREFIX "bsu", 120, NULL, BLUESCREENU_TEXT,
BLUESCREENU_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-bsv", 90, NULL, BLUESCREENV_TEXT,
add_integer( CFG_PREFIX "bsv", 90, NULL, BLUESCREENV_TEXT,
BLUESCREENV_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-bsut", 17, NULL, BLUESCREENUTOL_TEXT,
add_integer( CFG_PREFIX "bsut", 17, NULL, BLUESCREENUTOL_TEXT,
BLUESCREENUTOL_LONGTEXT, VLC_FALSE );
add_integer( "mosaic-bsvt", 17, NULL, BLUESCREENVTOL_TEXT,
add_integer( CFG_PREFIX "bsvt", 17, NULL, BLUESCREENVTOL_TEXT,
BLUESCREENVTOL_LONGTEXT, VLC_FALSE );
var_Create( p_module->p_libvlc_global, "mosaic-lock", VLC_VAR_MUTEX );
vlc_module_end();
static const char *ppsz_filter_options[] = {
"alpha", "height", "width", "align", "xoffset", "yoffset",
"vborder", "hborder", "position", "rows", "cols",
"keep-aspect-ratio", "keep-picture", "order", "offsets",
"delay", "bs", "bsu", "bsv", "bsut", "bsvt", NULL
};
/*****************************************************************************
* mosaic_ParseSetOffsets:
......@@ -293,6 +300,9 @@ static int CreateFilter( vlc_object_t *p_this )
var_Get( p_libvlc_global, "mosaic-lock", &val );
p_sys->p_lock = val.p_address;
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
#define GET_VAR( name, min, max ) \
p_sys->i_##name = __MIN( max, __MAX( min, \
var_CreateGetInteger( p_filter, "mosaic-" #name ) ) ); \
......
......@@ -160,6 +160,8 @@ static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
#define CFG_PREFIX "rrs-"
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -169,36 +171,41 @@ vlc_module_begin();
set_callbacks( CreateFilter, DestroyFilter );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_SUBPIC );
add_string( "rss-urls", "rss", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
add_string( CFG_PREFIX "urls", "rss", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
set_section( N_("Position"), NULL );
add_integer( "rss-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
add_integer( "rss-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
add_integer( "rss-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
add_integer( CFG_PREFIX "position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
set_section( N_("Font"), NULL );
/* 5 sets the default to top [1] left [4] */
add_integer_with_range( "rss-opacity", 255, 0, 255, NULL,
add_integer_with_range( CFG_PREFIX "opacity", 255, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "rss-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT,
add_integer( CFG_PREFIX "color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT,
VLC_FALSE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "rss-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
set_section( N_("Misc"), NULL );
add_integer( "rss-speed", 100000, NULL, SPEED_TEXT, SPEED_LONGTEXT,
add_integer( CFG_PREFIX "speed", 100000, NULL, SPEED_TEXT, SPEED_LONGTEXT,
VLC_FALSE );
add_integer( "rss-length", 60, NULL, LENGTH_TEXT, LENGTH_LONGTEXT,
add_integer( CFG_PREFIX "length", 60, NULL, LENGTH_TEXT, LENGTH_LONGTEXT,
VLC_FALSE );
add_integer( "rss-ttl", 1800, NULL, TTL_TEXT, TTL_LONGTEXT, VLC_FALSE );
add_bool( "rss-images", 1, NULL, IMAGE_TEXT, IMAGE_LONGTEXT, VLC_FALSE );
add_integer( CFG_PREFIX "ttl", 1800, NULL, TTL_TEXT, TTL_LONGTEXT, VLC_FALSE );
add_bool( CFG_PREFIX "images", 1, NULL, IMAGE_TEXT, IMAGE_LONGTEXT, VLC_FALSE );
set_description( _("RSS and Atom feed display") );
add_shortcut( "rss" );
add_shortcut( "atom" );
vlc_module_end();
static const char *ppsz_filter_options[] = {
"urls", "x", "y", "position", "color", "size", "speed", "length",
"ttl", "images", NULL
};
/*****************************************************************************
* CreateFilter: allocates RSS video filter
*****************************************************************************/
......@@ -219,6 +226,9 @@ static int CreateFilter( vlc_object_t *p_this )
vlc_mutex_init( p_filter, &p_sys->lock );
vlc_mutex_lock( &p_sys->lock );
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
p_sys->psz_urls = var_CreateGetString( p_filter, "rss-urls" );
p_sys->i_cur_feed = 0;
p_sys->i_cur_item = 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