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

@ -490,6 +490,7 @@ enum class eDCScreenResolutionIT {
screenwidth = 0,
screenheight,
isHD,
isUHD,
isWideScreen,
count
};
@ -1483,6 +1484,7 @@ enum class eDRRecInfoIT {
screenwidth = 0,
screenheight,
isHD,
isUHD,
isWideScreen,
count
};

View File

@ -453,6 +453,7 @@ void cVeDcScreenResolution::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{screenwidth}", (int)eDCScreenResolutionIT::screenwidth);
tokenContainer->DefineIntToken("{screenheight}", (int)eDCScreenResolutionIT::screenheight);
tokenContainer->DefineIntToken("{isHD}", (int)eDCScreenResolutionIT::isHD);
tokenContainer->DefineIntToken("{isUHD}", (int)eDCScreenResolutionIT::isUHD);
tokenContainer->DefineIntToken("{isWideScreen}", (int)eDCScreenResolutionIT::isWideScreen);
InheritTokenContainer();
}
@ -478,7 +479,8 @@ bool cVeDcScreenResolution::Parse(bool forced) {
SetDirty();
bool isHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD);
bool isUHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD, &isUHD);
bool isWideScreen = false;
string aspectName = GetScreenAspectString(aspect, &isWideScreen);
@ -487,6 +489,7 @@ bool cVeDcScreenResolution::Parse(bool forced) {
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenwidth, screenWidth);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenheight, screenHeight);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isHD, isHD);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isUHD, isUHD);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isWideScreen, isWideScreen);
tokenContainer->AddStringToken((int)eDCScreenResolutionST::resolution, resName.c_str());
tokenContainer->AddStringToken((int)eDCScreenResolutionST::aspect, aspectName.c_str());

View File

@ -78,6 +78,7 @@ void cVeDrRecInfo::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{screenwidth}", (int)eDRRecInfoIT::screenwidth);
tokenContainer->DefineIntToken("{screenheight}", (int)eDRRecInfoIT::screenheight);
tokenContainer->DefineIntToken("{isHD}", (int)eDRRecInfoIT::isHD);
tokenContainer->DefineIntToken("{isUHD}", (int)eDRRecInfoIT::isUHD);
tokenContainer->DefineIntToken("{isWideScreen}", (int)eDRRecInfoIT::isWideScreen);
InheritTokenContainer();
}
@ -97,7 +98,8 @@ bool cVeDrRecInfo::Parse(bool force) {
double aspect = 0;
cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect);
bool isHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD);
bool isUHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD, &isUHD);
bool isWideScreen = false;
string aspectName = GetScreenAspectString(aspect, &isWideScreen);
@ -105,6 +107,7 @@ bool cVeDrRecInfo::Parse(bool force) {
tokenContainer->AddIntToken((int)eDRRecInfoIT::screenwidth, screenWidth);
tokenContainer->AddIntToken((int)eDRRecInfoIT::screenheight, screenHeight);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isHD, isHD);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isUHD, isUHD);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isWideScreen, isWideScreen);
tokenContainer->AddStringToken((int)eDRRecInfoST::resolution, resName.c_str());
tokenContainer->AddStringToken((int)eDRRecInfoST::aspect, aspectName.c_str());

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

View File

@ -90,9 +90,10 @@
<!-- Available Variables screenresolution:
{screenwidth} width of currently displayed channel in px
{screenheight} height of currently displayed channel in px
{resolution} resolution: hd1080i, hd720p, sd576i, sd480i
{resolution} resolution: uhd4320p, uhd2160p, hd1440p, hd1080i, hd720p, sd576i, sd480i
{aspect} screen aspect, each 4:3, 16:9 or 21:9
{isHD} true for hd1080i and hd720p
{isHD} true for uhd4320p, uhd2160p, hd1440p, hd1080i, hd720p
{isUHD} true for uhd4320p, uhd2160p
{isWideScreen} true if aspect is 16:9 or 21:9
-->
<screenresolution>

View File

@ -61,11 +61,12 @@
</rectitle>
<!-- Available Variables recinfo:
{screenwidth} width of currently displayed recording in px
{screenheight} height of currently displayed recording in px
{resolution} resolution: hd1080i, hd720p, sd576i, sd480i
{screenwidth} width of currently displayed channel in px
{screenheight} height of currently displayed channel in px
{resolution} resolution: uhd4320p, uhd2160p, hd1440p, hd1080i, hd720p, sd576i, sd480i
{aspect} screen aspect, each 4:3, 16:9 or 21:9
{isHD} true for hd1080i and hd720p
{isHD} true for uhd4320p, uhd2160p, hd1440p, hd1080i, hd720p
{isUHD} true for uhd4320p, uhd2160p
{isWideScreen} true if aspect is 16:9 or 21:9
-->
<recinfo>