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 @@
* This header is required by all modules which have to handle pictures. It
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999 - 2005 VideoLAN
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
......@@ -208,7 +208,7 @@ struct subpicture_region_t
int i_x; /**< 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_cache; /**< modified version of this region */
/**@}*/
......
/*****************************************************************************
* rc.c : remote control stdin/stdout module for vlc
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* Copyright (C) 2004 - 2005 VideoLAN
* $Id$
*
* Author: Peter Surda <shurdeek@panorama.sth.ac.at>
......@@ -357,16 +357,38 @@ static void Run( intf_thread_t *p_intf )
var_AddCallback( p_intf, "next", Playlist, NULL );
var_Create( p_intf, "goto", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
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_AddCallback( p_intf, "marq-marquee", Other, NULL );
var_Create( p_intf, "marq-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-x", Other, NULL );
var_Create( p_intf, "marq-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
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_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_AddCallback( p_intf, "pause", Input, NULL );
var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
......@@ -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-x X . . . . . offset of marquee, from left\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( "| \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(_("| logout . . . . . exit (if in socket connection)\n"));
......@@ -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 );
}
}
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" ) )
{
if( strlen( newval.psz_string ) > 0)
......@@ -972,6 +1028,59 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
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
......
......@@ -70,12 +70,9 @@ typedef struct line_desc_t line_desc_t;
static int Create ( 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 int FreetypeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
/*****************************************************************************
* Module descriptor
......@@ -115,9 +112,11 @@ vlc_module_begin();
VLC_FALSE );
add_integer( "freetype-fontsize", 0, NULL, FONTSIZE_TEXT,
FONTSIZE_LONGTEXT, VLC_TRUE );
/* opacity valid on 0..255, with default 255 = fully opaque */
add_integer_with_range( "freetype-opacity", 255, 0, 255, NULL,
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 );
add_integer( "freetype-rel-fontsize", 16, NULL, FONTSIZER_TEXT,
......@@ -169,15 +168,11 @@ struct filter_sys_t
FT_Library p_library; /* handle to library */
FT_Face p_face; /* handle to face object */
vlc_bool_t i_use_kerning;
uint8_t i_opacity;
uint8_t i_defaultopacity; /* freetype-opacity */
uint8_t i_tempopacity; /* font-opacity dynamic changes */
int i_tempcolor; /* font-color dynamic changes */
int i_defaultcolor; /* freetype-color */
int i_red, i_green, i_blue; /* color components */
uint8_t i_font_opacity; /* freetype-opacity */
int i_font_color; /* freetype-color */
int i_red, i_blue, i_green; /* function vars to render */
uint8_t i_opacity; /* function var to render */
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 )
int i, i_error;
int i_fontsize = 0;
vlc_value_t val;
vlc_object_t *p_input;
/* Allocate structure */
p_sys = malloc( sizeof( filter_sys_t ) );
......@@ -205,32 +199,6 @@ static int Create( vlc_object_t *p_this )
p_sys->p_face = 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++ )
{
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 )
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 );
p_sys->i_opacity = __MAX( __MIN( val.i_int, 255 ), 0 );
p_sys->i_defaultopacity = p_sys->i_opacity;
p_sys->i_font_opacity = __MAX( __MIN( val.i_int, 255 ), 0 );
var_Create( p_filter, "freetype-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_filter, "freetype-color", &val );
if ( ( val.i_int > -1 ) && ( val.i_int < 0x00FFFFFF ) ) /* valid range */
{
p_sys->i_defaultcolor = 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);
p_sys->i_font_color = val.i_int;
}
else msg_Warn(p_filter, "Invalid freetype color specified, using white [0xFFFFFF]");
......@@ -349,20 +313,9 @@ static int Create( 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_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_FreeType( p_sys->p_library );
free( p_sys );
......@@ -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++ )
{
p_y[i_offset + x] = i_y*pi_gamma[p_glyph->bitmap.buffer[i_bitmap_offset]] *
opacity / ( 256 * 256 );
p_y[i_offset + x] = i_y*opacity*pi_gamma[p_glyph->bitmap.buffer[i_bitmap_offset]]/(256*256);
p_u[i_offset + x] = i_u;
p_v[i_offset + x] = i_v;
}
......@@ -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
* 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;
subpicture_t *p_subpic = 0;
......@@ -733,31 +686,28 @@ static subpicture_t *RenderText( filter_t *p_filter, block_t *p_block )
#undef face
#undef glyph
/* 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_green = (p_sys->i_tempcolor & 0x0000FF00)/256;
p_sys->i_red = (p_sys->i_tempcolor & 0x00FF0000)/(256*256);
p_sys->i_blue = p_sys->i_font_color & 0x000000FF;
p_sys->i_green = (p_sys->i_font_color & 0x0000FF00)/256;
p_sys->i_red = (p_sys->i_font_color & 0x00FF0000)/(256*256);
}
else
{
p_sys->i_blue = p_sys->i_defaultcolor & 0x000000FF;
p_sys->i_green = (p_sys->i_defaultcolor & 0x0000FF00)/256;
p_sys->i_red = (p_sys->i_defaultcolor & 0x00FF0000)/(256*256);
p_sys->b_need_color = VLC_FALSE;
}
if( !p_sys->b_need_opacity )
p_sys->i_blue = font_color & 0x000000FF;
p_sys->i_green = (font_color & 0x0000FF00)/256;
p_sys->i_red = (font_color & 0x00FF0000)/(256*256);
}
if( font_opacity < 0 )
{
p_sys->i_opacity = p_sys->i_tempopacity;
p_sys->i_opacity = p_sys->i_font_opacity;
}
else
{
p_sys->i_opacity = p_sys->i_defaultopacity;
p_sys->b_need_opacity = VLC_FALSE;
p_sys->i_opacity = (uint8_t) ( font_opacity & 0x000000FF );
}
Render( p_filter, p_subpic, p_string, p_sys->i_opacity,
p_sys->i_red, p_sys->i_green, p_sys->i_blue );
FreeString( p_string );
......@@ -837,24 +787,3 @@ static line_desc_t *NewLine( byte_t *psz_string )
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
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id: time.c 8751 2004-09-20 21:51:41Z gbazin $
*
* Authors: Mark Moriarty
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include "vlc_filter.h"
#include "vlc_block.h"
#include "osd.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t );
static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
/*****************************************************************************
* filter_sys_t: marquee filter descriptor
*****************************************************************************/
struct filter_sys_t
{
int i_xoff, i_yoff; /* offsets for the display string in the video window */
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
int i_timeout;
char *psz_marquee; /* marquee string */
time_t last_time;
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
vlc_bool_t b_need_update;
};
#define MSG_TEXT N_("Marquee text")
#define MSG_LONGTEXT N_("Marquee text to display")
#define POSX_TEXT N_("X offset, from left")
#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 TIMEOUT_TEXT N_("Marquee timeout")
#define TIMEOUT_LONGTEXT N_("Defines the time the marquee must remain " \
"displayed, in milliseconds. Default value is " \
"0 (remain forever).")
#define POS_TEXT N_("Marquee position")
#define POS_LONGTEXT N_( \
"You can enforce the marquee position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values by adding them).")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_capability( "sub filter", 0 );
set_shortname( N_("Marquee" ));
set_callbacks( CreateFilter, DestroyFilter );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_SUBPIC );
add_string( "marq-marquee", "Marquee", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
add_integer( "marq-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_FALSE );
add_integer( "marq-y", -1, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
add_integer( "marq-timeout", 0, NULL, TIMEOUT_TEXT, TIMEOUT_LONGTEXT,
VLC_FALSE );
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 );
set_description( _("Marquee display sub filter") );
add_shortcut( "marq" );
vlc_module_end();
/*****************************************************************************
* CreateFilter: allocates marquee video filter
*****************************************************************************/
static int CreateFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
vlc_object_t *p_input;
/* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
/* Hook used for callback variables */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return VLC_ENOOBJ;
}
p_sys->i_xoff = var_CreateGetInteger( p_input->p_libvlc , "marq-x" );
p_sys->i_yoff = var_CreateGetInteger( p_input->p_libvlc , "marq-y" );
p_sys->i_timeout = var_CreateGetInteger( p_input->p_libvlc , "marq-timeout" );
p_sys->i_pos = var_CreateGetInteger( p_input->p_libvlc , "marq-position" );
p_sys->psz_marquee = var_CreateGetString( p_input->p_libvlc, "marq-marquee" );
var_AddCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
var_AddCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys );
vlc_object_release( p_input );
p_sys->b_absolute = VLC_TRUE;
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{
p_sys->b_absolute = VLC_FALSE;
p_sys->i_xoff = 0; p_sys->i_yoff = 0;
}
/* Misc init */
p_filter->pf_sub_filter = Filter;
p_sys->last_time = ((time_t)-1);
p_sys->b_need_update = VLC_TRUE;
return VLC_SUCCESS;
}
/*****************************************************************************
* DestroyFilter: destroy marquee video filter
*****************************************************************************/
static void DestroyFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *p_input;
if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
free( p_sys );
/* Delete the marquee variables from playlist */
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( !p_input )
{
return;
}
var_Destroy( p_input->p_libvlc , "marq-marquee" );
var_Destroy( p_input->p_libvlc , "marq-x" );
var_Destroy( p_input->p_libvlc , "marq-y" );
var_Destroy( p_input->p_libvlc , "marq-timeout" );
var_Destroy( p_input->p_libvlc , "marq-position" );
vlc_object_release( p_input );
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function outputs subpictures at regular time intervals.
****************************************************************************/
static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_spu;
video_format_t fmt;
time_t t;
if( p_sys->last_time == time( NULL ) )
{
return NULL;
}
if( p_sys->b_need_update == VLC_FALSE )
{
return NULL;
}
p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL;
p_spu->b_absolute = p_sys->b_absolute;
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = 0;
fmt.i_y_offset = 0;
p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt );
if( !p_spu->p_region )
{
p_filter->