Merge branch 'pbiering/skindesigner-extend-detection-recording-isHD-isUHD'

This commit is contained in:
kamel5 2021-12-22 12:22:31 +01:00
commit d11d09ca6e
5 changed files with 69 additions and 18 deletions

View File

@ -207,8 +207,8 @@
tokenContainer->AddStringToken((int)token_st::shorttext, info->ShortText()); \
tokenContainer->AddStringToken((int)token_st::description, info->Description()); \
tokenContainer->AddIntToken((int)token_it::framesPerSecond, info->FramesPerSecond()); \
tokenContainer->AddIntToken((int)token_it::isHD, RecordingIsHD(event)); /* detect HD from 'info' */ \
tokenContainer->AddIntToken((int)token_it::isUHD, RecordingIsUHD(event)); /* detect UHD from 'info' */ \
tokenContainer->AddIntToken((int)token_it::isHD, RecordingIsHD(event, channelID)); /* detect HD from 'info' */ \
tokenContainer->AddIntToken((int)token_it::isUHD, RecordingIsUHD(event, channelID)); /* detect UHD from 'info' */ \
tokenContainer->AddIntToken((int)token_it::isRadio, RecordingIsRadio(event, info->FramesPerSecond())); /* detect Radio from 'info' and FPS */ \
tokenContainer->AddIntToken((int)token_it::isRecording, usedRecording->IsInUse() & ruTimer); \
tokenContainer->AddIntToken((int)token_it::isInUse, usedRecording->IsInUse()); \
@ -2018,6 +2018,7 @@ bool cLeMenuRecordings::Parse(bool forced) {
const cEvent *event = NULL;
const cRecordingInfo *info = usedRecording->Info();
tChannelID channelID = tChannelID::InvalidID;
if (!info) {
delete[] recName;
@ -2035,6 +2036,7 @@ bool cLeMenuRecordings::Parse(bool forced) {
if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) {
ADD_TOKEN_LMR_ST(recchannelname, info->ChannelName());
ADD_TOKEN_LMR_ST(recchannelid, info->ChannelID().ToString());
channelID = info->ChannelID();
} else {
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_CHANNELS_READ;
@ -2045,6 +2047,7 @@ bool cLeMenuRecordings::Parse(bool forced) {
if (channel) {
ADD_TOKEN_LMR_ST(recchannelname, channel->Name());
ADD_TOKEN_LMR_ST(recchannelid, *channel->GetChannelID().ToString());
channelID = channel->GetChannelID();
}
}
}
@ -2246,6 +2249,7 @@ bool cCeMenuRecordings::Parse(bool forced) {
const cEvent *event = NULL;
const cRecordingInfo *info = usedRecording->Info();
tChannelID channelID = tChannelID::InvalidID;
if (!info) return true;
event = info->GetEvent();
@ -2255,6 +2259,7 @@ bool cCeMenuRecordings::Parse(bool forced) {
if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) {
ADD_TOKEN_CMR_ST(recchannelname, info->ChannelName());
ADD_TOKEN_CMR_ST(recchannelid, info->ChannelID().ToString());
channelID = info->ChannelID();
} else {
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_CHANNELS_READ;
@ -2265,6 +2270,7 @@ bool cCeMenuRecordings::Parse(bool forced) {
if (channel) {
ADD_TOKEN_CMR_ST(recchannelname, channel->Name());
ADD_TOKEN_CMR_ST(recchannelid, *channel->GetChannelID().ToString());
channelID = channel->GetChannelID();
}
}
}

View File

@ -705,8 +705,8 @@ bool cViewDetailRec::Parse(bool forced) {
tokenContainer->AddIntToken((int)eDmDetailedRecIT::durationevent, duration);
tokenContainer->AddIntToken((int)eDmDetailedRecIT::durationeventhours, duration / 60);
tokenContainer->AddStringToken((int)eDmDetailedRecST::durationeventminutes, *cString::sprintf("%.2d", duration%60));
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isHD, RecordingIsHD(event)); // detect HD from 'info'
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isUHD, RecordingIsUHD(event)); // detect UHD from 'info'
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isHD, RecordingIsHD(event, tChannelID::InvalidID)); // detect HD from 'info', no fallback to channelID
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isUHD, RecordingIsUHD(event, tChannelID::InvalidID)); // detect UHD from 'info', no fallback to channelID
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isRadio, RecordingIsRadio(event, info->FramesPerSecond())); // detect Radio from 'info' and FPS
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isRecording, recording->IsInUse() & ruTimer);
tokenContainer->AddIntToken((int)eDmDetailedRecIT::isInUse, recording->IsInUse());

View File

@ -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 <type>"
if (Component) {
@ -628,22 +629,43 @@ bool RecordingIsHD(const cEvent* event) {
case 0x10:
isHD = true;
};
};
};
if ((isHD == 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 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 <type>"
if (Component) {
@ -657,7 +679,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;
};

View File

@ -113,8 +113,8 @@ public:
/******************************************************************
* helper function (did not find any other common place)
******************************************************************/
bool RecordingIsHD(const cEvent* event);
bool RecordingIsUHD(const cEvent* event);
bool RecordingIsHD(const cEvent* event, const tChannelID channelID);
bool RecordingIsUHD(const cEvent* event, const tChannelID channelID);
bool RecordingIsRadio(const cEvent* event, const double FramesPerSecond);
#endif //__VIEWELEMENT_H

View File

@ -1236,6 +1236,7 @@ bool cVeDmDetailheaderRec::Parse(bool forced) {
#endif
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::errors, errors);
const cEvent *event = info->GetEvent();
tChannelID channelID = tChannelID::InvalidID;
if (event) {
cString recDate = event->GetDateString();
cString recTime = event->GetTimeString();
@ -1260,8 +1261,6 @@ bool cVeDmDetailheaderRec::Parse(bool forced) {
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::durationevent, duration);
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::durationeventhours, duration / 60);
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::durationeventminutes, *cString::sprintf("%.2d", duration%60));
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isHD, RecordingIsHD(event)); // detect HD from 'info'
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isUHD, RecordingIsUHD(event)); // detect UHD from 'info'
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isRadio, RecordingIsRadio(event, info->FramesPerSecond())); // detect Radio from 'info' and FPS
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isRecording, recording->IsInUse() & ruTimer);
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isInUse, recording->IsInUse());
@ -1271,6 +1270,7 @@ bool cVeDmDetailheaderRec::Parse(bool forced) {
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, info->ChannelName());
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, info->ChannelID().ToString());
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::recchannelnumber, 0); // cannot be provided, for backward compatibility only
channelID = info->ChannelID();
} else {
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_CHANNELS_READ;
@ -1282,8 +1282,12 @@ bool cVeDmDetailheaderRec::Parse(bool forced) {
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, channel->Name());
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, *channel->GetChannelID().ToString());
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::recchannelnumber, channel->Number());
channelID = channel->GetChannelID();
}
}
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isHD, RecordingIsHD(event, channelID)); // detect HD from 'info'
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isUHD, RecordingIsUHD(event, channelID)); // detect UHD from 'info'
}
string recImage = "";
string path = recording->FileName() ? recording->FileName() : "";