| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
#ifdef HAVE_CONFIG_H |
|---|
| 29 |
# include "config.h" |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
#include <vlc_common.h> |
|---|
| 33 |
#include <vlc_plugin.h> |
|---|
| 34 |
#include <vlc_charset.h> |
|---|
| 35 |
#include <vlc_vout.h> |
|---|
| 36 |
#include <vlc_osd.h> |
|---|
| 37 |
#include <vlc_block.h> |
|---|
| 38 |
#include <vlc_filter.h> |
|---|
| 39 |
|
|---|
| 40 |
#ifdef HAVE_SYS_TYPES_H |
|---|
| 41 |
# include <sys/types.h> |
|---|
| 42 |
#endif |
|---|
| 43 |
|
|---|
| 44 |
#ifdef HAVE_UNISTD_H |
|---|
| 45 |
# include <unistd.h> |
|---|
| 46 |
#elif defined( WIN32 ) && !defined( UNDER_CE ) |
|---|
| 47 |
# include <io.h> |
|---|
| 48 |
#endif |
|---|
| 49 |
|
|---|
| 50 |
#include <glib.h> |
|---|
| 51 |
#include <glib/gstdio.h> |
|---|
| 52 |
#include <glib-object.h> |
|---|
| 53 |
#include <librsvg-2/librsvg/rsvg.h> |
|---|
| 54 |
|
|---|
| 55 |
typedef struct svg_rendition_t svg_rendition_t; |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
static int Create ( vlc_object_t * ); |
|---|
| 61 |
static void Destroy ( vlc_object_t * ); |
|---|
| 62 |
static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, |
|---|
| 63 |
subpicture_region_t *p_region_in ); |
|---|
| 64 |
static char *svg_GetTemplate( vlc_object_t *p_this ); |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
#define TEMPLATE_TEXT N_( "SVG template file" ) |
|---|
| 71 |
#define TEMPLATE_LONGTEXT N_( "Location of a file holding a SVG template "\ |
|---|
| 72 |
"for automatic string conversion" ) |
|---|
| 73 |
|
|---|
| 74 |
vlc_module_begin(); |
|---|
| 75 |
set_category( CAT_INPUT); |
|---|
| 76 |
set_category( SUBCAT_INPUT_SCODEC ); |
|---|
| 77 |
set_capability( "text renderer", 99 ); |
|---|
| 78 |
add_shortcut( "svg" ); |
|---|
| 79 |
add_string( "svg-template-file", "", NULL, TEMPLATE_TEXT, TEMPLATE_LONGTEXT, true ); |
|---|
| 80 |
set_callbacks( Create, Destroy ); |
|---|
| 81 |
vlc_module_end(); |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
struct svg_rendition_t |
|---|
| 87 |
{ |
|---|
| 88 |
int i_width; |
|---|
| 89 |
int i_height; |
|---|
| 90 |
int i_chroma; |
|---|
| 91 |
|
|---|
| 92 |
char *psz_text; |
|---|
| 93 |
|
|---|
| 94 |
GdkPixbuf *p_rendition; |
|---|
| 95 |
}; |
|---|
| 96 |
|
|---|
| 97 |
static int Render( filter_t *, subpicture_region_t *, svg_rendition_t *, int, int); |
|---|
| 98 |
static char *svg_GetTemplate (); |
|---|
| 99 |
static void svg_set_size( filter_t *p_filter, int width, int height ); |
|---|
| 100 |
static void svg_SizeCallback ( int *width, int *height, gpointer data ); |
|---|
| 101 |
static void svg_RenderPicture ( filter_t *p_filter, |
|---|
| 102 |
svg_rendition_t *p_svg ); |
|---|
| 103 |
static void FreeString( svg_rendition_t * ); |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
struct filter_sys_t |
|---|
| 112 |
{ |
|---|
| 113 |
|
|---|
| 114 |
char *psz_template; |
|---|
| 115 |
|
|---|
| 116 |
int i_width; |
|---|
| 117 |
int i_height; |
|---|
| 118 |
vlc_mutex_t *lock; |
|---|
| 119 |
}; |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
static int Create( vlc_object_t *p_this ) |
|---|
| 127 |
{ |
|---|
| 128 |
filter_t *p_filter = ( filter_t * )p_this; |
|---|
| 129 |
filter_sys_t *p_sys; |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
p_sys = malloc( sizeof( filter_sys_t ) ); |
|---|
| 133 |
if( !p_sys ) |
|---|
| 134 |
return VLC_ENOMEM; |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
p_sys->psz_template = svg_GetTemplate( p_this ); |
|---|
| 138 |
if( !p_sys->psz_template ) |
|---|
| 139 |
{ |
|---|
| 140 |
free( p_sys ); |
|---|
| 141 |
return VLC_ENOMEM; |
|---|
| 142 |
} |
|---|
| 143 |
|
|---|
| 144 |
p_sys->i_width = p_filter->fmt_out.video.i_width; |
|---|
| 145 |
p_sys->i_height = p_filter->fmt_out.video.i_height; |
|---|
| 146 |
|
|---|
| 147 |
p_filter->pf_render_text = RenderText; |
|---|
| 148 |
p_filter->pf_render_html = NULL; |
|---|
| 149 |
p_filter->p_sys = p_sys; |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
rsvg_init( ); |
|---|
| 153 |
|
|---|
| 154 |
return VLC_SUCCESS; |
|---|
| 155 |
} |
|---|
| 156 |
|
|---|
| 157 |
static char *svg_GetTemplate( vlc_object_t *p_this ) |
|---|
| 158 |
{ |
|---|
| 159 |
filter_t *p_filter = ( filter_t * )p_this; |
|---|
| 160 |
char *psz_filename; |
|---|
| 161 |
char *psz_template; |
|---|
| 162 |
FILE *file; |
|---|
| 163 |
|
|---|
| 164 |
psz_filename = config_GetPsz( p_filter, "svg-template-file" ); |
|---|
| 165 |
if( !psz_filename || (psz_filename[0] == 0) ) |
|---|
| 166 |
{ |
|---|
| 167 |
|
|---|
| 168 |
psz_template = NULL; |
|---|
| 169 |
} |
|---|
| 170 |
else |
|---|
| 171 |
{ |
|---|
| 172 |
|
|---|
| 173 |
file = utf8_fopen( psz_filename, "rt" ); |
|---|
| 174 |
if( !file ) |
|---|
| 175 |
{ |
|---|
| 176 |
msg_Warn( p_this, "SVG template file %s does not exist.", |
|---|
| 177 |
psz_filename ); |
|---|
| 178 |
psz_template = NULL; |
|---|
| 179 |
} |
|---|
| 180 |
else |
|---|
| 181 |
{ |
|---|
| 182 |
struct stat s; |
|---|
| 183 |
|
|---|
| 184 |
if( fstat( fileno( file ), &s ) ) |
|---|
| 185 |
{ |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
psz_template = NULL; |
|---|
| 189 |
} |
|---|
| 190 |
else |
|---|
| 191 |
if( ((signed)s.st_size) < 0 ) |
|---|
| 192 |
{ |
|---|
| 193 |
msg_Err( p_this, "SVG template too big" ); |
|---|
| 194 |
psz_template = NULL; |
|---|
| 195 |
} |
|---|
| 196 |
else |
|---|
| 197 |
{ |
|---|
| 198 |
msg_Dbg( p_this, "reading %ld bytes from template %s", |
|---|
| 199 |
(unsigned long)s.st_size, psz_filename ); |
|---|
| 200 |
|
|---|
| 201 |
psz_template = malloc( ( s.st_size + 42 ) * sizeof( char ) ); |
|---|
| 202 |
if( !psz_template ) |
|---|
| 203 |
{ |
|---|
| 204 |
fclose( file ); |
|---|
| 205 |
free( psz_filename ); |
|---|
| 206 |
return NULL; |
|---|
| 207 |
} |
|---|
| 208 |
memset( psz_template, 0, s.st_size + 1 ); |
|---|
| 209 |
if(! fread( psz_template, s.st_size, 1, file ) ) |
|---|
| 210 |
{ |
|---|
| 211 |
msg_Dbg( p_this, "No data read from template." ); |
|---|
| 212 |
} |
|---|
| 213 |
} |
|---|
| 214 |
fclose( file ); |
|---|
| 215 |
} |
|---|
| 216 |
} |
|---|
| 217 |
free( psz_filename ); |
|---|
| 218 |
if( !psz_template ) |
|---|
| 219 |
{ |
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 |
psz_template = strdup( "<?xml version='1.0' encoding='UTF-8' standalone='no'?> \ |
|---|
| 223 |
<svg version='1' preserveAspectRatio='xMinYMin meet' viewBox='0 0 800 600'> \ |
|---|
| 224 |
<text x='10' y='560' fill='white' font-size='32' \ |
|---|
| 225 |
font-family='sans-serif'>%s</text></svg>" ); |
|---|
| 226 |
} |
|---|
| 227 |
|
|---|
| 228 |
return psz_template; |
|---|
| 229 |
} |
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
static void Destroy( vlc_object_t *p_this ) |
|---|
| 237 |
{ |
|---|
| 238 |
filter_t *p_filter = ( filter_t * )p_this; |
|---|
| 239 |
filter_sys_t *p_sys = p_filter->p_sys; |
|---|
| 240 |
|
|---|
| 241 |
free( p_sys->psz_template ); |
|---|
| 242 |
free( p_sys ); |
|---|
| 243 |
rsvg_term( ); |
|---|
| 244 |
} |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
static int Render( filter_t *p_filter, subpicture_region_t *p_region, |
|---|
| 250 |
svg_rendition_t *p_svg, int i_width, int i_height ) |
|---|
| 251 |
{ |
|---|
| 252 |
video_format_t fmt; |
|---|
| 253 |
uint8_t *p_y, *p_u, *p_v, *p_a; |
|---|
| 254 |
int x, y, i_pitch, i_u_pitch; |
|---|
| 255 |
guchar *pixels_in = NULL; |
|---|
| 256 |
int rowstride_in; |
|---|
| 257 |
int channels_in; |
|---|
| 258 |
int alpha; |
|---|
| 259 |
picture_t *p_pic; |
|---|
| 260 |
|
|---|
| 261 |
if ( p_filter->p_sys->i_width != i_width || |
|---|
| 262 |
p_filter->p_sys->i_height != i_height ) |
|---|
| 263 |
{ |
|---|
| 264 |
svg_set_size( p_filter, i_width, i_height ); |
|---|
| 265 |
p_svg->p_rendition = NULL; |
|---|
| 266 |
} |
|---|
| 267 |
|
|---|
| 268 |
if( p_svg->p_rendition == NULL ) { |
|---|
| 269 |
svg_RenderPicture( p_filter, p_svg ); |
|---|
| 270 |
if( ! p_svg->p_rendition ) |
|---|
| 271 |
{ |
|---|
| 272 |
msg_Err( p_filter, "Cannot render SVG" ); |
|---|
| 273 |
return VLC_EGENERIC; |
|---|
| 274 |
} |
|---|
| 275 |
} |
|---|
| 276 |
i_width = gdk_pixbuf_get_width( p_svg->p_rendition ); |
|---|
| 277 |
i_height = gdk_pixbuf_get_height( p_svg->p_rendition ); |
|---|
| 278 |
|
|---|
| 279 |
|
|---|
| 280 |
memset( &fmt, 0, sizeof( video_format_t ) ); |
|---|
| 281 |
fmt.i_chroma = VLC_FOURCC( 'Y','U','V','A' ); |
|---|
| 282 |
fmt.i_aspect = VOUT_ASPECT_FACTOR; |
|---|
| 283 |
fmt.i_width = fmt.i_visible_width = i_width; |
|---|
| 284 |
fmt.i_height = fmt.i_visible_height = i_height; |
|---|
| 285 |
fmt.i_x_offset = fmt.i_y_offset = 0; |
|---|
| 286 |
|
|---|
| 287 |
p_region->p_picture = picture_New( fmt.i_chroma, fmt.i_width, fmt.i_height, fmt.i_aspect ); |
|---|
| 288 |
if( !p_region->p_picture ) |
|---|
| 289 |
return VLC_EGENERIC; |
|---|
| 290 |
p_region->fmt = fmt; |
|---|
| 291 |
|
|---|
| 292 |
p_region->i_x = p_region->i_y = 0; |
|---|
| 293 |
p_y = p_region->p_picture->Y_PIXELS; |
|---|
| 294 |
p_u = p_region->p_picture->U_PIXELS; |
|---|
| 295 |
p_v = p_region->p_picture->V_PIXELS; |
|---|
| 296 |
p_a = p_region->p_picture->A_PIXELS; |
|---|
| 297 |
|
|---|
| 298 |
i_pitch = p_region->p_picture->Y_PITCH; |
|---|
| 299 |
i_u_pitch = p_region->p_picture->U_PITCH; |
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
memset( p_y, 0x00, i_pitch * p_region->fmt.i_height ); |
|---|
| 303 |
memset( p_u, 0x80, i_u_pitch * p_region->fmt.i_height ); |
|---|
| 304 |
memset( p_v, 0x80, i_u_pitch * p_region->fmt.i_height ); |
|---|
| 305 |
|
|---|
| 306 |
p_pic = p_region->p_picture; |
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
pixels_in = gdk_pixbuf_get_pixels( p_svg->p_rendition ); |
|---|
| 329 |
rowstride_in = gdk_pixbuf_get_rowstride( p_svg->p_rendition ); |
|---|
| 330 |
channels_in = gdk_pixbuf_get_n_channels( p_svg->p_rendition ); |
|---|
| 331 |
alpha = gdk_pixbuf_get_has_alpha( p_svg->p_rendition ); |
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 |
#define INDEX_IN( x, y ) ( y * rowstride_in + x * channels_in ) |
|---|
| 342 |
#define INDEX_OUT( x, y ) ( y * i_pitch + x * p_pic->p[Y_PLANE].i_pixel_pitch ) |
|---|
| 343 |
|
|---|
| 344 |
for( y = 0; y < i_height; y++ ) |
|---|
| 345 |
{ |
|---|
| 346 |
for( x = 0; x < i_width; x++ ) |
|---|
| 347 |
{ |
|---|
| 348 |
guchar *p_in; |
|---|
| 349 |
int i_out; |
|---|
| 350 |
|
|---|
| 351 |
p_in = &pixels_in[INDEX_IN( x, y )]; |
|---|
| 352 |
|
|---|
| 353 |
#define R( pixel ) *pixel |
|---|
| 354 |
#define G( pixel ) *( pixel+1 ) |
|---|
| 355 |
#define B( pixel ) *( pixel+2 ) |
|---|
| 356 |
#define ALPHA( pixel ) *( pixel+3 ) |
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
if ( alpha ) { |
|---|
| 364 |
i_out = INDEX_OUT( x, y ); |
|---|
| 365 |
|
|---|
| 366 |
p_pic->Y_PIXELS[i_out] = .299 * R( p_in ) + .587 * G( p_in ) + .114 * B( p_in ); |
|---|
| 367 |
|
|---|
| 368 |
p_pic->U_PIXELS[i_out] = -.1687 * R( p_in ) - .3313 * G( p_in ) + .5 * B( p_in ) + 128; |
|---|
| 369 |
p_pic->V_PIXELS[i_out] = .5 * R( p_in ) - .4187 * G( p_in ) - .0813 * B( p_in ) + 128; |
|---|
| 370 |
|
|---|
| 371 |
p_pic->A_PIXELS[i_out] = ALPHA( p_in ); |
|---|
| 372 |
} |
|---|
| 373 |
} |
|---|
| 374 |
} |
|---|
| 375 |
|
|---|
| 376 |
return VLC_SUCCESS; |
|---|
| 377 |
} |
|---|
| 378 |
|
|---|
| 379 |
static void svg_set_size( filter_t *p_filter, int width, int height ) |
|---|
| 380 |
{ |
|---|
| 381 |
p_filter->p_sys->i_width = width; |
|---|
| 382 |
p_filter->p_sys->i_height = height; |
|---|
| 383 |
} |
|---|
| 384 |
|
|---|
| 385 |
static void svg_SizeCallback( int *width, int *height, gpointer data ) |
|---|
| 386 |
{ |
|---|
| 387 |
filter_t *p_filter = data; |
|---|
| 388 |
|
|---|
| 389 |
*width = p_filter->p_sys->i_width; |
|---|
| 390 |
*height = p_filter->p_sys->i_height; |
|---|
| 391 |
return; |
|---|
| 392 |
} |
|---|
| 393 |
|
|---|
| 394 |
static void svg_RenderPicture( filter_t *p_filter, |
|---|
| 395 |
svg_rendition_t *p_svg ) |
|---|
| 396 |
{ |
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
RsvgHandle *p_handle; |
|---|
| 400 |
GError *error = NULL; |
|---|
| 401 |
|
|---|
| 402 |
p_svg->p_rendition = NULL; |
|---|
| 403 |
|
|---|
| 404 |
p_handle = rsvg_handle_new(); |
|---|
| 405 |
|
|---|
| 406 |
if( !p_handle ) |
|---|
| 407 |
{ |
|---|
| 408 |
msg_Err( p_filter, "Error creating SVG reader: %s", error->message ); |
|---|
| 409 |
return; |
|---|
| 410 |
} |
|---|
| 411 |
|
|---|
| 412 |
rsvg_handle_set_size_callback( p_handle, svg_SizeCallback, p_filter, NULL ); |
|---|
| 413 |
|
|---|
| 414 |
if( ! rsvg_handle_write( p_handle, |
|---|
| 415 |
( guchar* )p_svg->psz_text, strlen( p_svg->psz_text ), |
|---|
| 416 |
&error ) ) |
|---|
| 417 |
{ |
|---|
| 418 |
msg_Err( p_filter, "error while rendering SVG: %s\n", error->message ); |
|---|
| 419 |
g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| 420 |
return; |
|---|
| 421 |
} |
|---|
| 422 |
|
|---|
| 423 |
if( ! rsvg_handle_close( p_handle, &error ) ) |
|---|
| 424 |
{ |
|---|
| 425 |
msg_Err( p_filter, "error while rendering SVG (close): %s\n", error->message ); |
|---|
| 426 |
g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| 427 |
return; |
|---|
| 428 |
} |
|---|
| 429 |
|
|---|
| 430 |
p_svg->p_rendition = rsvg_handle_get_pixbuf( p_handle ); |
|---|
| 431 |
|
|---|
| 432 |
g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| 433 |
} |
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, |
|---|
| 437 |
subpicture_region_t *p_region_in ) |
|---|
| 438 |
{ |
|---|
| 439 |
filter_sys_t *p_sys = p_filter->p_sys; |
|---|
| 440 |
svg_rendition_t *p_svg = NULL; |
|---|
| 441 |
char *psz_string; |
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
if( !p_region_in || !p_region_out ) return VLC_EGENERIC; |
|---|
| 445 |
psz_string = p_region_in->psz_text; |
|---|
| 446 |
if( !psz_string || !*psz_string ) return VLC_EGENERIC; |
|---|
| 447 |
|
|---|
| 448 |
p_svg = ( svg_rendition_t * )malloc( sizeof( svg_rendition_t ) ); |
|---|
| 449 |
if( !p_svg ) |
|---|
| 450 |
return VLC_ENOMEM; |
|---|
| 451 |
|
|---|
| 452 |
p_region_out->i_x = p_region_in->i_x; |
|---|
| 453 |
p_region_out->i_y = p_region_in->i_y; |
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
if( strstr( psz_string, "<svg" )) |
|---|
| 458 |
{ |
|---|
| 459 |
|
|---|
| 460 |
p_svg->psz_text = strdup( psz_string ); |
|---|
| 461 |
if( !p_svg->psz_text ) |
|---|
| 462 |
{ |
|---|
| 463 |
free( p_svg ); |
|---|
| 464 |
return VLC_ENOMEM; |
|---|
| 465 |
} |
|---|
| 466 |
} |
|---|
| 467 |
else |
|---|
| 468 |
{ |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
int length; |
|---|
| 472 |
char* psz_template = p_sys->psz_template; |
|---|
| 473 |
length = strlen( psz_string ) + strlen( psz_template ) + 42; |
|---|
| 474 |
p_svg->psz_text = malloc( ( length + 1 ) * sizeof( char ) ); |
|---|
| 475 |
if( !p_svg->psz_text ) |
|---|
| 476 |
{ |
|---|
| 477 |
free( p_svg ); |
|---|
| 478 |
return VLC_ENOMEM; |
|---|
| 479 |
} |
|---|
| 480 |
memset( p_svg->psz_text, 0, length + 1 ); |
|---|
| 481 |
snprintf( p_svg->psz_text, length, psz_template, psz_string ); |
|---|
| 482 |
} |
|---|
| 483 |
p_svg->i_width = p_sys->i_width; |
|---|
| 484 |
p_svg->i_height = p_sys->i_height; |
|---|
| 485 |
p_svg->i_chroma = VLC_FOURCC( 'Y','U','V','A' ); |
|---|
| 486 |
|
|---|
| 487 |
|
|---|
| 488 |
|
|---|
| 489 |
|
|---|
| 490 |
svg_RenderPicture( p_filter, p_svg ); |
|---|
| 491 |
|
|---|
| 492 |
Render( p_filter, p_region_out, p_svg, p_svg->i_width, p_svg->i_height ); |
|---|
| 493 |
FreeString( p_svg ); |
|---|
| 494 |
|
|---|
| 495 |
return VLC_SUCCESS; |
|---|
| 496 |
} |
|---|
| 497 |
|
|---|
| 498 |
static void FreeString( svg_rendition_t *p_svg ) |
|---|
| 499 |
{ |
|---|
| 500 |
free( p_svg->psz_text ); |
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 |
if( p_svg->p_rendition ) |
|---|
| 504 |
g_object_unref( p_svg->p_rendition ); |
|---|
| 505 |
free( p_svg ); |
|---|
| 506 |
} |
|---|