Commit a504fae3 authored by Gildas Bazin's avatar Gildas Bazin

* include/vlc_filter.h, vlc_video.h, src/video_output/vout_subpictures.c: new...

* include/vlc_filter.h, vlc_video.h, src/video_output/vout_subpictures.c: new simpler and more powerful text renderer api.
* modules/misc/freetype.c: rewrite to the new api + outputs YUVP subpicture regions now.
parent 08f8a4a6
......@@ -58,8 +58,7 @@ struct filter_t
int, int, int );
subpicture_t * ( *pf_sub_filter ) ( filter_t *, mtime_t );
/* pf_render_string maps to RenderText in freetype.c */
subpicture_region_t *( *pf_render_string ) ( filter_t *, subpicture_t *, subpicture_region_t * );
int ( *pf_render_text ) ( filter_t *, subpicture_region_t *, subpicture_region_t * );
/*
* Buffers allocation
......
......@@ -204,12 +204,14 @@ struct subpicture_region_t
video_format_t fmt; /**< format of the picture */
picture_t picture; /**< picture comprising this region */
char *psz_text; /**< text string comprising this region */
int i_x; /**< position of region */
int i_y; /**< position of region */
int i_font_color, i_font_opacity; /**< controls for text subpictures */
int i_font_size;
char *psz_text; /**< text string comprising this region */
int i_text_color; /**< text color (RGB native endianess) */
int i_text_alpha; /**< text transparency */
int i_text_size; /**< text size */
subpicture_region_t *p_next; /**< next region in the list */
subpicture_region_t *p_cache; /**< modified version of this region */
/**@}*/
......
This diff is collapsed.
......@@ -84,8 +84,8 @@ struct filter_sys_t
"displayed, in milliseconds. Default value is " \
"0 (remain forever).")
#define OPACITY_TEXT N_("Opacity, -1..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of overlay text. " \
"-1 = use freetype-opacity, 0 = transparent, 255 = totally opaque. " )
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of " \
"overlay text. 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
"with -1 = use freetype-fontsize" )
......@@ -123,7 +123,7 @@ vlc_module_begin();
add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 5 sets the default to top [1] left [4] */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "marq-opacity", -1, -1, 255, NULL,
add_integer_with_range( "marq-opacity", 0, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "marq-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
......@@ -276,9 +276,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->i_y = p_sys->i_yoff;
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->p_region->i_text_color = p_sys->i_font_color;
p_spu->p_region->i_text_alpha = p_sys->i_font_opacity;
p_spu->p_region->i_text_size = p_sys->i_font_size;
p_sys->b_need_update = VLC_FALSE;
......
......@@ -72,9 +72,9 @@ struct filter_sys_t
#define POSX_LONGTEXT N_("X offset, from the left screen edge" )
#define POSY_TEXT N_("Y offset, from the top")
#define POSY_LONGTEXT N_("Y offset, down from the top" )
#define OPACITY_TEXT N_("Opacity, -1..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of overlay text. " \
"-1 = use freetype-opacity, 0 = transparent, 255 = totally opaque. " )
#define OPACITY_TEXT N_("Opacity, 0..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of " \
"overlay text. 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
"with -1 = use freetype-fontsize" )
......@@ -109,7 +109,7 @@ vlc_module_begin();
add_integer( "time-position", 9, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 9 sets the default to bottom-left, minimizing jitter */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "time-opacity", -1, -1, 255, NULL,
add_integer_with_range( "time-opacity", 0, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "time-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
......@@ -269,9 +269,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->i_y = p_sys->i_yoff;
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->p_region->i_text_color = p_sys->i_font_color;
p_spu->p_region->i_text_alpha = 255 - p_sys->i_font_opacity;
p_spu->p_region->i_text_size = p_sys->i_font_size;
return p_spu;
}
......
......@@ -257,9 +257,7 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
p_region->p_cache = 0;
p_region->fmt = *p_fmt;
p_region->psz_text = 0;
p_region->i_font_color = -1; /* default to using freetype-color -opacity */
p_region->i_font_opacity = -1;
p_region->i_font_size = -1; /* and the freetype fontsize */
p_region->i_text_color = 0xFFFFFF;
if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
p_fmt->p_palette = p_region->fmt.p_palette =
......@@ -302,9 +300,7 @@ subpicture_region_t *__spu_MakeRegion( vlc_object_t *p_this,
p_region->p_cache = 0;
p_region->fmt = *p_fmt;
p_region->psz_text = 0;
p_region->i_font_color = -1; /* default to using freetype-color -opacity */
p_region->i_font_opacity = -1;
p_region->i_font_size = -1; /* and the freetype fontsize */
p_region->i_text_color = 0xFFFFFF;
if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
p_fmt->p_palette = p_region->fmt.p_palette =
......@@ -582,20 +578,10 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
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_string )
p_spu->p_text->pf_render_text )
{
/* TODO: do it in a less hacky way
* (modify text renderer API) */
subpicture_region_t *p_tmp_region;
/* the actual call to RenderText in freetype.c: */
p_tmp_region = p_spu->p_text->pf_render_string(
p_spu->p_text, p_subpic, p_region );
if( p_tmp_region )
{
// p_subpic->pf_destroy_region( p_spu, p_region );
p_region = p_tmp_region;
}
p_spu->p_text->pf_render_text( p_spu->p_text,
p_region, p_region );
}
}
......
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