]> git.sesse.net Git - vlc/commitdiff
* Scale SSA subs if necessarry.
authorDerk-Jan Hartman <hartman@videolan.org>
Wed, 22 Feb 2006 16:17:24 +0000 (16:17 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Wed, 22 Feb 2006 16:17:24 +0000 (16:17 +0000)
* Scale width if only original height is known.

modules/codec/subsdec.c
src/video_output/vout_subpictures.c

index 0b131b7ea93cd5e9c1156bf8bde61024119c7996..343c65d2b318e482f8695942eb89ab731968e79f 100644 (file)
@@ -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;
index a79c44aa44c117ca9450999189bf2dab60e15d51..5cb8cf8fcd89321c1f8187bb83dbee8671156e55 100644 (file)
@@ -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 &&