Commit f7c6d4e7 authored by Antoine Cellerier's avatar Antoine Cellerier

Register variables as callback. Don't store module specific variables in...

Register variables as callback. Don't store module specific variables in p_libvlc_global. They don't belong there.
parent 8c4abae0
......@@ -329,36 +329,22 @@ static int Create( vlc_object_t *p_this )
p_vout->pf_display = NULL;
p_vout->pf_control = Control;
p_logo_list->psz_filename = var_CreateGetString( p_this , "logo-file" );
p_logo_list->psz_filename = var_CreateGetStringCommand( p_this,
"logo-file" );
if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename )
{
msg_Err( p_this, "logo file not specified" );
return 0;
}
var_Create( p_this, "logo-position", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "logo-position", &val );
p_sys->pos = val.i_int;
var_Create( p_this, "logo-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "logo-x", &val );
p_sys->posx = val.i_int;
var_Create( p_this, "logo-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "logo-y", &val );
p_sys->posy = val.i_int;
var_Create( p_this, "logo-delay", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "logo-delay", &val );
p_logo_list->i_delay = __MAX( __MIN( val.i_int, 60000 ), 0 );
var_Create( p_this, "logo-repeat", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_this, "logo-repeat", &val );
p_logo_list->i_repeat = val.i_int;
var_Create(p_this, "logo-transparency", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT);
var_Get( p_this, "logo-transparency", &val );
p_logo_list->i_alpha = __MAX( __MIN( val.i_int, 255 ), 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_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");
p_logo_list->i_alpha = __MAX( __MIN(
var_CreateGetIntegerCommand( p_this, "logo-transparency" ), 255 ), 0 );
LoadLogoList( p_vout, p_logo_list );
......@@ -732,7 +718,7 @@ static int CreateFilter( vlc_object_t *p_this )
/* Hook used for callback variables */
p_logo_list->psz_filename =
var_CreateGetString( p_filter->p_libvlc_global , "logo-file" );
var_CreateGetStringCommand( p_filter->p_libvlc_global , "logo-file" );
if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename )
{
msg_Err( p_this, "logo file not specified" );
......@@ -741,15 +727,15 @@ static int CreateFilter( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_sys->posx = var_CreateGetInteger( p_filter->p_libvlc_global , "logo-x" );
p_sys->posy = var_CreateGetInteger( p_filter->p_libvlc_global , "logo-y" );
p_sys->pos = var_CreateGetInteger( p_filter->p_libvlc_global , "logo-position" );
p_logo_list->i_alpha = __MAX( __MIN( var_CreateGetInteger(
p_filter->p_libvlc_global, "logo-transparency"), 255 ), 0 );
p_sys->posx = var_CreateGetIntegerCommand( p_filter, "logo-x" );
p_sys->posy = var_CreateGetIntegerCommand( p_filter, "logo-y" );
p_sys->pos = var_CreateGetIntegerCommand( p_filter, "logo-position" );
p_logo_list->i_alpha = __MAX( __MIN( var_CreateGetIntegerCommand(
p_filter, "logo-transparency"), 255 ), 0 );
p_logo_list->i_delay =
var_CreateGetInteger( p_filter->p_libvlc_global , "logo-delay" );
var_CreateGetIntegerCommand( p_filter, "logo-delay" );
p_logo_list->i_repeat =
var_CreateGetInteger( p_filter->p_libvlc_global , "logo-repeat" );
var_CreateGetIntegerCommand( p_filter, "logo-repeat" );
var_AddCallback( p_filter->p_libvlc_global, "logo-file", LogoCallback, p_sys );
var_AddCallback( p_filter->p_libvlc_global, "logo-x", LogoCallback, p_sys );
......
......@@ -192,7 +192,7 @@ static int CreateFilter( vlc_object_t *p_this )
p_filter->p_cfg );
#define CREATE_VAR( stor, type, var ) \
p_sys->stor = var_CreateGet##type( p_filter, var ); \
p_sys->stor = var_CreateGet##type##Command( p_filter, var ); \
var_AddCallback( p_filter, var, MarqueeCallback, p_sys );
CREATE_VAR( i_xoff, Integer, "marq-x" );
......
......@@ -305,24 +305,17 @@ static int CreateFilter( vlc_object_t *p_this )
#define GET_VAR( name, min, max ) \
p_sys->i_##name = __MIN( max, __MAX( min, \
var_CreateGetInteger( p_filter, CFG_PREFIX #name ) ) ); \
var_Destroy( p_filter, CFG_PREFIX #name ); \
var_Create( p_libvlc_global, CFG_PREFIX #name, VLC_VAR_INTEGER ); \
var_SetInteger( p_libvlc_global, CFG_PREFIX #name, p_sys->i_##name ); \
var_AddCallback( p_libvlc_global, CFG_PREFIX #name, MosaicCallback, p_sys );
var_CreateGetIntegerCommand( p_filter, CFG_PREFIX #name ) ) ); \
var_AddCallback( p_filter, CFG_PREFIX #name, MosaicCallback, p_sys );
GET_VAR( width, 0, INT_MAX );
GET_VAR( height, 0, INT_MAX );
GET_VAR( xoffset, 0, INT_MAX );
GET_VAR( yoffset, 0, INT_MAX );
p_sys->i_align = __MIN( 10, __MAX( 0, var_CreateGetInteger( p_filter, CFG_PREFIX "align" ) ) );
GET_VAR( align, 0, 10 );
if( p_sys->i_align == 3 || p_sys->i_align == 7 )
p_sys->i_align = 5;
var_Destroy( p_filter, CFG_PREFIX "align" );
var_Create( p_libvlc_global, CFG_PREFIX "align", VLC_VAR_INTEGER );
var_SetInteger( p_libvlc_global, CFG_PREFIX "align", p_sys->i_align );
var_AddCallback( p_libvlc_global, CFG_PREFIX "align", MosaicCallback, p_sys );
GET_VAR( borderw, 0, INT_MAX );
GET_VAR( borderh, 0, INT_MAX );
......@@ -333,11 +326,9 @@ static int CreateFilter( vlc_object_t *p_this )
GET_VAR( delay, 100, INT_MAX );
p_sys->i_delay *= 1000;
p_sys->b_ar = var_CreateGetBool( p_filter, CFG_PREFIX "keep-aspect-ratio" );
var_Destroy( p_filter, CFG_PREFIX "keep-aspect-ratio" );
var_Create( p_libvlc_global, CFG_PREFIX "keep-aspect-ratio", VLC_VAR_INTEGER );
var_SetBool( p_libvlc_global, CFG_PREFIX "keep-aspect-ratio", p_sys->b_ar );
var_AddCallback( p_libvlc_global, CFG_PREFIX "keep-aspect-ratio", MosaicCallback,
p_sys->b_ar = var_CreateGetBoolCommand( p_filter,
CFG_PREFIX "keep-aspect-ratio" );
var_AddCallback( p_filter, CFG_PREFIX "keep-aspect-ratio", MosaicCallback,
p_sys );
p_sys->b_keep = var_CreateGetBool( p_filter, CFG_PREFIX "keep-picture" );
......@@ -348,10 +339,8 @@ static int CreateFilter( vlc_object_t *p_this )
p_sys->i_order_length = 0;
p_sys->ppsz_order = NULL;
psz_order = var_CreateGetString( p_filter, CFG_PREFIX "order" );
var_Create( p_libvlc_global, CFG_PREFIX "order", VLC_VAR_STRING);
var_AddCallback( p_libvlc_global, CFG_PREFIX "order", MosaicCallback, p_sys );
psz_order = var_CreateGetStringCommand( p_filter, CFG_PREFIX "order" );
var_AddCallback( p_filter, CFG_PREFIX "order", MosaicCallback, p_sys );
if( psz_order[0] != 0 )
{
......@@ -371,26 +360,20 @@ static int CreateFilter( vlc_object_t *p_this )
}
/* Manage specific offsets for substreams */
psz_offsets = var_CreateGetString( p_filter, CFG_PREFIX "offsets" );
var_Destroy( p_filter, CFG_PREFIX "offsets" );
psz_offsets = var_CreateGetStringCommand( p_filter, CFG_PREFIX "offsets" );
p_sys->i_offsets_length = 0;
p_sys->pi_x_offsets = NULL;
p_sys->pi_y_offsets = NULL;
mosaic_ParseSetOffsets( (vlc_object_t *) p_filter, p_sys, psz_offsets );
var_Create( p_libvlc_global, CFG_PREFIX "offsets", VLC_VAR_STRING);
var_SetString( p_libvlc_global, CFG_PREFIX "offsets", psz_offsets );
var_AddCallback( p_libvlc_global, CFG_PREFIX "offsets", MosaicCallback, p_sys );
var_AddCallback( p_filter, CFG_PREFIX "offsets", MosaicCallback, p_sys );
/* Bluescreen specific stuff */
GET_VAR( bsu, 0x00, 0xff );
GET_VAR( bsv, 0x00, 0xff );
GET_VAR( bsut, 0x00, 0xff );
GET_VAR( bsvt, 0x00, 0xff );
p_sys->b_bs = var_CreateGetBool( p_filter, CFG_PREFIX "bs" );
var_Destroy( p_filter, CFG_PREFIX "bs" );
var_Create( p_libvlc_global, CFG_PREFIX "bs", VLC_VAR_INTEGER );
var_SetBool( p_libvlc_global, CFG_PREFIX "bs", p_sys->b_bs );
var_AddCallback( p_libvlc_global, CFG_PREFIX "bs", MosaicCallback, p_sys );
p_sys->b_bs = var_CreateGetBoolCommand( p_filter, CFG_PREFIX "bs" );
var_AddCallback( p_filter, CFG_PREFIX "bs", MosaicCallback, p_sys );
if( p_sys->b_bs && p_sys->b_keep )
{
msg_Warn( p_filter, CFG_PREFIX "keep-picture needs to be disabled for"
......
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