p_region->p_cache = 0;
p_region->fmt = *p_fmt;
p_region->psz_text = 0;
- p_region->i_text_color = 0xFFFFFF;
+ p_region->p_style = NULL;
if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
p_fmt->p_palette = p_region->fmt.p_palette =
p_region->p_cache = 0;
p_region->fmt = *p_fmt;
p_region->psz_text = 0;
- p_region->i_text_color = 0xFFFFFF;
+ p_region->p_style = NULL;
if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
p_fmt->p_palette = p_region->fmt.p_palette =
if( p_region->picture.pf_release )
p_region->picture.pf_release( &p_region->picture );
if( p_region->fmt.p_palette ) free( p_region->fmt.p_palette );
- if( p_region->psz_text ) free( p_region->psz_text );
if( p_region->p_cache ) __spu_DestroyRegion( p_this, p_region->p_cache );
free( p_region );
}
}
/* Load the text rendering module */
- if( !p_spu->p_text && p_region )
+ if( !p_spu->p_text && p_region && p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') )
{
+ char *psz_modulename = NULL;
+
p_spu->p_text = vlc_object_create( p_spu, VLC_OBJECT_FILTER );
vlc_object_attach( p_spu->p_text, p_spu );
p_spu->p_text->fmt_out.video.i_width =
p_spu->p_text->fmt_out.video.i_visible_width =
- p_fmt->i_width;
+ p_fmt->i_width;
p_spu->p_text->fmt_out.video.i_height =
p_spu->p_text->fmt_out.video.i_visible_height =
- p_fmt->i_height;
+ p_fmt->i_height;
p_spu->p_text->pf_sub_buffer_new = spu_new_buffer;
p_spu->p_text->pf_sub_buffer_del = spu_del_buffer;
- p_spu->p_text->p_module =
- module_Need( p_spu->p_text, "text renderer", 0, 0 );
+
+ psz_modulename = var_CreateGetString( p_spu, "text-renderer" );
+ if( psz_modulename && *psz_modulename )
+ {
+ p_spu->p_text->p_module =
+ module_Need( p_spu->p_text, "text renderer", psz_modulename, VLC_TRUE );
+ }
+ if( !p_spu->p_text->p_module )
+ {
+ p_spu->p_text->p_module =
+ module_Need( p_spu->p_text, "text renderer", 0, 0 );
+ }
+ if( psz_modulename ) free( psz_modulename );
}
- else if( p_region )
+ if( p_spu->p_text )
{
- p_spu->p_text->fmt_out.video.i_width =
- p_spu->p_text->fmt_out.video.i_visible_width =
+ if( p_subpic->i_original_picture_height > 0 &&
+ p_subpic->i_original_picture_width > 0 )
+ {
+ p_spu->p_text->fmt_out.video.i_width =
+ p_spu->p_text->fmt_out.video.i_visible_width =
+ p_subpic->i_original_picture_width;
+ p_spu->p_text->fmt_out.video.i_height =
+ p_spu->p_text->fmt_out.video.i_visible_height =
+ p_subpic->i_original_picture_height;
+ }
+ else
+ {
+ p_spu->p_text->fmt_out.video.i_width =
+ p_spu->p_text->fmt_out.video.i_visible_width =
p_fmt->i_width;
- p_spu->p_text->fmt_out.video.i_height =
- p_spu->p_text->fmt_out.video.i_visible_height =
+ p_spu->p_text->fmt_out.video.i_height =
+ p_spu->p_text->fmt_out.video.i_visible_height =
p_fmt->i_height;
+ }
}
i_scale_width = i_scale_width_orig;
i_scale_height = i_scale_height_orig;
- if( p_subpic->i_original_picture_width &&
- p_subpic->i_original_picture_height )
+ if( p_subpic->i_original_picture_height > 0 &&
+ p_subpic->i_original_picture_width > 0 )
{
i_scale_width = i_scale_width * p_fmt->i_width /
p_subpic->i_original_picture_width;
i_scale_height = i_scale_height * p_fmt->i_height /
p_subpic->i_original_picture_height;
}
+ else if( p_subpic->i_original_picture_height > 0 )
+ {
+ i_scale_height = i_scale_height * p_fmt->i_height /
+ p_subpic->i_original_picture_height;
+ i_scale_width = i_scale_height * i_scale_height / p_fmt->i_height;
+ }
/* Set default subpicture aspect ratio */
if( p_region && p_region->fmt.i_aspect &&
if( p_spu->p_text && p_spu->p_text->p_module &&
p_spu->p_text->pf_render_text )
{
- p_region->i_text_align = p_subpic->i_flags & 0x3;
+ p_region->i_align = p_subpic->i_flags;
p_spu->p_text->pf_render_text( p_spu->p_text,
p_region, p_region );
}