Adjust custom video mode format (old format is also supported).

This commit is contained in:
sorgelig
2018-05-02 22:03:47 +08:00
parent d787d68877
commit a7d7960c0e
2 changed files with 9 additions and 3 deletions

View File

@@ -29,8 +29,8 @@ dvi_mode=0 ; set to 1 for DVI mode. Audio won't be transmitted throu
;10 - 1366x768@60
;11 - 1024x600@60
;
; custom mode: 1,hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix
; 1,1280,110,40,220,720,5,5,20,74.25
; custom mode: hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix_in_KHz
; video_mode=1280,110,40,220,720,5,5,20,74250
video_mode=0
; set to 1-10 (seconds) to display video info on startup/change

View File

@@ -2123,13 +2123,14 @@ static int parse_custom_video_mode()
{
char *vcfg = cfg.video_conf;
int khz = 0;
int cnt = 0;
while (*vcfg)
{
char *next;
if (cnt == 9 && vitems[0] == 1)
{
double Fpix = strtod(vcfg, &next);
double Fpix = khz ? strtoul(vcfg, &next, 0)/1000.f : strtod(vcfg, &next);
if (vcfg == next || (Fpix < 20.f || Fpix > 200.f))
{
printf("Error parsing video_mode parameter: ""%s""\n", cfg.video_conf);
@@ -2147,6 +2148,11 @@ static int parse_custom_video_mode()
return 0;
}
if (!cnt && val >= 100)
{
vitems[cnt++] = 1;
khz = 1;
}
if (cnt < 32) vitems[cnt] = val;
if (*next == ',') next++;
vcfg = next;