int, int, int );
subpicture_t * ( *pf_sub_filter ) ( filter_t *, mtime_t );
- subpicture_t * ( *pf_render_string ) ( filter_t *, block_t *, int, int );
+ /* pf_render_string maps to RenderText in freetype.c */
+ subpicture_t * ( *pf_render_string ) ( filter_t *, block_t *, int, int, int );
/*
* Buffers allocation
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;
subpicture_region_t *p_next; /**< next region in the list */
subpicture_region_t *p_cache; /**< modified version of this region */
/**@}*/
var_AddCallback( p_intf, "marq-opacity", Other, NULL );
var_Create( p_intf, "marq-timeout", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-timeout", Other, NULL );
+ var_Create( p_intf, "marq-size", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "marq-size", Other, NULL );
var_Create( p_intf, "mosaic-alpha", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "mosaic-alpha", Other, NULL );
var_AddCallback( p_intf, "time-color", Other, NULL );
var_Create( p_intf, "time-opacity", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-opacity", Other, NULL );
+ var_Create( p_intf, "time-size", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-size", Other, NULL );
var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "pause", Input, NULL );
msg_rc(_("| marq-color # . . . . font color of marquee, RGB\n"));
msg_rc(_("| marq-opacity # . . . . . . . .opacity of marquee\n"));
msg_rc(_("| marq-timeout T. . . . timeout of marquee, in ms\n"));
+ msg_rc(_("| marq-size # . . . font size of marquee, in pixels\n"));
msg_rc( "| \n");
msg_rc(_("| time-format STRING . . . overlay STRING in video\n"));
msg_rc(_("| time-x X . . . . .offset of timestamp, from left\n"));
msg_rc(_("| time-position #. . . .relative position control\n"));
msg_rc(_("| time-color # . . . font color of timestamp, RGB\n"));
msg_rc(_("| time-opacity # . . . . . . .opacity of timestamp\n"));
+ msg_rc(_("| time-size # . .font size of timestamp, in pixels\n"));
msg_rc( "| \n");
}
msg_rc(_("| help . . . . . . . . . . . . . this help message\n"));
var_Set( p_inp->p_libvlc, "marq-opacity", val );
}
}
+ else if( !strcmp( psz_cmd, "marq-size" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "marq-size", val );
+ }
+ }
else if( !strcmp( psz_cmd, "marq-timeout" ) )
{
if( strlen( newval.psz_string ) > 0)
var_Set( p_inp->p_libvlc, "time-opacity", val );
}
}
-
+ else if( !strcmp( psz_cmd, "time-size" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "time-size", val );
+ }
+ }
+
/*
* sanity check
*/
static void Destroy( vlc_object_t * );
/* The RenderText call maps to pf_render_string, defined in vlc_filter.h */
-static subpicture_t *RenderText( filter_t *, block_t *, int, int );
+static subpicture_t *RenderText( filter_t *, block_t *, int, int, int );
static line_desc_t *NewLine( byte_t * );
/*****************************************************************************
uint8_t i_font_opacity; /* freetype-opacity */
int i_font_color; /* freetype-color */
int i_red, i_blue, i_green; /* function vars to render */
+ int i_font_size;
uint8_t i_opacity; /* function var to render */
uint8_t pi_gamma[256];
};
filter_sys_t *p_sys;
char *psz_fontfile = NULL;
int i, i_error;
- int i_fontsize = 0;
vlc_value_t val;
/* Allocate structure */
}
p_sys->p_face = 0;
p_sys->p_library = 0;
+ p_sys->i_font_size = 0;
for( i = 0; i < 256; i++ )
{
var_Get( p_filter, "freetype-fontsize", &val );
if( val.i_int )
{
- i_fontsize = val.i_int;
+ p_sys->i_font_size = val.i_int;
}
else
{
var_Get( p_filter, "freetype-rel-fontsize", &val );
- i_fontsize = (int)p_filter->fmt_out.video.i_height / val.i_int;
+ p_sys->i_font_size = (int)p_filter->fmt_out.video.i_height / val.i_int;
}
- if( i_fontsize <= 0 )
+ if( p_sys->i_font_size <= 0 )
{
msg_Warn( p_filter, "Invalid fontsize, using 12" );
- i_fontsize = 12;
+ p_sys->i_font_size = 12;
}
- msg_Dbg( p_filter, "Using fontsize: %i", i_fontsize);
+ msg_Dbg( p_filter, "Using fontsize: %i", p_sys->i_font_size);
- i_error = FT_Set_Pixel_Sizes( p_sys->p_face, 0, i_fontsize );
+ i_error = FT_Set_Pixel_Sizes( p_sys->p_face, 0, p_sys->i_font_size );
if( i_error )
{
- msg_Err( p_filter, "couldn't set font size to %d", i_fontsize );
+ msg_Err( p_filter, "couldn't set font size to %d", p_sys->i_font_size );
goto error;
}
*****************************************************************************/
static void Render( filter_t *p_filter, subpicture_t *p_spu,
subpicture_data_t *p_string, uint8_t opacity,
- int red, int green, int blue )
+ int red, int green, int blue)
{
filter_sys_t *p_sys = p_filter->p_sys;
line_desc_t *p_line;
video_format_t fmt;
int i, x, y, i_pitch;
uint8_t i_y, i_u, i_v; /* YUV values, derived from incoming RGB */
-
+
/* calculate text color components: */
i_y = (uint8_t) ( ( 66 * red + 129 * green + 25 * blue + 128) >> 8) + 16;
i_u = (uint8_t) ( ( -38 * red - 74 * green + 112 * blue + 128) >> 8) + 128;
* the vout method by this module
*/
static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block,
- int font_color, int font_opacity )
+ int font_color, int font_opacity, int font_size )
{
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_subpic = 0;
#endif
if( iconv_handle == (vlc_iconv_t)-1 )
{
- msg_Warn( p_filter, "unable to do convertion" );
+ msg_Warn( p_filter, "unable to do conversion" );
goto error;
}
+ /* Set up the glyphs for the desired font size. By definition,
+ p_sys->i_font_size is a valid value, else the initial Create would
+ have failed. Using -1 as a flag to use the freetype-fontsize */
+ if ( font_size < 0 )
+ {
+ FT_Set_Pixel_Sizes( p_sys->p_face, 0, p_sys->i_font_size );
+ }
+ else
+ {
+ i_error = FT_Set_Pixel_Sizes( p_sys->p_face, 0, font_size );
+ if( i_error )
+ {
+ msg_Warn( p_filter, "Invalid font size to RenderText, using %d",
+ p_sys->i_font_size );
+ FT_Set_Pixel_Sizes( p_sys->p_face, 0, p_sys->i_font_size );
+ }
+ }
+
{
char *p_in_buffer, *p_out_buffer;
size_t i_in_bytes, i_out_bytes, i_out_bytes_left, i_ret;
\r
char *psz_marquee; /* marquee string */\r
\r
- int i_font_color, i_font_opacity; /* font color control */\r
+ int i_font_color, i_font_opacity, i_font_size; /* font control */\r
\r
time_t last_time;\r
vlc_bool_t b_absolute; /* position control, relative vs. absolute */\r
#define OPACITY_TEXT N_("Opacity, -1..255")\r
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of overlay text. " \\r
"-1 = use freetype-opacity, 0 = transparent, 255 = totally opaque. " )\r
+#define SIZE_TEXT N_("Font size, pixels")\r
+#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \\r
+ "with -1 = use freetype-fontsize" )\r
+\r
#define COLOR_TEXT N_("Text Default Color")\r
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \\r
"-1 = use freetype-color, #000000 = all colors off, " \\r
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );\r
add_integer( "marq-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );\r
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );\r
+ add_integer( "marq-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );\r
\r
set_description( _("Marquee display sub filter") );\r
add_shortcut( "marq" );\r
filter_t *p_filter = (filter_t *)p_this;\r
filter_sys_t *p_sys;\r
vlc_object_t *p_input;\r
- vlc_value_t val;\r
\r
/* Allocate structure */\r
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );\r
var_Create( p_input->p_libvlc, "marq-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );\r
p_sys->i_font_opacity = var_CreateGetInteger( p_input->p_libvlc , "marq-opacity" );\r
p_sys->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "marq-color" );\r
+ p_sys->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "marq-size" );\r
\r
var_AddCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys );\r
var_AddCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys );\r
var_AddCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys );\r
var_AddCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys );\r
var_AddCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );\r
+ var_AddCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys );\r
\r
vlc_object_release( p_input );\r
\r
var_Destroy( p_input->p_libvlc , "marq-position" );\r
var_Destroy( p_input->p_libvlc , "marq-color");\r
var_Destroy( p_input->p_libvlc , "marq-opacity");\r
+ var_Destroy( p_input->p_libvlc , "marq-size");\r
+\r
vlc_object_release( p_input );\r
}\r
\r
p_spu->i_x = p_sys->i_xoff;\r
p_spu->i_y = p_sys->i_yoff;\r
p_spu->p_region->i_font_color = p_sys->i_font_color;\r
- p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;;\r
+ p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;\r
+ p_spu->p_region->i_font_size = p_sys->i_font_size;\r
\r
p_spu->i_flags = p_sys->i_pos;\r
\r
{\r
p_sys->i_font_opacity = newval.i_int;\r
}\r
+ else if ( !strncmp( psz_var, "marq-size", 6 ) )\r
+ {\r
+ p_sys->i_font_size = newval.i_int;\r
+ }\r
else if ( !strncmp( psz_var, "marq-timeout", 12 ) )\r
{\r
p_sys->i_timeout = newval.i_int;\r
int i_xoff, i_yoff; /* offsets for the display string in the video window */
char *psz_format; /* time format string */
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
- int i_font_color, i_font_opacity; /* font color control */
+ int i_font_color, i_font_opacity, i_font_size; /* font control */
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
time_t last_time;
#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 SIZE_TEXT N_("Font size, pixels")
+#define SIZE_LONGTEXT N_("Specify the font size, in pixels, " \
+ "with -1 = use freetype-fontsize" )
+
#define COLOR_TEXT N_("Text Default Color")
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \
"-1 = use freetype-color, #000000 = all colors off, " \
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 );
+ add_integer( "time-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
set_description( _("Time display sub filter") );
add_shortcut( "time" );
vlc_module_end();
var_Create( p_input->p_libvlc, "time-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
p_sys->i_font_opacity = var_CreateGetInteger( p_input->p_libvlc , "time-opacity" );
p_sys->i_font_color = var_CreateGetInteger( p_input->p_libvlc , "time-color" );
-
+ p_sys->i_font_size = var_CreateGetInteger( p_input->p_libvlc , "time-size" );
+
var_AddCallback( p_input->p_libvlc, "time-x", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-y", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-format", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-position", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-color", TimeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "time-opacity", TimeCallback, p_sys );
+ var_AddCallback( p_input->p_libvlc, "time-size", TimeCallback, p_sys );
vlc_object_release( p_input );
var_Destroy( p_input->p_libvlc , "time-position" );
var_Destroy( p_input->p_libvlc , "time-color");
var_Destroy( p_input->p_libvlc , "time-opacity");
+ var_Destroy( p_input->p_libvlc , "time-size");
+
vlc_object_release( p_input );
}
p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff;
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_opacity = p_sys->i_font_opacity;
+ p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->i_flags = p_sys->i_pos;
{
p_sys->i_yoff = newval.i_int;
}
- else if ( !strncmp( psz_var, "time-color", 8 ) ) /* "time-col" */
+ else if ( !strncmp( psz_var, "time-color", 8 ) ) /* "time-c" */
{
p_sys->i_font_color = newval.i_int;
}
- else if ( !strncmp( psz_var, "time-opacity", 8 ) ) /* "time-opa" */
+ else if ( !strncmp( psz_var, "time-opacity", 8 ) ) /* "time-o" */
{
p_sys->i_font_opacity = newval.i_int;
}
+ else if ( !strncmp( psz_var, "time-size", 6 ) )
+ {
+ p_sys->i_font_size = newval.i_int;
+ }
else if ( !strncmp( psz_var, "time-position", 8 ) )
/* willing to accept a match against time-pos */
{
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 */
if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
p_fmt->p_palette = p_region->fmt.p_palette =
/* the actual call to RenderText in freetype.c: */
p_subpic_tmp = p_spu->p_text->pf_render_string(
p_spu->p_text, p_new_block,
- p_region->i_font_color, p_region->i_font_opacity);
+ p_region->i_font_color, p_region->i_font_opacity,
+ p_region->i_font_size);
if( p_subpic_tmp )
{