--- src/video_output/vout_subpictures.c	Thu Aug 16 18:24:57 2007
+++ src/video_output/vout_subpictures.c	Thu Aug 16 18:25:34 2007
@@ -601,19 +601,41 @@
             }
             if( p_text_region && ((p_text_region->i_align & REGION_RENDERED) == 0) )
             {
-                p_spu->p_text->fmt_out.video.i_width =
-                    p_spu->p_text->fmt_out.video.i_visible_width =
-                    p_fmt->i_width;
-                p_spu->p_text->fmt_out.video.i_height =
-                    p_spu->p_text->fmt_out.video.i_visible_height =
-                    p_fmt->i_height;
+                if( (p_subpic->i_original_picture_height > 0) &&
+                    (p_subpic->i_original_picture_width  > 0) )
+                {
+                    p_spu->p_text->fmt_out.video.i_width =
+                        p_spu->p_text->fmt_out.video.i_visible_width =
+                        p_subpic->i_original_picture_width;
+                    p_spu->p_text->fmt_out.video.i_height =
+                        p_spu->p_text->fmt_out.video.i_visible_height =
+                        p_subpic->i_original_picture_height;
+                }
+                else
+                {
+                    p_spu->p_text->fmt_out.video.i_width =
+                        p_spu->p_text->fmt_out.video.i_visible_width =
+                        p_fmt->i_width;
+                    p_spu->p_text->fmt_out.video.i_height =
+                        p_spu->p_text->fmt_out.video.i_visible_height =
+                        p_fmt->i_height;
+                }
             }
         }
 
         pi_scale_width[ SCALE_DEFAULT ]  = i_scale_width_orig;
         pi_scale_height[ SCALE_DEFAULT ] = i_scale_height_orig;
-        pi_scale_width[ SCALE_TEXT ]     = p_fmt->i_width  * 1000 / p_spu->p_text->fmt_out.video.i_width;
-        pi_scale_height[ SCALE_TEXT ]    = p_fmt->i_height * 1000 / p_spu->p_text->fmt_out.video.i_height;
+        if( (p_subpic->i_original_picture_height > 0) &&
+            (p_subpic->i_original_picture_width  > 0) )
+        {
+            pi_scale_width[ SCALE_TEXT ]     = p_subpic->i_original_picture_width  * 1000 / p_spu->p_text->fmt_out.video.i_width;
+            pi_scale_height[ SCALE_TEXT ]    = p_subpic->i_original_picture_height * 1000 / p_spu->p_text->fmt_out.video.i_height;
+        }
+        else
+        {
+            pi_scale_width[ SCALE_TEXT ]     = p_fmt->i_width  * 1000 / p_spu->p_text->fmt_out.video.i_width;
+            pi_scale_height[ SCALE_TEXT ]    = p_fmt->i_height * 1000 / p_spu->p_text->fmt_out.video.i_height;
+        }
 
         for( k=0; k< SCALE_SIZE ; k++ )
         {
