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
This commit is contained in:
reimar 2010-10-09 01:31:52 +00:00 committed by Uoti Urpala
parent 8b271d49ec
commit deba9f3d2b
1 changed files with 6 additions and 0 deletions

View File

@ -57,6 +57,12 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
printf("aspect_save_screenres %dx%d \n",scrw,scrh); printf("aspect_save_screenres %dx%d \n",scrw,scrh);
#endif #endif
struct MPOpts *opts = vo->opts; 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.scrw = scrw;
vo->aspdat.scrh = scrh; vo->aspdat.scrh = scrh;
if (opts->force_monitor_aspect) if (opts->force_monitor_aspect)