Commit 111a8051 authored by Clément Stenac's avatar Clément Stenac

Create variables in libvlc instead of libvlc_global_data

parent 91e70973
...@@ -179,23 +179,20 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -179,23 +179,20 @@ static int CreateFilter( vlc_object_t *p_this )
p_sys->p_style = malloc( sizeof( text_style_t ) ); p_sys->p_style = malloc( sizeof( text_style_t ) );
memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) ); memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
p_sys->i_xoff = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-x" ); #define CREATE_VAR( stor, type, var ) \
p_sys->i_yoff = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-y" ); p_sys->stor = var_CreateGet##type( p_filter->p_libvlc, var ); \
p_sys->i_timeout = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-timeout" ); var_AddCallback( p_filter->p_libvlc, var, MarqueeCallback, p_sys );
p_sys->i_pos = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-position" );
p_sys->psz_marquee = var_CreateGetString( p_filter->p_libvlc_global, "marq-marquee" ); CREATE_VAR( i_xoff, Integer, "marq-x" );
p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_filter->p_libvlc_global , "marq-opacity" ); CREATE_VAR( i_yoff, Integer, "marq-y" );
p_sys->p_style->i_font_color = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-color" ); CREATE_VAR( i_timeout,Integer, "marq-timeout" );
p_sys->p_style->i_font_size = var_CreateGetInteger( p_filter->p_libvlc_global , "marq-size" ); CREATE_VAR( i_pos, Integer, "marq-position" );
CREATE_VAR( psz_marquee, String, "marq-marquee" );
var_AddCallback( p_filter->p_libvlc_global, "marq-x", MarqueeCallback, p_sys ); CREATE_VAR( p_style->i_font_alpha, Integer, "marq-opacity" );
var_AddCallback( p_filter->p_libvlc_global, "marq-y", MarqueeCallback, p_sys ); CREATE_VAR( p_style->i_font_color, Integer, "marq-color" );
var_AddCallback( p_filter->p_libvlc_global, "marq-marquee", MarqueeCallback, p_sys ); CREATE_VAR( p_style->i_font_size, Integer, "marq-size" );
var_AddCallback( p_filter->p_libvlc_global, "marq-timeout", MarqueeCallback, p_sys );
var_AddCallback( p_filter->p_libvlc_global, "marq-position", MarqueeCallback, p_sys ); p_sys->p_style->i_font_alpha = 255 - p_sys->p_style->i_font_alpha ;
var_AddCallback( p_filter->p_libvlc_global, "marq-color", MarqueeCallback, p_sys );
var_AddCallback( p_filter->p_libvlc_global, "marq-opacity", MarqueeCallback, p_sys );
var_AddCallback( p_filter->p_libvlc_global, "marq-size", MarqueeCallback, p_sys );
/* Misc init */ /* Misc init */
p_filter->pf_sub_filter = Filter; p_filter->pf_sub_filter = Filter;
...@@ -217,23 +214,17 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -217,23 +214,17 @@ static void DestroyFilter( vlc_object_t *p_this )
free( p_sys ); free( p_sys );
/* Delete the marquee variables */ /* Delete the marquee variables */
var_DelCallback( p_filter->p_libvlc_global, "marq-x", MarqueeCallback, p_sys ); #define DEL_VAR(var) \
var_DelCallback( p_filter->p_libvlc_global, "marq-y", MarqueeCallback, p_sys ); var_DelCallback( p_filter->p_libvlc, var, MarqueeCallback, p_sys ) \
var_DelCallback( p_filter->p_libvlc_global, "marq-marquee", MarqueeCallback, p_sys ); var_Destroy( p_filter->p_libvlc, var );
var_DelCallback( p_filter->p_libvlc_global, "marq-timeout", MarqueeCallback, p_sys ); DEL_VAR( "marq-x" );
var_DelCallback( p_filter->p_libvlc_global, "marq-position", MarqueeCallback, p_sys ); DEL_VAR( "marq-y" );
var_DelCallback( p_filter->p_libvlc_global, "marq-color", MarqueeCallback, p_sys ); DEL_VAR( "marq-marquee" );
var_DelCallback( p_filter->p_libvlc_global, "marq-opacity", MarqueeCallback, p_sys ); DEL_VAR( "marq-timeout" );
var_DelCallback( p_filter->p_libvlc_global, "marq-size", MarqueeCallback, p_sys ); DEL_VAR( "marq-position" );
DEL_VAR( "marq-color" );
var_Destroy( p_filter->p_libvlc_global , "marq-marquee" ); DEL_VAR( "marq-opacity" );
var_Destroy( p_filter->p_libvlc_global , "marq-x" ); DEL_VAR( "marq-size" );
var_Destroy( p_filter->p_libvlc_global , "marq-y" );
var_Destroy( p_filter->p_libvlc_global , "marq-timeout" );
var_Destroy( p_filter->p_libvlc_global , "marq-position" );
var_Destroy( p_filter->p_libvlc_global , "marq-color");
var_Destroy( p_filter->p_libvlc_global , "marq-opacity");
var_Destroy( p_filter->p_libvlc_global , "marq-size");
} }
/**************************************************************************** /****************************************************************************
* String formating functions * String formating functions
......
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