Commit 32ab2ef5 authored by hartman's avatar hartman

* Scale SSA subs if necessarry.

* Scale width if only original height is known.
parent 06cc669a
......@@ -376,6 +376,8 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
p_spu->i_stop = p_block->i_pts + p_block->i_length;
p_spu->b_ephemer = (p_block->i_length == 0);
p_spu->b_absolute = VLC_FALSE;
p_spu->i_original_picture_width = p_sys->i_original_width;
p_spu->i_original_picture_height = p_sys->i_original_height;
if( psz_subtitle ) free( psz_subtitle );
}
return p_spu;
......@@ -559,9 +561,9 @@ static void ParseSSAHeader( decoder_t *p_dec )
if( psz_parser[0] == '!' || psz_parser[0] == ';' ) /* comment */;
else if( sscanf( psz_parser, "PlayResX: %d", &temp ) == 1 )
p_sys->i_original_width = temp;
p_sys->i_original_width = ( temp > 0 ) ? temp : -1;
else if( sscanf( psz_parser, "PlayResY: %d", &temp ) == 1 )
p_sys->i_original_height = temp;
p_sys->i_original_height = ( temp > 0 ) ? temp : -1;
else if( sscanf( psz_parser, "Script Type: %8192s", buffer_text ) == 1 )
{
if( !strcasecmp( buffer_text, "V4.00+" ) ) p_sys->b_ass = VLC_TRUE;
......
......@@ -527,14 +527,20 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
i_scale_width = i_scale_width_orig;
i_scale_height = i_scale_height_orig;
if( p_subpic->i_original_picture_width &&
p_subpic->i_original_picture_height )
if( p_subpic->i_original_picture_height > 0 &&
p_subpic->i_original_picture_width > 0 )
{
i_scale_width = i_scale_width * p_fmt->i_width /
p_subpic->i_original_picture_width;
i_scale_height = i_scale_height * p_fmt->i_height /
p_subpic->i_original_picture_height;
}
else if( p_subpic->i_original_picture_height > 0 )
{
i_scale_height = i_scale_height * p_fmt->i_height /
p_subpic->i_original_picture_height;
i_scale_width = i_scale_height * i_scale_height / p_fmt->i_height;
}
/* Set default subpicture aspect ratio */
if( p_region && p_region->fmt.i_aspect &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment