Commit 70631390 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* p_input->p_libvlc == p_filter->p_libvlc: remove p_input dependancy here.

parent fc380de0
...@@ -705,7 +705,6 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -705,7 +705,6 @@ static int CreateFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys; filter_sys_t *p_sys;
vlc_object_t *p_input;
logo_list_t *p_logo_list; logo_list_t *p_logo_list;
/* Allocate structure */ /* Allocate structure */
...@@ -724,43 +723,32 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -724,43 +723,32 @@ static int CreateFilter( vlc_object_t *p_this )
} }
/* Hook used for callback variables */ /* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
if( !p_input )
{
free( p_sys );
free( p_logo_list );
return VLC_ENOOBJ;
}
p_logo_list->psz_filename = p_logo_list->psz_filename =
var_CreateGetString( p_input->p_libvlc , "logo-file" ); var_CreateGetString( p_filter->p_libvlc , "logo-file" );
if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename ) if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename )
{ {
msg_Err( p_this, "logo file not specified" ); msg_Err( p_this, "logo file not specified" );
vlc_object_release( p_input );
//if( p_sys->psz_filename ) free( p_sys->psz_filename );
free( p_sys ); free( p_sys );
free( p_logo_list ); free( p_logo_list );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys->posx = var_CreateGetInteger( p_input->p_libvlc , "logo-x" ); p_sys->posx = var_CreateGetInteger( p_filter->p_libvlc , "logo-x" );
p_sys->posy = var_CreateGetInteger( p_input->p_libvlc , "logo-y" ); p_sys->posy = var_CreateGetInteger( p_filter->p_libvlc , "logo-y" );
p_sys->pos = var_CreateGetInteger( p_input->p_libvlc , "logo-position" ); p_sys->pos = var_CreateGetInteger( p_filter->p_libvlc , "logo-position" );
p_logo_list->i_alpha = __MAX( __MIN( var_CreateGetInteger( p_logo_list->i_alpha = __MAX( __MIN( var_CreateGetInteger(
p_input->p_libvlc, "logo-transparency"), 255 ), 0 ); p_filter->p_libvlc, "logo-transparency"), 255 ), 0 );
p_logo_list->i_delay = p_logo_list->i_delay =
var_CreateGetInteger( p_input->p_libvlc , "logo-delay" ); var_CreateGetInteger( p_filter->p_libvlc , "logo-delay" );
p_logo_list->i_repeat = p_logo_list->i_repeat =
var_CreateGetInteger( p_input->p_libvlc , "logo-repeat" ); var_CreateGetInteger( p_filter->p_libvlc , "logo-repeat" );
var_AddCallback( p_input->p_libvlc, "logo-file", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-file", LogoCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "logo-x", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-x", LogoCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "logo-y", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-y", LogoCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "logo-position", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-position", LogoCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "logo-transparency", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-transparency", LogoCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "logo-repeat", LogoCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "logo-repeat", LogoCallback, p_sys );
vlc_object_release( p_input );
vlc_mutex_init( p_filter, &p_logo_list->lock ); vlc_mutex_init( p_filter, &p_logo_list->lock );
vlc_mutex_lock( &p_logo_list->lock ); vlc_mutex_lock( &p_logo_list->lock );
...@@ -785,7 +773,6 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -785,7 +773,6 @@ static void DestroyFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
vlc_mutex_destroy( &p_sys->p_logo_list->lock ); vlc_mutex_destroy( &p_sys->p_logo_list->lock );
FreeLogoList( p_sys->p_logo_list ); FreeLogoList( p_sys->p_logo_list );
...@@ -793,17 +780,13 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -793,17 +780,13 @@ static void DestroyFilter( vlc_object_t *p_this )
free( p_sys ); free( p_sys );
/* Delete the logo variables from INPUT */ /* Delete the logo variables from INPUT */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT ); var_Destroy( p_filter->p_libvlc , "logo-file" );
if( !p_input ) return; var_Destroy( p_filter->p_libvlc , "logo-x" );
var_Destroy( p_filter->p_libvlc , "logo-y" );
var_Destroy( p_input->p_libvlc , "logo-file" ); var_Destroy( p_filter->p_libvlc , "logo-delay" );
var_Destroy( p_input->p_libvlc , "logo-x" ); var_Destroy( p_filter->p_libvlc , "logo-repeat" );
var_Destroy( p_input->p_libvlc , "logo-y" ); var_Destroy( p_filter->p_libvlc , "logo-position" );
var_Destroy( p_input->p_libvlc , "logo-delay" ); var_Destroy( p_filter->p_libvlc , "logo-transparency" );
var_Destroy( p_input->p_libvlc , "logo-repeat" );
var_Destroy( p_input->p_libvlc , "logo-position" );
var_Destroy( p_input->p_libvlc , "logo-transparency" );
vlc_object_release( p_input );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -149,7 +149,6 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -149,7 +149,6 @@ static int CreateFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys; filter_sys_t *p_sys;
vlc_object_t *p_input;
/* Allocate structure */ /* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
...@@ -159,36 +158,26 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -159,36 +158,26 @@ static int CreateFilter( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
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_input->p_libvlc , "marq-x" ); p_sys->i_xoff = var_CreateGetInteger( p_filter->p_libvlc , "marq-x" );
p_sys->i_yoff = var_CreateGetInteger( p_input->p_libvlc , "marq-y" ); p_sys->i_yoff = var_CreateGetInteger( p_filter->p_libvlc , "marq-y" );
p_sys->i_timeout = var_CreateGetInteger( p_input->p_libvlc , "marq-timeout" ); p_sys->i_timeout = var_CreateGetInteger( p_filter->p_libvlc , "marq-timeout" );
p_sys->i_pos = var_CreateGetInteger( p_input->p_libvlc , "marq-position" ); p_sys->i_pos = var_CreateGetInteger( p_filter->p_libvlc , "marq-position" );
p_sys->psz_marquee = var_CreateGetString( p_input->p_libvlc, "marq-marquee" ); p_sys->psz_marquee = var_CreateGetString( p_filter->p_libvlc, "marq-marquee" );
p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_input->p_libvlc , "marq-opacity" ); p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_filter->p_libvlc , "marq-opacity" );
p_sys->p_style->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "marq-color" ); p_sys->p_style->i_font_color = var_CreateGetInteger( p_filter->p_libvlc , "marq-color" );
p_sys->p_style->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "marq-size" ); p_sys->p_style->i_font_size = var_CreateGetInteger( p_filter->p_libvlc , "marq-size" );
var_AddCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-x", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-y", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-position", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-color", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "marq-size", MarqueeCallback, p_sys );
vlc_object_release( p_input );
/* Misc init */ /* Misc init */
p_filter->pf_sub_filter = Filter; p_filter->pf_sub_filter = Filter;
...@@ -204,37 +193,29 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -204,37 +193,29 @@ static void DestroyFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
if( p_sys->p_style ) free( p_sys->p_style ); if( p_sys->p_style ) free( p_sys->p_style );
if( p_sys->psz_marquee ) free( p_sys->psz_marquee ); if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
free( p_sys ); free( p_sys );
/* Delete the marquee variables */ /* Delete the marquee variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); var_DelCallback( p_filter->p_libvlc, "marq-x", MarqueeCallback, p_sys );
if( !p_input ) var_DelCallback( p_filter->p_libvlc, "marq-y", MarqueeCallback, p_sys );
{ var_DelCallback( p_filter->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
return; var_DelCallback( p_filter->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
} var_DelCallback( p_filter->p_libvlc, "marq-position", MarqueeCallback, p_sys );
var_DelCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys ); var_DelCallback( p_filter->p_libvlc, "marq-color", MarqueeCallback, p_sys );
var_DelCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys ); var_DelCallback( p_filter->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );
var_DelCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys ); var_DelCallback( p_filter->p_libvlc, "marq-size", MarqueeCallback, p_sys );
var_DelCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
var_DelCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys ); var_Destroy( p_filter->p_libvlc , "marq-marquee" );
var_DelCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys ); var_Destroy( p_filter->p_libvlc , "marq-x" );
var_DelCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys ); var_Destroy( p_filter->p_libvlc , "marq-y" );
var_DelCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys ); var_Destroy( p_filter->p_libvlc , "marq-timeout" );
var_Destroy( p_filter->p_libvlc , "marq-position" );
var_Destroy( p_input->p_libvlc , "marq-marquee" ); var_Destroy( p_filter->p_libvlc , "marq-color");
var_Destroy( p_input->p_libvlc , "marq-x" ); var_Destroy( p_filter->p_libvlc , "marq-opacity");
var_Destroy( p_input->p_libvlc , "marq-y" ); var_Destroy( p_filter->p_libvlc , "marq-size");
var_Destroy( p_input->p_libvlc , "marq-timeout" );
var_Destroy( p_input->p_libvlc , "marq-position" );
var_Destroy( p_input->p_libvlc , "marq-color");
var_Destroy( p_input->p_libvlc , "marq-opacity");
var_Destroy( p_input->p_libvlc , "marq-size");
vlc_object_release( p_input );
} }
/**************************************************************************** /****************************************************************************
......
...@@ -132,7 +132,6 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -132,7 +132,6 @@ static int CreateFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys; filter_sys_t *p_sys;
vlc_object_t *p_input;
/* Allocate structure */ /* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
...@@ -141,34 +140,27 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -141,34 +140,27 @@ static int CreateFilter( vlc_object_t *p_this )
msg_Err( p_filter, "out of memory" ); msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
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_input->p_libvlc , "time-x" ); /* Hook used for callback variables */
p_sys->i_yoff = var_CreateGetInteger( p_input->p_libvlc , "time-y" ); p_sys->i_xoff = var_CreateGetInteger( p_filter->p_libvlc , "time-x" );
p_sys->psz_format = var_CreateGetString( p_input->p_libvlc, "time-format" ); p_sys->i_yoff = var_CreateGetInteger( p_filter->p_libvlc , "time-y" );
p_sys->i_pos = var_CreateGetInteger( p_input->p_libvlc , "time-position" ); p_sys->psz_format = var_CreateGetString( p_filter->p_libvlc, "time-format" );
p_sys->i_pos = var_CreateGetInteger( p_filter->p_libvlc , "time-position" );
p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_input->p_libvlc , "time-opacity" ); p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_filter->p_libvlc , "time-opacity" );
p_sys->p_style->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "time-color" ); p_sys->p_style->i_font_color = var_CreateGetInteger( p_filter->p_libvlc , "time-color" );
p_sys->p_style->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "time-size" ); p_sys->p_style->i_font_size = var_CreateGetInteger( p_filter->p_libvlc , "time-size" );
var_AddCallback( p_input->p_libvlc, "time-x", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-x", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-y", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-y", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-format", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-format", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-position", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-position", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-color", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-color", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-opacity", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-opacity", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-size", TimeCallback, p_sys ); var_AddCallback( p_filter->p_libvlc, "time-size", TimeCallback, p_sys );
vlc_object_release( p_input );
/* Misc init */ /* Misc init */
p_filter->pf_sub_filter = Filter; p_filter->pf_sub_filter = Filter;
...@@ -183,26 +175,19 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -183,26 +175,19 @@ static void DestroyFilter( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
if( p_sys->p_style ) free( p_sys->p_style ); if( p_sys->p_style ) free( p_sys->p_style );
if( p_sys->psz_format ) free( p_sys->psz_format ); if( p_sys->psz_format ) free( p_sys->psz_format );
free( p_sys ); free( p_sys );
/* Delete the time variables */ /* Delete the time variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); var_Destroy( p_filter->p_libvlc , "time-format" );
if( !p_input ) var_Destroy( p_filter->p_libvlc , "time-x" );
{ var_Destroy( p_filter->p_libvlc , "time-y" );
return; var_Destroy( p_filter->p_libvlc , "time-position" );
} var_Destroy( p_filter->p_libvlc , "time-color");
var_Destroy( p_input->p_libvlc , "time-format" ); var_Destroy( p_filter->p_libvlc , "time-opacity");
var_Destroy( p_input->p_libvlc , "time-x" ); var_Destroy( p_filter->p_libvlc , "time-size");
var_Destroy( p_input->p_libvlc , "time-y" );
var_Destroy( p_input->p_libvlc , "time-position" );
var_Destroy( p_input->p_libvlc , "time-color");
var_Destroy( p_input->p_libvlc , "time-opacity");
var_Destroy( p_input->p_libvlc , "time-size");
vlc_object_release( p_input );
} }
static char *FormatTime(char *tformat ) static char *FormatTime(char *tformat )
......
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