From 5e5e5c4fbc228625f40c2d503515879f69c05062 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 20 Dec 2021 18:42:58 +0100 Subject: extend detection of isHD and isUHD in case of stored EPG info (event) is missing any information regarding video (e.g. if EPG is missing on a channel) --- coreengine/viewelement.c | 63 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 10 deletions(-) (limited to 'coreengine/viewelement.c') diff --git a/coreengine/viewelement.c b/coreengine/viewelement.c index a9405cd..43fb8c3 100644 --- a/coreengine/viewelement.c +++ b/coreengine/viewelement.c @@ -587,18 +587,19 @@ void cViewElement::StopAnimation(void) { /****************************************************************** * helper function (did not find any other common place) ******************************************************************/ -bool RecordingIsHD(const cEvent* event) { +bool RecordingIsHD(const cEvent* event, const tChannelID channelID) { // detect HD from 'info' bool isHD = false; - cComponents *Components = (cComponents *)event->Components(); - if (Components) { + int type = -1; + + if (event) { + cComponents *Components = (cComponents *)event->Components(); + if (Components) { // detect HD (see also ETSI EN 300 468) // Stream: 1 = MPEG2-Video, 2 = MPEG2 Audio, 3 = Untertitel, 4 = AC3-Audio, 5 = H.264-Video, 6 = HEAAC-Audio, 7 = DTS/DTS HD audio, 8 = SRM/CPCM data, 9 = HEVC Video, AC4 Audio // Stream == Video(1|5): 01 = 05 = 4:3, 02 = 03 = 06 = 07 = 16:9, 04 = 08 = >16:9, 09 = 0D = HD 4:3, 0A = 0B = 0E = 0F = HD 16:9, 0C = 10 = HD >16:9 tComponent *Component; - int type = -1; - // #1: HVEC (stream content: 9) Component = Components->GetComponent(0, 9, 0); // recording info: "X 9 " if (Component) { @@ -628,22 +629,45 @@ bool RecordingIsHD(const cEvent* event) { case 0x10: isHD = true; }; + }; }; + + if ((isHD == false) && (type == -1) && (!(channelID == tChannelID::InvalidID))) { + dsyslog("skindesigner: Title='%s' ShortText='%s' isHD=%d type=%d channelID=%s", event->Title(), event->ShortText(), isHD, type, *channelID.ToString()); + // fallback to retrieve via channel (in case of EPG issues) +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(channelID); +#else + const cChannel *channel = Channels.GetByChannelID(channelID); +#endif + if (channel) { + dsyslog("skindesigner: Title='%s' ShortText='%s' isHD=%d type=%d Channel='%s'", event->Title(), event->ShortText(), isHD, type, channel->Name()); + switch (channel->Vtype()) { + case 0x1b: // H.264 + case 0x24: // H.265 + isHD = true; + break; + }; + }; + }; + return isHD; }; -bool RecordingIsUHD(const cEvent* event) { +bool RecordingIsUHD(const cEvent* event, const tChannelID channelID) { // detect UHD from 'info' bool isUHD = false; - cComponents *Components = (cComponents *)event->Components(); - if (Components) { + int type = -1; + + if (event) { + cComponents *Components = (cComponents *)event->Components(); + if (Components) { // detect UHD (see also ETSI EN 300 468) // Stream: 9 = HEVC Video, AC4 Audio // Stream == Video(9): 00|01|02|03 = HD, 04|05|06|07 = UHD tComponent *Component; - int type = -1; - // HVEC (stream content: 9) Component = Components->GetComponent(0, 9, 0); // recording info: "X 9 " if (Component) { @@ -657,7 +681,26 @@ bool RecordingIsUHD(const cEvent* event) { case 0x07: isUHD = true; }; + }; }; + + if ((isUHD == false) && (type == -1) && (!(channelID == tChannelID::InvalidID))) { + // fallback to retrieve via channel (in case of EPG issues) +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(channelID); +#else + const cChannel *channel = Channels.GetByChannelID(channelID); +#endif + if (channel) { + switch (channel->Vtype()) { + case 0x24: // H.265 + isUHD = true; + break; + }; + }; + }; + return isUHD; }; -- cgit v1.2.3 From 9690f6d8a0e14a30bf9cb8951645ad2f78849814 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 20 Dec 2021 19:13:00 +0100 Subject: remove debug lines --- coreengine/viewelement.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'coreengine/viewelement.c') diff --git a/coreengine/viewelement.c b/coreengine/viewelement.c index 43fb8c3..7f2a072 100644 --- a/coreengine/viewelement.c +++ b/coreengine/viewelement.c @@ -633,7 +633,6 @@ bool RecordingIsHD(const cEvent* event, const tChannelID channelID) { }; if ((isHD == false) && (type == -1) && (!(channelID == tChannelID::InvalidID))) { - dsyslog("skindesigner: Title='%s' ShortText='%s' isHD=%d type=%d channelID=%s", event->Title(), event->ShortText(), isHD, type, *channelID.ToString()); // fallback to retrieve via channel (in case of EPG issues) #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_CHANNELS_READ; @@ -642,7 +641,6 @@ bool RecordingIsHD(const cEvent* event, const tChannelID channelID) { const cChannel *channel = Channels.GetByChannelID(channelID); #endif if (channel) { - dsyslog("skindesigner: Title='%s' ShortText='%s' isHD=%d type=%d Channel='%s'", event->Title(), event->ShortText(), isHD, type, channel->Name()); switch (channel->Vtype()) { case 0x1b: // H.264 case 0x24: // H.265 -- cgit v1.2.3