static void spu_del_video_buffer( filter_t *, picture_t * );
/* Buffer aloccation fir SUB filter */
-static int SubFilterCallback( vlc_object_t *, char const *,
- vlc_value_t, vlc_value_t, void * );
-
static int SubFilterAllocationInit( filter_t *, void * );
static void SubFilterAllocationClean( filter_t * );
return p_spu;
}
-/**
- * Initialise the subpicture unit
- *
- * \param p_spu the subpicture unit object
- */
-int spu_Init( spu_t *p_spu )
-{
- var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
- var_AddCallback( p_spu, "sub-filter", SubFilterCallback, p_spu );
- var_TriggerCallback( p_spu, "sub-filter" );
-
- return VLC_SUCCESS;
-}
-
/**
* Destroy the subpicture unit
*
{
spu_private_t *p_sys = p_spu->p;
- var_DelCallback( p_spu, "sub-filter", SubFilterCallback, p_spu );
-
if( p_sys->p_blend )
filter_DeleteBlend( p_sys->p_blend );
* \param p_this the object in which to destroy the subpicture unit
* \param b_attach to select attach or detach
*/
-void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
+void spu_Attach( spu_t *p_spu, vlc_object_t *p_input, bool b_attach )
{
- vlc_object_t *p_input;
-
- p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
- if( !p_input )
- return;
-
if( b_attach )
{
UpdateSPU( p_spu, VLC_OBJECT(p_input) );
vlc_mutex_lock( &p_spu->p->lock );
p_spu->p->i_margin = var_GetInteger( p_input, "sub-margin" );
vlc_mutex_unlock( &p_spu->p->lock );
-
- vlc_object_release( p_input );
}
else
{
var_DelCallback( p_input, "sub-margin", MarginCallback, p_spu->p );
var_DelCallback( p_input, "highlight", CropCallback, p_spu );
var_Destroy( p_input, "highlight" );
- vlc_object_release( p_input );
}
}
vlc_mutex_unlock( &p_sys->lock );
}
+void spu_ChangeFilters( spu_t *p_spu, const char *psz_filters )
+{
+ spu_private_t *p_sys = p_spu->p;
+
+ vlc_mutex_lock( &p_sys->lock );
+
+ free( p_sys->psz_chain_update );
+ p_sys->psz_chain_update = strdup( psz_filters );
+
+ vlc_mutex_unlock( &p_sys->lock );
+}
+
/*****************************************************************************
* subpicture_t allocation
*****************************************************************************/
i_y = i_delta_y;
}
- /* Margin shifts all subpictures */
- /* NOTE We have margin only for subtitles, so we don't really need this here
- if( i_margin_y != 0 )
- i_y -= i_margin_y;*/
-
- /* Clamp offset to not go out of the screen (when possible) */
- /* NOTE Again, useful only for subtitles, otherwise goes against the alignment logic above
- const int i_error_x = (i_x + p_region->fmt.i_width) - p_subpic->i_original_picture_width;
- if( i_error_x > 0 )
- i_x -= i_error_x;
- if( i_x < 0 )
- i_x = 0;
-
- const int i_error_y = (i_y + p_region->fmt.i_height) - p_subpic->i_original_picture_height;
- if( i_error_y > 0 )
- i_y -= i_error_y;
- if( i_y < 0 )
- i_y = 0;*/
-
*pi_x = i_x;
*pi_y = i_y;
}
/* apply margin to subtitles and correct if they go over the picture edge */
if( p_subpic->b_subtitle )
- {
restrained.i_y -= i_margin_y;
- spu_area_t display = spu_area_create( 0, 0, p_fmt->i_width, p_fmt->i_height,
- spu_scale_unit() );
- SpuAreaFitInside( &restrained, &display );
- }
+
+ spu_area_t display = spu_area_create( 0, 0, p_fmt->i_width, p_fmt->i_height,
+ spu_scale_unit() );
+ SpuAreaFitInside( &restrained, &display );
/* Fix the position for the current scale_size */
i_x_offset = spu_scale_w( restrained.i_x, restrained.scale );
free( p_filter->p_owner );
}
-static int SubFilterCallback( vlc_object_t *p_object, char const *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
-{
- spu_t *p_spu = p_data;
- spu_private_t *p_sys = p_spu->p;
-
- VLC_UNUSED(p_object); VLC_UNUSED(oldval); VLC_UNUSED(psz_var);
-
- vlc_mutex_lock( &p_sys->lock );
-
- free( p_sys->psz_chain_update );
- p_sys->psz_chain_update = strdup( newval.psz_string );
-
- vlc_mutex_unlock( &p_sys->lock );
- return VLC_SUCCESS;
-}
-