[PATCH] corrects two issues related to autoscale/scalefactor=0A= - On windows, prevents scaling to exceed the container=0A= - original width/height assumption matches other part of vlc=0A=

Joseph Tulou brezhoneg1 at yahoo.fr
Fri Feb 13 13:36:26 CET 2009


---=0A=
 src/video_output/vout_pictures.c |   37 =
++++++++++++++++++++++++++-----------=0A=
 1 files changed, 26 insertions(+), 11 deletions(-)=0A=
=0A=
diff --git a/src/video_output/vout_pictures.c =
b/src/video_output/vout_pictures.c=0A=
index 3275aac..abe696c 100644=0A=
--- a/src/video_output/vout_pictures.c=0A=
+++ b/src/video_output/vout_pictures.c=0A=
@@ -465,25 +465,40 @@ void vout_PlacePicture( const vout_thread_t =
*p_vout,=0A=
     int i_zoom =3D p_vout->i_zoom;=0A=
 =0A=
     /* be realistic, scaling factor confined between .2 and 10. */=0A=
-    if( i_zoom > 10 * ZOOM_FP_FACTOR  || i_zoom <  ZOOM_FP_FACTOR / 5 )=0A=
-        i_zoom =3D ZOOM_FP_FACTOR;=0A=
+    if( i_zoom > 10 * ZOOM_FP_FACTOR )      i_zoom =3D 10 * =
ZOOM_FP_FACTOR;=0A=
+    else if( i_zoom <  ZOOM_FP_FACTOR / 5 ) i_zoom =3D ZOOM_FP_FACTOR / =
5;=0A=
 =0A=
     if( b_autoscale )=0A=
     {=0A=
         *pi_width =3D i_width;=0A=
         *pi_height =3D i_height;=0A=
     }=0A=
-    else if( i_zoom =3D=3D ZOOM_FP_FACTOR )  /* original size */=0A=
-    {=0A=
-        *pi_width =3D __MIN( i_width, p_vout->fmt_in.i_visible_width );=0A=
-        *pi_height =3D __MIN( i_height, p_vout->fmt_in.i_visible_height =
);=0A=
-    }=0A=
     else =0A=
     {=0A=
-        *pi_width =3D =0A=
-             p_vout->fmt_in.i_visible_width * i_zoom / ZOOM_FP_FACTOR;=0A=
-        *pi_height =3D=0A=
-             p_vout->fmt_in.i_visible_height * i_zoom / ZOOM_FP_FACTOR;=0A=
+        unsigned int i_original_width, i_original_height;=0A=
+=0A=
+        if( p_vout->fmt_in.i_sar_num > p_vout->fmt_in.i_sar_den )=0A=
+        {=0A=
+            i_original_width =3D p_vout->fmt_in.i_visible_width *=0A=
+                               p_vout->fmt_in.i_sar_num / =
p_vout->fmt_in.i_sar_den;=0A=
+            i_original_height =3D  p_vout->fmt_in.i_visible_height;=0A=
+        }=0A=
+        else=0A=
+        {=0A=
+            i_original_width =3D  p_vout->fmt_in.i_visible_width;=0A=
+            i_original_height =3D p_vout->fmt_in.i_visible_height *=0A=
+                                p_vout->fmt_in.i_sar_den / =
p_vout->fmt_in.i_sar_num;=0A=
+        }=0A=
+       =0A=
+#ifdef WIN32=0A=
+        /* On windows, inner video window exceeding container leads to =
black screen */=0A=
+        *pi_width =3D __MIN( i_width, i_original_width * i_zoom / =
ZOOM_FP_FACTOR );=0A=
+        *pi_height =3D __MIN( i_height, i_original_height * i_zoom / =
ZOOM_FP_FACTOR );=0A=
+#else=0A=
+        *pi_width =3D i_original_width * i_zoom / ZOOM_FP_FACTOR ;=0A=
+        *pi_height =3D i_original_height * i_zoom / ZOOM_FP_FACTOR ;=0A=
+#endif=0A=
+=0A=
     }=0A=
 =0A=
      int64_t i_scaled_width =3D p_vout->fmt_in.i_visible_width * =
(int64_t)p_vout->fmt_in.i_sar_num *=0A=
-- =0A=
1.5.2.5=0A=
=0A=

------=_NextPart_000_0001_01C98DE6.F017DCE0--




More information about the vlc-devel mailing list