Commit e1381cf7 authored by Mark Moriarty's avatar Mark Moriarty

freetype and rc extensions. i_font_color and i_font_opacity added to...

freetype and rc extensions.  i_font_color and i_font_opacity added to subpictures, allowing per-object control (defaulting to freetype).  marq and time updated to allow font color and opacity control.  rc update to allow OTF control of all marq and time options.
parent ff146815
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header is required by all modules which have to handle pictures. It * This header is required by all modules which have to handle pictures. It
* includes all common video types and constants. * includes all common video types and constants.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999 - 2005 VideoLAN
* $Id$ * $Id$
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
...@@ -208,7 +208,7 @@ struct subpicture_region_t ...@@ -208,7 +208,7 @@ struct subpicture_region_t
int i_x; /**< position of region */ int i_x; /**< position of region */
int i_y; /**< position of region */ int i_y; /**< position of region */
int i_font_color, i_font_opacity; /**< controls for text subpictures */
subpicture_region_t *p_next; /**< next region in the list */ subpicture_region_t *p_next; /**< next region in the list */
subpicture_region_t *p_cache; /**< modified version of this region */ subpicture_region_t *p_cache; /**< modified version of this region */
/**@}*/ /**@}*/
......
/***************************************************************************** /*****************************************************************************
* rc.c : remote control stdin/stdout module for vlc * rc.c : remote control stdin/stdout module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2004 VideoLAN * Copyright (C) 2004 - 2005 VideoLAN
* $Id$ * $Id$
* *
* Author: Peter Surda <shurdeek@panorama.sth.ac.at> * Author: Peter Surda <shurdeek@panorama.sth.ac.at>
...@@ -357,16 +357,38 @@ static void Run( intf_thread_t *p_intf ) ...@@ -357,16 +357,38 @@ static void Run( intf_thread_t *p_intf )
var_AddCallback( p_intf, "next", Playlist, NULL ); var_AddCallback( p_intf, "next", Playlist, NULL );
var_Create( p_intf, "goto", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "goto", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "goto", Playlist, NULL ); var_AddCallback( p_intf, "goto", Playlist, NULL );
/* marquee on the fly items */
var_Create( p_intf, "marq-marquee", VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "marq-marquee", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-marquee", Other, NULL ); var_AddCallback( p_intf, "marq-marquee", Other, NULL );
var_Create( p_intf, "marq-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "marq-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-x", Other, NULL ); var_AddCallback( p_intf, "marq-x", Other, NULL );
var_Create( p_intf, "marq-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "marq-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-y", Other, NULL ); var_AddCallback( p_intf, "marq-y", Other, NULL );
var_Create( p_intf, "marq-position", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-position", Other, NULL );
var_Create( p_intf, "marq-color", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-color", Other, NULL );
var_Create( p_intf, "marq-opacity", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-opacity", Other, NULL );
var_Create( p_intf, "marq-timeout", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "marq-timeout", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-timeout", Other, NULL ); var_AddCallback( p_intf, "marq-timeout", Other, NULL );
/* time on the fly items */
var_Create( p_intf, "time-format", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-format", Other, NULL );
var_Create( p_intf, "time-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-x", Other, NULL );
var_Create( p_intf, "time-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-y", Other, NULL );
var_Create( p_intf, "time-position", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "time-position", Other, NULL );
var_Create( p_intf, "time-color", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
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, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "pause", Input, NULL ); var_AddCallback( p_intf, "pause", Input, NULL );
var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
...@@ -660,8 +682,18 @@ static void Run( intf_thread_t *p_intf ) ...@@ -660,8 +682,18 @@ static void Run( intf_thread_t *p_intf )
msg_rc(_("| marq-marquee STRING . . overlay STRING in video\n")); msg_rc(_("| marq-marquee STRING . . overlay STRING in video\n"));
msg_rc(_("| marq-x X . . . . . offset of marquee, from left\n")); msg_rc(_("| marq-x X . . . . . offset of marquee, from left\n"));
msg_rc(_("| marq-y Y . . . . . . offset of marquee, from top\n")); msg_rc(_("| marq-y Y . . . . . . offset of marquee, from top\n"));
msg_rc(_("| marq-position #. . . .relative position control\n"));
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-timeout T. . . . timeout of marquee, in ms\n"));
msg_rc( "| \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-y Y . . . . . offset of timestamp, from top\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( "| \n");
} }
msg_rc(_("| help . . . . . . . . . . . . . this help message\n")); msg_rc(_("| help . . . . . . . . . . . . . this help message\n"));
msg_rc(_("| logout . . . . . exit (if in socket connection)\n")); msg_rc(_("| logout . . . . . exit (if in socket connection)\n"));
...@@ -964,6 +996,30 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd, ...@@ -964,6 +996,30 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
var_Set( p_inp->p_libvlc, "marq-y", val ); var_Set( p_inp->p_libvlc, "marq-y", val );
} }
} }
else if( !strcmp( psz_cmd, "marq-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "marq-position", val );
}
}
else if( !strcmp( psz_cmd, "marq-color" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_inp->p_libvlc, "marq-color", val );
}
}
else if( !strcmp( psz_cmd, "marq-opacity" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_inp->p_libvlc, "marq-opacity", val );
}
}
else if( !strcmp( psz_cmd, "marq-timeout" ) ) else if( !strcmp( psz_cmd, "marq-timeout" ) )
{ {
if( strlen( newval.psz_string ) > 0) if( strlen( newval.psz_string ) > 0)
...@@ -972,6 +1028,59 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd, ...@@ -972,6 +1028,59 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
var_Set( p_inp, "marq-timeout", val ); var_Set( p_inp, "marq-timeout", val );
} }
} }
else if( !strcmp( psz_cmd, "time-format" ) )
{
if( strlen( newval.psz_string ) > 0 )
{
val.psz_string = newval.psz_string;
var_Set( p_inp->p_libvlc, "time-format", val );
}
else
{
val.psz_string = "";
var_Set( p_inp->p_libvlc, "time-format", val);
}
}
else if( !strcmp( psz_cmd, "time-x" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "time-x", val );
}
}
else if( !strcmp( psz_cmd, "time-y" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "time-y", val );
}
}
else if( !strcmp( psz_cmd, "time-position" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_inp->p_libvlc, "time-position", val );
}
}
else if( !strcmp( psz_cmd, "time-color" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_inp->p_libvlc, "time-color", val );
}
}
else if( !strcmp( psz_cmd, "time-opacity" ) )
{
if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_inp->p_libvlc, "time-opacity", val );
}
}
/* /*
* sanity check * sanity check
......
...@@ -70,12 +70,9 @@ typedef struct line_desc_t line_desc_t; ...@@ -70,12 +70,9 @@ typedef struct line_desc_t line_desc_t;
static int Create ( vlc_object_t * ); static int Create ( vlc_object_t * );
static void Destroy( vlc_object_t * ); static void Destroy( vlc_object_t * );
static subpicture_t *RenderText( filter_t *, block_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 line_desc_t *NewLine( byte_t * ); static line_desc_t *NewLine( byte_t * );
static int FreetypeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -115,9 +112,11 @@ vlc_module_begin(); ...@@ -115,9 +112,11 @@ vlc_module_begin();
VLC_FALSE ); VLC_FALSE );
add_integer( "freetype-fontsize", 0, NULL, FONTSIZE_TEXT, add_integer( "freetype-fontsize", 0, NULL, FONTSIZE_TEXT,
FONTSIZE_LONGTEXT, VLC_TRUE ); FONTSIZE_LONGTEXT, VLC_TRUE );
/* opacity valid on 0..255, with default 255 = fully opaque */
add_integer_with_range( "freetype-opacity", 255, 0, 255, NULL, add_integer_with_range( "freetype-opacity", 255, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE ); OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "freetype-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE ); /* hook to the color values list, with default 0x00ffffff = white */
add_integer( "freetype-color", 0x00FFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 ); change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "freetype-rel-fontsize", 16, NULL, FONTSIZER_TEXT, add_integer( "freetype-rel-fontsize", 16, NULL, FONTSIZER_TEXT,
...@@ -169,15 +168,11 @@ struct filter_sys_t ...@@ -169,15 +168,11 @@ struct filter_sys_t
FT_Library p_library; /* handle to library */ FT_Library p_library; /* handle to library */
FT_Face p_face; /* handle to face object */ FT_Face p_face; /* handle to face object */
vlc_bool_t i_use_kerning; vlc_bool_t i_use_kerning;
uint8_t i_opacity; uint8_t i_font_opacity; /* freetype-opacity */
uint8_t i_defaultopacity; /* freetype-opacity */ int i_font_color; /* freetype-color */
uint8_t i_tempopacity; /* font-opacity dynamic changes */ int i_red, i_blue, i_green; /* function vars to render */
int i_tempcolor; /* font-color dynamic changes */ uint8_t i_opacity; /* function var to render */
int i_defaultcolor; /* freetype-color */
int i_red, i_green, i_blue; /* color components */
uint8_t pi_gamma[256]; uint8_t pi_gamma[256];
vlc_bool_t b_need_color; /* flag for font color changes */
vlc_bool_t b_need_opacity; /* flag for font opacity changes */
}; };
/***************************************************************************** /*****************************************************************************
...@@ -193,7 +188,6 @@ static int Create( vlc_object_t *p_this ) ...@@ -193,7 +188,6 @@ static int Create( vlc_object_t *p_this )
int i, i_error; int i, i_error;
int i_fontsize = 0; int i_fontsize = 0;
vlc_value_t val; vlc_value_t val;
vlc_object_t *p_input;
/* Allocate structure */ /* Allocate structure */
p_sys = malloc( sizeof( filter_sys_t ) ); p_sys = malloc( sizeof( filter_sys_t ) );
...@@ -205,32 +199,6 @@ static int Create( vlc_object_t *p_this ) ...@@ -205,32 +199,6 @@ static int Create( vlc_object_t *p_this )
p_sys->p_face = 0; p_sys->p_face = 0;
p_sys->p_library = 0; p_sys->p_library = 0;
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
/* accessible variables, to allow individual text subfilters to set their own values */
p_sys->i_tempcolor = var_CreateGetInteger( p_input->p_libvlc , "font-color" );
p_sys->i_tempopacity = var_CreateGetInteger( p_input->p_libvlc , "font-opacity" );
var_AddCallback( p_input->p_libvlc, "font-color", FreetypeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "font-opacity", FreetypeCallback, p_sys );
vlc_object_release( p_input ); /* free the hook */
/* default to opaque letters, white (all colors set to 255): */
p_sys->i_opacity = 255;
p_sys->i_defaultopacity = 255;
p_sys->i_red = 255;
p_sys->i_green = 255;
p_sys->i_blue = 255;
p_sys->i_defaultcolor = 0x00FFFFFF;
/* miscellaneous initialization */
p_sys->b_need_color = VLC_FALSE; /* inversion of true/false */
p_sys->b_need_opacity = VLC_FALSE;
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
{ {
p_sys->pi_gamma[i] = (uint8_t)( pow( (double)i * 255.0f, 0.5f ) ); p_sys->pi_gamma[i] = (uint8_t)( pow( (double)i * 255.0f, 0.5f ) );
...@@ -244,16 +212,12 @@ static int Create( vlc_object_t *p_this ) ...@@ -244,16 +212,12 @@ static int Create( vlc_object_t *p_this )
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_filter, "freetype-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); var_Create( p_filter, "freetype-opacity", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Get( p_filter, "freetype-opacity", &val ); var_Get( p_filter, "freetype-opacity", &val );
p_sys->i_opacity = __MAX( __MIN( val.i_int, 255 ), 0 ); p_sys->i_font_opacity = __MAX( __MIN( val.i_int, 255 ), 0 );
p_sys->i_defaultopacity = p_sys->i_opacity;
var_Create( p_filter, "freetype-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_filter, "freetype-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_filter, "freetype-color", &val ); var_Get( p_filter, "freetype-color", &val );
if ( ( val.i_int > -1 ) && ( val.i_int < 0x00FFFFFF ) ) /* valid range */ if ( ( val.i_int > -1 ) && ( val.i_int < 0x00FFFFFF ) ) /* valid range */
{ {
p_sys->i_defaultcolor = val.i_int; p_sys->i_font_color = val.i_int;
p_sys->i_blue = val.i_int & 0x000000FF;
p_sys->i_green = (val.i_int & 0x0000FF00)/256;
p_sys->i_red = (val.i_int & 0x00FF0000)/(256*256);
} }
else msg_Warn(p_filter, "Invalid freetype color specified, using white [0xFFFFFF]"); else msg_Warn(p_filter, "Invalid freetype color specified, using white [0xFFFFFF]");
...@@ -349,20 +313,9 @@ static int Create( vlc_object_t *p_this ) ...@@ -349,20 +313,9 @@ static int Create( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void Destroy( vlc_object_t *p_this ) static void Destroy( vlc_object_t *p_this )
{ {
vlc_object_t *p_input;
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return;
}
var_Destroy( p_input->p_libvlc , "font-color" );
var_Destroy( p_input->p_libvlc , "font-opacity" );
vlc_object_release( p_input );
FT_Done_Face( p_sys->p_face ); FT_Done_Face( p_sys->p_face );
FT_Done_FreeType( p_sys->p_library ); FT_Done_FreeType( p_sys->p_library );
free( p_sys ); free( p_sys );
...@@ -468,8 +421,7 @@ static void Render( filter_t *p_filter, subpicture_t *p_spu, ...@@ -468,8 +421,7 @@ static void Render( filter_t *p_filter, subpicture_t *p_spu,
{ {
for( x = 0; x < p_glyph->bitmap.width; x++, i_bitmap_offset++ ) for( x = 0; x < p_glyph->bitmap.width; x++, i_bitmap_offset++ )
{ {
p_y[i_offset + x] = i_y*pi_gamma[p_glyph->bitmap.buffer[i_bitmap_offset]] * p_y[i_offset + x] = i_y*opacity*pi_gamma[p_glyph->bitmap.buffer[i_bitmap_offset]]/(256*256);
opacity / ( 256 * 256 );
p_u[i_offset + x] = i_u; p_u[i_offset + x] = i_u;
p_v[i_offset + x] = i_v; p_v[i_offset + x] = i_v;
} }
...@@ -487,7 +439,8 @@ static void Render( filter_t *p_filter, subpicture_t *p_spu, ...@@ -487,7 +439,8 @@ static void Render( filter_t *p_filter, subpicture_t *p_spu,
* needed glyphs into memory. It is used as pf_add_string callback in * needed glyphs into memory. It is used as pf_add_string callback in
* the vout method by this module * the vout method by this module
*/ */
static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block ) static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block,
int font_color, int font_opacity )
{ {
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_subpic = 0; subpicture_t *p_subpic = 0;
...@@ -733,31 +686,28 @@ static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block ) ...@@ -733,31 +686,28 @@ static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block )
#undef face #undef face
#undef glyph #undef glyph
/* check to see whether to use the default color/opacity, or another one: */ /* check to see whether to use the default color/opacity, or another one: */
if( !p_sys->b_need_color ) if( font_color < 0 )
{ {
p_sys->i_blue = p_sys->i_tempcolor & 0x000000FF; p_sys->i_blue = p_sys->i_font_color & 0x000000FF;
p_sys->i_green = (p_sys->i_tempcolor & 0x0000FF00)/256; p_sys->i_green = (p_sys->i_font_color & 0x0000FF00)/256;
p_sys->i_red = (p_sys->i_tempcolor & 0x00FF0000)/(256*256); p_sys->i_red = (p_sys->i_font_color & 0x00FF0000)/(256*256);
} }
else else
{ {
p_sys->i_blue = p_sys->i_defaultcolor & 0x000000FF; p_sys->i_blue = font_color & 0x000000FF;
p_sys->i_green = (p_sys->i_defaultcolor & 0x0000FF00)/256; p_sys->i_green = (font_color & 0x0000FF00)/256;
p_sys->i_red = (p_sys->i_defaultcolor & 0x00FF0000)/(256*256); p_sys->i_red = (font_color & 0x00FF0000)/(256*256);
p_sys->b_need_color = VLC_FALSE; }
} if( font_opacity < 0 )
if( !p_sys->b_need_opacity )
{ {
p_sys->i_opacity = p_sys->i_tempopacity; p_sys->i_opacity = p_sys->i_font_opacity;
} }
else else
{ {
p_sys->i_opacity = p_sys->i_defaultopacity; p_sys->i_opacity = (uint8_t) ( font_opacity & 0x000000FF );
p_sys->b_need_opacity = VLC_FALSE;
} }
Render( p_filter, p_subpic, p_string, p_sys->i_opacity, Render( p_filter, p_subpic, p_string, p_sys->i_opacity,
p_sys->i_red, p_sys->i_green, p_sys->i_blue ); p_sys->i_red, p_sys->i_green, p_sys->i_blue );
FreeString( p_string ); FreeString( p_string );
...@@ -837,24 +787,3 @@ static line_desc_t *NewLine( byte_t *psz_string ) ...@@ -837,24 +787,3 @@ static line_desc_t *NewLine( byte_t *psz_string )
return p_line; return p_line;
} }
/**********************************************************************
* Callback to update params on the fly
**********************************************************************/
static int FreetypeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
filter_sys_t *p_sys = (filter_sys_t *) p_data;
if ( !strncmp( psz_var, "font-color", 8 ) )
{
p_sys->i_tempcolor = newval.i_int;
p_sys->b_need_color = VLC_TRUE;
}
else if ( !strncmp( psz_var, "font-opacity", 8 ) )
{
p_sys->i_tempopacity = newval.i_int;
p_sys->b_need_opacity = VLC_TRUE;
}
return VLC_SUCCESS;
}
/***************************************************************************** /*****************************************************************************
* marq.c : marquee display video plugin for vlc * marq.c : marquee display video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2003-2004 VideoLAN * Copyright (C) 2003-2005 VideoLAN
* $Id: time.c 8751 2004-09-20 21:51:41Z gbazin $ * $Id: time.c 8751 2004-09-20 21:51:41Z gbazin $
* *
* Authors: Mark Moriarty * Authors: Mark Moriarty
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <string.h> #include <string.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/vout.h> #include <vlc/vout.h>
#include "vlc_filter.h" #include "vlc_filter.h"
#include "vlc_block.h" #include "vlc_block.h"
#include "osd.h" #include "osd.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int CreateFilter ( vlc_object_t * ); static int CreateFilter ( vlc_object_t * );
static void DestroyFilter( vlc_object_t * ); static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t ); static subpicture_t *Filter( filter_t *, mtime_t );
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var, static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, vlc_value_t oldval, vlc_value_t newval,
void *p_data ); void *p_data );
static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0,
/***************************************************************************** 0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00,
* filter_sys_t: marquee filter descriptor 0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080,
*****************************************************************************/ 0x00000080, 0x000000FF, 0x0000FFFF};
struct filter_sys_t static char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"),
{ N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), N_("Red"),
int i_xoff, i_yoff; /* offsets for the display string in the video window */ N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"),
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */ N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"),
int i_timeout; N_("Aqua") };
char *psz_marquee; /* marquee string */ /*****************************************************************************
* filter_sys_t: marquee filter descriptor
time_t last_time; *****************************************************************************/
vlc_bool_t b_absolute; /* position control, relative vs. absolute */ struct filter_sys_t
{
vlc_bool_t b_need_update; int i_xoff, i_yoff; /* offsets for the display string in the video window */
};