mirror of https://github.com/mpv-player/mpv
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:
parent
8b271d49ec
commit
deba9f3d2b
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue