Skip to content

Commit a82df17

Browse files
committed
AmlUtils: drop support of SMPTE
4096x2160 do lead only to black screen.
1 parent 23cbed4 commit a82df17

File tree

1 file changed

+59
-71
lines changed

1 file changed

+59
-71
lines changed

xbmc/utils/AMLUtils.cpp

Lines changed: 59 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ void aml_probe_hdmi_audio()
378378

379379
bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
380380
{
381+
int width = 0, height = 0, rrate = 60;
382+
char smode[2] = { 0 };
383+
381384
if (!res)
382385
return false;
383386

@@ -395,85 +398,70 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res)
395398
if (StringUtils::EndsWith(fromMode, "*"))
396399
fromMode.erase(fromMode.size() - 1);
397400

398-
if (StringUtils::EqualsNoCase(fromMode, "4k2ksmpte") || StringUtils::EqualsNoCase(fromMode, "smpte24hz"))
401+
if (sscanf(fromMode.c_str(), "%dx%dp%dhz", &width, &height, &rrate) == 3)
399402
{
400-
res->iWidth = nativeGui ? 4096 : 1920;
401-
res->iHeight= nativeGui ? 2160 : 1080;
402-
res->iScreenWidth = 4096;
403-
res->iScreenHeight= 2160;
404-
res->fRefreshRate = 24;
405-
res->dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
403+
*smode = 'p';
406404
}
407-
else
405+
else if (sscanf(fromMode.c_str(), "%d%1[ip]%dhz", &height, smode, &rrate) >= 2)
408406
{
409-
int width = 0, height = 0, rrate = 60;
410-
char smode[2] = { 0 };
411-
412-
if (sscanf(fromMode.c_str(), "%dx%dp%dhz", &width, &height, &rrate) == 3)
413-
{
414-
*smode = 'p';
415-
}
416-
else if (sscanf(fromMode.c_str(), "%d%1[ip]%dhz", &height, smode, &rrate) >= 2)
417-
{
418-
switch (height)
419-
{
420-
case 480:
421-
case 576:
422-
width = 720;
423-
break;
424-
case 720:
425-
width = 1280;
426-
break;
427-
case 1080:
428-
width = 1920;
429-
break;
430-
case 2160:
431-
width = 3840;
432-
break;
433-
}
434-
}
435-
else if (sscanf(fromMode.c_str(), "%dcvbs", &height) == 1)
436-
{
437-
width = 720;
438-
*smode = 'i';
439-
rrate = (height == 576) ? 50 : 60;
440-
}
441-
else if (sscanf(fromMode.c_str(), "4k2k%d", &rrate) == 1)
442-
{
443-
width = 3840;
444-
height = 2160;
445-
*smode = 'p';
446-
}
447-
else if (StringUtils::EqualsNoCase(fromMode, "dummy_l"))
448-
{
449-
width = 1920;
450-
height = 1080;
451-
rrate = 60;
452-
*smode = 'p';
453-
}
454-
else
455-
{
456-
return false;
457-
}
458-
459-
res->iWidth = nativeGui ? width : std::min(width, 1920);
460-
res->iHeight= nativeGui ? height : std::min(height, 1080);
461-
res->iScreenWidth = width;
462-
res->iScreenHeight = height;
463-
res->dwFlags = (*smode == 'p') ? D3DPRESENTFLAG_PROGRESSIVE : D3DPRESENTFLAG_INTERLACED;
464-
465-
switch (rrate)
407+
switch (height)
466408
{
467-
case 23:
468-
case 29:
469-
case 59:
470-
res->fRefreshRate = (float)((rrate + 1)/1.001f);
409+
case 480:
410+
case 576:
411+
width = 720;
471412
break;
472-
default:
473-
res->fRefreshRate = (float)rrate;
413+
case 720:
414+
width = 1280;
415+
break;
416+
case 1080:
417+
width = 1920;
418+
break;
419+
case 2160:
420+
width = 3840;
474421
break;
475422
}
476423
}
424+
else if (sscanf(fromMode.c_str(), "%dcvbs", &height) == 1)
425+
{
426+
width = 720;
427+
*smode = 'i';
428+
rrate = (height == 576) ? 50 : 60;
429+
}
430+
else if (sscanf(fromMode.c_str(), "4k2k%d", &rrate) == 1)
431+
{
432+
width = 3840;
433+
height = 2160;
434+
*smode = 'p';
435+
}
436+
else if (StringUtils::EqualsNoCase(fromMode, "dummy_l"))
437+
{
438+
width = 1920;
439+
height = 1080;
440+
rrate = 60;
441+
*smode = 'p';
442+
}
443+
else
444+
{
445+
return false;
446+
}
447+
448+
res->iWidth = nativeGui ? width : std::min(width, 1920);
449+
res->iHeight= nativeGui ? height : std::min(height, 1080);
450+
res->iScreenWidth = width;
451+
res->iScreenHeight = height;
452+
res->dwFlags = (*smode == 'p') ? D3DPRESENTFLAG_PROGRESSIVE : D3DPRESENTFLAG_INTERLACED;
453+
454+
switch (rrate)
455+
{
456+
case 23:
457+
case 29:
458+
case 59:
459+
res->fRefreshRate = (float)((rrate + 1)/1.001f);
460+
break;
461+
default:
462+
res->fRefreshRate = (float)rrate;
463+
break;
464+
}
477465

478466
res->bFullScreen = true;
479467
res->iSubtitles = (int)(0.965 * res->iHeight);

0 commit comments

Comments
 (0)