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, screenwidth = 0,
screenheight, screenheight,
isHD, isHD,
isUHD,
isWideScreen, isWideScreen,
count count
}; };
@ -1483,6 +1484,7 @@ enum class eDRRecInfoIT {
screenwidth = 0, screenwidth = 0,
screenheight, screenheight,
isHD, isHD,
isUHD,
isWideScreen, isWideScreen,
count count
}; };

View File

@ -453,6 +453,7 @@ void cVeDcScreenResolution::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{screenwidth}", (int)eDCScreenResolutionIT::screenwidth); tokenContainer->DefineIntToken("{screenwidth}", (int)eDCScreenResolutionIT::screenwidth);
tokenContainer->DefineIntToken("{screenheight}", (int)eDCScreenResolutionIT::screenheight); tokenContainer->DefineIntToken("{screenheight}", (int)eDCScreenResolutionIT::screenheight);
tokenContainer->DefineIntToken("{isHD}", (int)eDCScreenResolutionIT::isHD); tokenContainer->DefineIntToken("{isHD}", (int)eDCScreenResolutionIT::isHD);
tokenContainer->DefineIntToken("{isUHD}", (int)eDCScreenResolutionIT::isUHD);
tokenContainer->DefineIntToken("{isWideScreen}", (int)eDCScreenResolutionIT::isWideScreen); tokenContainer->DefineIntToken("{isWideScreen}", (int)eDCScreenResolutionIT::isWideScreen);
InheritTokenContainer(); InheritTokenContainer();
} }
@ -478,7 +479,8 @@ bool cVeDcScreenResolution::Parse(bool forced) {
SetDirty(); SetDirty();
bool isHD = false; bool isHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD); bool isUHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD, &isUHD);
bool isWideScreen = false; bool isWideScreen = false;
string aspectName = GetScreenAspectString(aspect, &isWideScreen); string aspectName = GetScreenAspectString(aspect, &isWideScreen);
@ -487,6 +489,7 @@ bool cVeDcScreenResolution::Parse(bool forced) {
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenwidth, screenWidth); tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenwidth, screenWidth);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenheight, screenHeight); tokenContainer->AddIntToken((int)eDCScreenResolutionIT::screenheight, screenHeight);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isHD, isHD); tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isHD, isHD);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isUHD, isUHD);
tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isWideScreen, isWideScreen); tokenContainer->AddIntToken((int)eDCScreenResolutionIT::isWideScreen, isWideScreen);
tokenContainer->AddStringToken((int)eDCScreenResolutionST::resolution, resName.c_str()); tokenContainer->AddStringToken((int)eDCScreenResolutionST::resolution, resName.c_str());
tokenContainer->AddStringToken((int)eDCScreenResolutionST::aspect, aspectName.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("{screenwidth}", (int)eDRRecInfoIT::screenwidth);
tokenContainer->DefineIntToken("{screenheight}", (int)eDRRecInfoIT::screenheight); tokenContainer->DefineIntToken("{screenheight}", (int)eDRRecInfoIT::screenheight);
tokenContainer->DefineIntToken("{isHD}", (int)eDRRecInfoIT::isHD); tokenContainer->DefineIntToken("{isHD}", (int)eDRRecInfoIT::isHD);
tokenContainer->DefineIntToken("{isUHD}", (int)eDRRecInfoIT::isUHD);
tokenContainer->DefineIntToken("{isWideScreen}", (int)eDRRecInfoIT::isWideScreen); tokenContainer->DefineIntToken("{isWideScreen}", (int)eDRRecInfoIT::isWideScreen);
InheritTokenContainer(); InheritTokenContainer();
} }
@ -97,7 +98,8 @@ bool cVeDrRecInfo::Parse(bool force) {
double aspect = 0; double aspect = 0;
cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect); cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect);
bool isHD = false; bool isHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD); bool isUHD = false;
string resName = GetScreenResolutionString(screenWidth, screenHeight, &isHD, &isUHD);
bool isWideScreen = false; bool isWideScreen = false;
string aspectName = GetScreenAspectString(aspect, &isWideScreen); string aspectName = GetScreenAspectString(aspect, &isWideScreen);
@ -105,6 +107,7 @@ bool cVeDrRecInfo::Parse(bool force) {
tokenContainer->AddIntToken((int)eDRRecInfoIT::screenwidth, screenWidth); tokenContainer->AddIntToken((int)eDRRecInfoIT::screenwidth, screenWidth);
tokenContainer->AddIntToken((int)eDRRecInfoIT::screenheight, screenHeight); tokenContainer->AddIntToken((int)eDRRecInfoIT::screenheight, screenHeight);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isHD, isHD); tokenContainer->AddIntToken((int)eDRRecInfoIT::isHD, isHD);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isUHD, isUHD);
tokenContainer->AddIntToken((int)eDRRecInfoIT::isWideScreen, isWideScreen); tokenContainer->AddIntToken((int)eDRRecInfoIT::isWideScreen, isWideScreen);
tokenContainer->AddStringToken((int)eDRRecInfoST::resolution, resName.c_str()); tokenContainer->AddStringToken((int)eDRRecInfoST::resolution, resName.c_str());
tokenContainer->AddStringToken((int)eDRRecInfoST::aspect, aspectName.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, resWidth, "res_width");
StripXmlTag(mediaInfoXml, resHeight, "res_height"); StripXmlTag(mediaInfoXml, resHeight, "res_height");
resString = GetScreenResolutionString(resWidth, resHeight, &isHD); resString = GetScreenResolutionString(resWidth, resHeight, &isHD, &isUHD);
StripXmlTag(mediaInfoXml, aspectratio, "aspectratio"); StripXmlTag(mediaInfoXml, aspectratio, "aspectratio");
isWideScreen = !aspectratio.compare("16:9"); isWideScreen = !aspectratio.compare("16:9");
StripXmlTag(mediaInfoXml, codec, "codec"); StripXmlTag(mediaInfoXml, codec, "codec");

