#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
#include <vlc_vout.h>
#include <vlc_osd.h>
#include <vlc_block.h>
#include <vlc_filter.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <glib-object.h> /* g_object_unref( ) */
-#include <librsvg-2/librsvg/rsvg.h>
+#include <librsvg/rsvg.h>
typedef struct svg_rendition_t svg_rendition_t;
char *psz_template;
FILE *file;
- psz_filename = config_GetPsz( p_filter, "svg-template-file" );
+ psz_filename = var_InheritString( p_filter, "svg-template-file" );
if( !psz_filename || (psz_filename[0] == 0) )
{
/* No filename. Use a default value. */
else
{
/* Read the template */
- file = utf8_fopen( psz_filename, "rt" );
+ file = vlc_fopen( psz_filename, "rt" );
if( !file )
{
msg_Warn( p_this, "SVG template file %s does not exist.",
msg_Dbg( p_this, "reading %ld bytes from template %s",
(unsigned long)s.st_size, psz_filename );
- psz_template = malloc( s.st_size + 42 );
+ psz_template = calloc( 1, s.st_size + 42 );
if( !psz_template )
{
fclose( file );
free( psz_filename );
return NULL;
}
- memset( psz_template, 0, s.st_size + 1 );
if(! fread( psz_template, s.st_size, 1, file ) )
{
msg_Dbg( p_this, "No data read from template." );
/* Create a new subpicture region */
memset( &fmt, 0, sizeof( video_format_t ) );
fmt.i_chroma = VLC_CODEC_YUVA;
- fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_width = fmt.i_visible_width = i_width;
fmt.i_height = fmt.i_visible_height = i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_sar_num = 1;
+ fmt.i_sar_den = 1;
- p_region->p_picture = picture_New( fmt.i_chroma, fmt.i_width, fmt.i_height, fmt.i_aspect );
+ p_region->p_picture = picture_NewFromFormat( &fmt );
if( !p_region->p_picture )
return VLC_EGENERIC;
p_region->fmt = fmt;
if( !p_handle )
{
- msg_Err( p_filter, "Error creating SVG reader: %s", error->message );
+ msg_Err( p_filter, "Error creating SVG reader" );
return;
}
int length;
char* psz_template = p_sys->psz_template;
length = strlen( psz_string ) + strlen( psz_template ) + 42;
- p_svg->psz_text = malloc( length + 1 );
+ p_svg->psz_text = calloc( 1, length + 1 );
if( !p_svg->psz_text )
{
free( p_svg );
return VLC_ENOMEM;
}
- memset( p_svg->psz_text, 0, length + 1 );
snprintf( p_svg->psz_text, length, psz_template, psz_string );
}
p_svg->i_width = p_sys->i_width;