ffplay: make initial window size calculation based on aspect ratio
authorMarton Balint <cus@passwd.hu>
Sat, 1 Sep 2012 13:01:29 +0000 (15:01 +0200)
committerMarton Balint <cus@passwd.hu>
Tue, 11 Sep 2012 20:15:37 +0000 (22:15 +0200)
Fixes ticket #291.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay.c

index a493cbc..45e23c4 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -963,6 +963,7 @@ static int video_open(VideoState *is, int force_set_video_mode)
     int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
     int w,h;
     VideoPicture *vp = &is->pictq[is->pictq_rindex];
+    SDL_Rect rect;
 
     if (is_full_screen) flags |= SDL_FULLSCREEN;
     else                flags |= SDL_RESIZABLE;
@@ -974,8 +975,9 @@ static int video_open(VideoState *is, int force_set_video_mode)
         w = screen_width;
         h = screen_height;
     } else if (vp->width) {
-        w = vp->width;
-        h = vp->height;
+        calculate_display_rect(&rect, 0, 0, INT_MAX, vp->height, vp);
+        w = rect.w;
+        h = rect.h;
     } else {
         w = 640;
         h = 480;