/*****************************************************************************
* Public API
*****************************************************************************/
+
+#undef spu_Create
/**
* Creates the subpicture unit
*
* \param p_this the parent object which creates the subpicture unit
*/
-spu_t *__spu_Create( vlc_object_t *p_this )
+spu_t *spu_Create( vlc_object_t *p_this )
{
spu_t *p_spu;
spu_private_t *p_sys;
-
+
p_spu = vlc_custom_create( p_this, sizeof(spu_t) + sizeof(spu_private_t),
VLC_OBJECT_GENERIC, "subpicture" );
-
if( !p_spu )
return NULL;
+ vlc_object_attach( p_spu, p_this );
/* Initialize spu fields */
p_spu->pf_control = SpuControl;
p_sys->p_scale = NULL;
p_sys->p_scale_yuvp = NULL;
- p_sys->i_margin = config_GetInt( p_spu, "sub-margin" );
+ p_sys->i_margin = var_InheritInteger( p_spu, "sub-margin" );
/* Register the default subpicture channel */
p_sys->i_channel = 2;
- vlc_object_attach( p_spu, p_this );
-
p_sys->psz_chain_update = NULL;
p_sys->p_chain = filter_chain_New( p_spu, "sub filter", false,
SubFilterAllocationInit,
if( b_attach )
{
UpdateSPU( p_spu, VLC_OBJECT(p_input) );
+ var_Create( p_input, "highlight", VLC_VAR_BOOL );
var_AddCallback( p_input, "highlight", CropCallback, p_spu );
var_AddCallback( p_input, "sub-margin", MarginCallback, p_spu->p );
}
else
{
- /* Delete callback */
- var_DelCallback( p_input, "highlight", CropCallback, p_spu );
+ /* Delete callbacks */
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 );
}
}
p_region = p_subpic->p_region;
if( !p_region->fmt.i_sar_num || !p_region->fmt.i_sar_den )
{
- if( p_region->fmt.i_aspect != 0 )
- {
- p_region->fmt.i_sar_den = p_region->fmt.i_aspect;
- p_region->fmt.i_sar_num = VOUT_ASPECT_FACTOR;
- }
- else
- {
- p_region->fmt.i_sar_den = p_fmt_dst->i_sar_den;
- p_region->fmt.i_sar_num = p_fmt_dst->i_sar_num;
- }
+ p_region->fmt.i_sar_den = p_fmt_dst->i_sar_den;
+ p_region->fmt.i_sar_num = p_fmt_dst->i_sar_num;
}
/* Take care of the aspect ratio */
p_subpic->i_original_picture_width = fmt_out.i_width;
p_subpic->i_original_picture_height = fmt_out.i_height;
- fmt_out.i_aspect = 0;
fmt_out.i_sar_num =
fmt_out.i_sar_den = 0;
p_region->p_picture = picture_NewFromFormat( p_fmt );
if( !p_region->p_picture )
{
- free( p_fmt->p_palette );
+ free( p_region->fmt.p_palette );
free( p_region );
return NULL;
}
if( p_filter->p_module )
module_unneed( p_filter, p_filter->p_module );
- vlc_object_detach( p_filter );
vlc_object_release( p_filter );
}
p_scale->fmt_out.video.i_width =
p_scale->fmt_out.video.i_height = b_resize ? 16 : 32;
- p_scale->pf_vout_buffer_new = spu_new_video_buffer;
- p_scale->pf_vout_buffer_del = spu_del_video_buffer;
+ p_scale->pf_video_buffer_new = spu_new_video_buffer;
+ p_scale->pf_video_buffer_del = spu_del_video_buffer;
vlc_object_attach( p_scale, p_obj );
p_scale->p_module = module_need( p_scale, "video filter2", NULL, false );