static subpicture_t *ParseText ( decoder_t *, block_t * );
static void ParseUSFHeader( decoder_t * );
-static subpicture_region_t *ParseUSFString( decoder_t *, char *, subpicture_t * );
-static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, subpicture_t *p_spu, const char *psz_filename, int i_transparent_color );
+static subpicture_region_t *ParseUSFString( decoder_t *, char * );
+static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, const char *psz_filename, int i_transparent_color );
/*****************************************************************************
* Module descriptor.
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
- if( p_dec->fmt_in.i_codec != VLC_FOURCC('u','s','f',' ') )
+ if( p_dec->fmt_in.i_codec != VLC_CODEC_USF )
return VLC_EGENERIC;
/* Allocate the memory needed to store the decoder's structure */
char *psz_subtitle = NULL;
/* We cannot display a subpicture with no date */
- if( p_block->i_pts == 0 )
+ if( p_block->i_pts <= VLC_TS_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return NULL;
}
/* Create the subpicture unit */
- p_spu = decoder_NewSubpicture( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec, NULL );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
}
/* Decode USF strings */
- p_spu->p_region = ParseUSFString( p_dec, psz_subtitle, p_spu );
+ p_spu->p_region = ParseUSFString( p_dec, psz_subtitle );
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
}
static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
- subpicture_t *p_spu,
char *psz_subtitle,
int i_len,
int i_sys_align )
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
- fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_text_region = subpicture_region_New( &fmt );
static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
- char *psz_subtitle,
- subpicture_t *p_spu_in )
+ char *psz_subtitle )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- subpicture_t *p_spu = p_spu_in;
subpicture_region_t *p_region_first = NULL;
subpicture_region_t *p_region_upto = p_region_first;
psz_end += strcspn( psz_end, ">" ) + 1;
p_text_region = CreateTextRegion( p_dec,
- p_spu,
psz_subtitle,
psz_end - psz_subtitle,
p_sys->i_align );
psz_end += strcspn( psz_end, ">" ) + 1;
p_text_region = CreateTextRegion( p_dec,
- p_spu,
psz_subtitle,
psz_end - psz_subtitle,
p_sys->i_align );
char *psz_filename = strndup( &psz_content[1], psz_end - &psz_content[1] );
if( psz_filename )
{
- p_image_region = LoadEmbeddedImage( p_dec, p_spu,
+ p_image_region = LoadEmbeddedImage( p_dec,
psz_filename, i_transparent );
free( psz_filename );
}
psz_subtitle++;
}
*psz_text = '\0';
- psz_text_start = realloc( psz_text_start, strlen( psz_text_start ) + 1 );
+
+ char *psz = realloc( psz_text_start, strlen( psz_text_start ) + 1 );
+ if( psz ) psz_text_start = psz;
return psz_text_start;
}
* download and resize image located at psz_url
***************************************************************************/
static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
- subpicture_t *p_spu,
const char *psz_filename,
int i_transparent_color )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_region_t *p_region;
video_format_t fmt_out;
- int k;
picture_t *p_pic = NULL;
- for( k = 0; k < p_sys->i_images; k++ )
+ for( int k = 0; k < p_sys->i_images; k++ )
{
if( p_sys->pp_images &&
!strcmp( p_sys->pp_images[k]->psz_filename, psz_filename ) )
memset( &fmt_out, 0, sizeof( video_format_t));
fmt_out.i_chroma = VLC_CODEC_YUVA;
- fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
fmt_out.i_width =
fmt_out.i_visible_width = p_pic->format.i_visible_width;