#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-
-#include "vlc_block.h"
-#include "vlc_video.h"
-#include "video_output.h"
-#include "vlc_spu.h"
-#include "vlc_filter.h"
+#include <vlc_vout.h>
+#include <vlc_block.h>
+#include <vlc_filter.h>
+#include <vlc_osd.h>
/*****************************************************************************
* Local prototypes
*/
int spu_Init( spu_t *p_spu )
{
- char *psz_filter, *psz_filter_orig;
+ char *psz_parser;
vlc_value_t val;
/* If the user requested a sub margin, we force the position. */
var_Create( p_spu, "sub-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_spu, "sub-filter", &val );
- psz_filter = psz_filter_orig = val.psz_string;
- while( psz_filter && *psz_filter )
+
+ psz_parser = val.psz_string;
+
+ while( psz_parser && *psz_parser )
{
- char *psz_parser = strchr( psz_filter, ':' );
+ config_chain_t *p_cfg; /* Do we ever need to free this ? */
+ char *psz_name;
+
+ psz_parser = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
- if( psz_parser ) *psz_parser++ = 0;
+ msg_Dbg( p_spu, "adding sub-filter: %s", psz_name );
p_spu->pp_filter[p_spu->i_filter] =
vlc_object_create( p_spu, VLC_OBJECT_FILTER );
vlc_object_attach( p_spu->pp_filter[p_spu->i_filter], p_spu );
p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_new = sub_new_buffer;
p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_del = sub_del_buffer;
+ p_spu->pp_filter[p_spu->i_filter]->p_cfg = p_cfg;;
p_spu->pp_filter[p_spu->i_filter]->p_module =
module_Need( p_spu->pp_filter[p_spu->i_filter],
- "sub filter", psz_filter, 0 );
+ "sub filter", psz_name, 0 );
if( p_spu->pp_filter[p_spu->i_filter]->p_module )
{
filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) );
msg_Dbg( p_spu, "can't add anymore filters" );
}
- psz_filter = psz_parser;
+ free( psz_name );
}
- if( psz_filter_orig ) free( psz_filter_orig );
+ if( val.psz_string ) free( val.psz_string );
return VLC_EGENERIC;
}
p_region->picture.pf_release( &p_region->picture );
if( p_region->fmt.p_palette ) free( p_region->fmt.p_palette );
if( p_region->p_cache ) __spu_DestroyRegion( p_this, p_region->p_cache );
+
+ if( p_region->psz_text )
+ free( p_region->psz_text );
+ //free( p_region->p_style ); FIXME --fenrir plugin does not allocate the memory for it. I think it might lead to segfault, video renderer can live longer than the decoder
free( p_region );
}
if( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') )
{
- if( p_spu->p_text && p_spu->p_text->p_module &&
- p_spu->p_text->pf_render_text )
+ if( p_spu->p_text && p_spu->p_text->p_module )
{
p_region->i_align = p_subpic->i_flags;
- p_spu->p_text->pf_render_text( p_spu->p_text,
- p_region, p_region );
+
+ if( p_spu->p_text->pf_render_html && p_region->psz_html )
+ {
+ p_spu->p_text->pf_render_html( p_spu->p_text,
+ p_region, p_region );
+ }
+ else if( p_spu->p_text->pf_render_text )
+ {
+ p_spu->p_text->pf_render_text( p_spu->p_text,
+ p_region, p_region );
+ }
}
}
p_subpic->i_y * i_scale_height / 1000;
}
+
+ i_x_offset = __MAX( i_x_offset, 0 );
+ i_y_offset = __MAX( i_y_offset, 0 );
if( p_spu->i_margin != 0 && p_spu->b_force_crop == VLC_FALSE )
{
}
}
+ i_x_offset = __MAX( i_x_offset, 0 );
+ i_y_offset = __MAX( i_y_offset, 0 );
+
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst,
p_pic_src, &p_region->picture, i_x_offset, i_y_offset,
i_fade_alpha * p_subpic->i_alpha / 255 );
case SPU_CHANNEL_REGISTER:
pi = (int *)va_arg( args, int * );
if( pi ) *pi = p_spu->i_channel++;
- msg_Dbg( p_spu, "Registering subpicture channel, ID: %i",
- p_spu->i_channel - 1 );
break;
case SPU_CHANNEL_CLEAR: