From deba9f3d2bc171d1b987162a30a62cf06af45126 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 9 Oct 2010 01:31:52 +0000 Subject: [PATCH] aspect.c: use fallback if screen dimensions are not known Add fallback values to aspect_save_screenres to avoid division by 0 if screen dimensions are not known. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32452 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix handling of invalid values in aspect_save_screenres to not overwrite valid values. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32481 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/aspect.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libvo/aspect.c b/libvo/aspect.c index 7b0919748e..dfe1041660 100644 --- a/libvo/aspect.c +++ b/libvo/aspect.c @@ -57,6 +57,12 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh) printf("aspect_save_screenres %dx%d \n",scrw,scrh); #endif struct MPOpts *opts = vo->opts; + if (scrw <= 0 && scrh <= 0) + scrw = 1024; + if (scrh <= 0) + scrh = (scrw * 3 + 3) / 4; + if (scrw <= 0) + scrw = (scrh * 4 + 2) / 3; vo->aspdat.scrw = scrw; vo->aspdat.scrh = scrh; if (opts->force_monitor_aspect)