add isUHD to screenresolution

change mechanism to detect video type using screen height instead of guessing height from width
This commit is contained in:
Peter Bieringer
2021-01-21 07:49:35 +01:00
parent 4c4b9f7837
commit 66f090afdb
9 changed files with 50 additions and 25 deletions

View File

@@ -19,7 +19,7 @@ bool cExtRecInfo::Parse(void) {
}
StripXmlTag(mediaInfoXml, resWidth, "res_width");
StripXmlTag(mediaInfoXml, resHeight, "res_height");
resString = GetScreenResolutionString(resWidth, resHeight, &isHD);
resString = GetScreenResolutionString(resWidth, resHeight, &isHD, &isUHD);
StripXmlTag(mediaInfoXml, aspectratio, "aspectratio");
isWideScreen = !aspectratio.compare("16:9");
StripXmlTag(mediaInfoXml, codec, "codec");

View File

@@ -23,6 +23,7 @@ public:
int resHeight;
string resString;
bool isHD;
bool isUHD;
string aspectratio;
bool isWideScreen;
string codec;
@@ -33,4 +34,4 @@ public:
vector< tAudioTrack > tracks;
};
#endif // __EXTRECINFO_H
#endif // __EXTRECINFO_H

View File

@@ -198,29 +198,43 @@ string GetTimeString(int seconds) {
//View Helpers
string GetScreenResolutionString(int width, int height, bool *isHD) {
string GetScreenResolutionString(int width, int height, bool *isHD, bool *isUHD) {
// TODO: try to get more information from information sources about interlace/progressive
// cDevice::PrimaryDevice()->GetVideoSize is NOT providing enough information
*isHD = false; // default
*isUHD = false; // default
string name = "";
switch (width) {
case 1920:
case 1440:
name = "hd1080i";
switch (height) {
case 4320: // 7680 x 4320 = 8K UHD
name = "uhd4320p";
*isHD = true;
*isUHD = true;
break;
case 2160: // 3840 x 2160 = 4K UHD
name = "uhd2160p";
*isHD = true;
*isUHD = true;
break;
case 1440: // 2560 x 1440 = QHD
name = "hd1440p";
*isHD = true;
break;
case 1280:
if (height == 720)
name = "hd720p";
else
name = "hd1080i";
case 1080:
name = "hd1080i"; // 'i' is default, 'p' can't be detected currently
*isHD = true;
break;
case 720:
name = "sd576i";
name = "hd720p"; // 'i' is not defined in standards
*isHD = true;
break;
case 544:
name = "sd480i";
case 576:
name = "sd576i"; // assumed 'i'
break;
case 480:
name = "sd480i"; // assumed 'i'
break;
default:
name = "sd576i";
name = "unknown";
break;
}
return name;

View File

@@ -44,7 +44,7 @@ public:
string GetTimeString(int seconds);
string GetScreenResolutionString(int width, int height, bool *isHD);
string GetScreenResolutionString(int width, int height, bool *isHD, bool *isUHD);
string GetScreenAspectString(double aspect, bool *isWideScreen);
#endif // __HELPERS_H