changeset 36264:bf9a9e07377a

Calculate aspect ratio by ourselves. sh_video->aspect is a prescaled value that is useless in case there is more than one video to be played and the aspect ratio of a previous one has been changed.
author ib
date Sat, 13 Jul 2013 21:24:03 +0000
parents ea4c4dbae852
children cb8ef00df29f
files gui/interface.c gui/interface.h gui/ui/actions.c gui/win32/gui.c gui/win32/interface.c
diffstat 5 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Sat Jul 13 19:48:12 2013 +0000
+++ b/gui/interface.c	Sat Jul 13 21:24:03 2013 +0000
@@ -640,7 +640,6 @@
         /* video */
 
         guiInfo.sh_video    = data;
-        guiInfo.VideoAspect = 0;
 
         nfree(guiInfo.CodecName);
 
--- a/gui/interface.h	Sat Jul 13 19:48:12 2013 +0000
+++ b/gui/interface.h	Sat Jul 13 21:24:03 2013 +0000
@@ -104,7 +104,6 @@
     int VideoWindow;
     int VideoWidth;
     int VideoHeight;
-    float VideoAspect;
 
     char *CodecName;
 
--- a/gui/ui/actions.c	Sat Jul 13 19:48:12 2013 +0000
+++ b/gui/ui/actions.c	Sat Jul 13 21:24:03 2013 +0000
@@ -425,9 +425,6 @@
 
     case evSetAspect:
 
-        if (guiInfo.VideoAspect == 0)
-            guiInfo.VideoAspect = guiInfo.sh_video->aspect;
-
         switch (iparam) {
         case 2:
             aspect = 16.0f / 9.0f;
@@ -443,7 +440,7 @@
 
         case 1:
         default:
-            aspect = guiInfo.VideoAspect;
+            aspect = (float)guiInfo.sh_video->disp_w / guiInfo.sh_video->disp_h;
         }
 
         snprintf(cmd, sizeof(cmd), "switch_ratio %f", aspect);
--- a/gui/win32/gui.c	Sat Jul 13 19:48:12 2013 +0000
+++ b/gui/win32/gui.c	Sat Jul 13 21:24:03 2013 +0000
@@ -473,7 +473,6 @@
                 case ID_ASPECT2:
                 case ID_ASPECT3:
                 case ID_ASPECT4:
-                    if (guiInfo.VideoAspect == 0) guiInfo.VideoAspect = guiInfo.sh_video->aspect;
                     switch (LOWORD(wParam))
                     {
                         case ID_ASPECT1:
@@ -486,7 +485,7 @@
                             aspect = 2.35;
                             break;
                         default:
-                            aspect = guiInfo.VideoAspect;
+                            aspect = (float) guiInfo.sh_video->disp_w / guiInfo.sh_video->disp_h;
                             break;
                     }
                     snprintf(cmd, sizeof(cmd), "switch_ratio %f", aspect);
--- a/gui/win32/interface.c	Sat Jul 13 19:48:12 2013 +0000
+++ b/gui/win32/interface.c	Sat Jul 13 21:24:03 2013 +0000
@@ -628,7 +628,6 @@
         case GUI_SET_VIDEO:
         {
             guiInfo.sh_video = data;
-            guiInfo.VideoAspect = 0;
             if (data)
             {
                 sh_video_t *sh = data;