View File

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

View File

@ -198,29 +198,43 @@ string GetTimeString(int seconds) {
//View Helpers //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 = ""; string name = "";
switch (width) { switch (height) {
case 1920: case 4320: // 7680 x 4320 = 8K UHD
case 1440: name = "uhd4320p";
name = "hd1080i"; *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; *isHD = true;
break; break;
case 1280: case 1080:
if (height == 720) name = "hd1080i"; // 'i' is default, 'p' can't be detected currently
name = "hd720p";
else
name = "hd1080i";
*isHD = true; *isHD = true;
break; break;
case 720: case 720:
name = "sd576i"; name = "hd720p"; // 'i' is not defined in standards
*isHD = true;
break; break;
case 544: case 576:
name = "sd480i"; name = "sd576i"; // assumed 'i'
break;
case 480:
name = "sd480i"; // assumed 'i'
break; break;
default: default:
name = "sd576i"; name = "unknown";
break; break;
} }
return name; return name;

View File

@ -44,7 +44,7 @@ public:
string GetTimeString(int seconds); 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); string GetScreenAspectString(double aspect, bool *isWideScreen);
#endif // __HELPERS_H #endif // __HELPERS_H

View File

@ -90,9 +90,10 @@
<!-- Available Variables screenresolution: <!-- Available Variables screenresolution:
{screenwidth} width of currently displayed channel in px {screenwidth} width of currently displayed channel in px
{screenheight} height 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 {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 {isWideScreen} true if aspect is 16:9 or 21:9
--> -->
<screenresolution> <screenresolution>

View File

@ -61,11 +61,12 @@
</rectitle> </rectitle>
<!-- Available Variables recinfo: <!-- Available Variables recinfo:
{screenwidth} width of currently displayed recording in px {screenwidth} width of currently displayed channel in px
{screenheight} height of currently displayed recording 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 {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 {isWideScreen} true if aspect is 16:9 or 21:9
--> -->
<recinfo> <recinfo>