diff options
author | louis <louis.braun@gmx.de> | 2015-04-26 14:05:14 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-04-26 14:05:14 +0200 |
commit | e7d8a193a77b5a13e8ac9677ca890359e88959f5 (patch) | |
tree | db5331186bc9e814c75ce314089ecd34e4be9908 | |
parent | 4fb0b9de2281f5a35c2ca05ccb42f250488b945b (diff) | |
download | vdr-plugin-skindesigner-e7d8a193a77b5a13e8ac9677ca890359e88959f5.tar.gz vdr-plugin-skindesigner-e7d8a193a77b5a13e8ac9677ca890359e88959f5.tar.bz2 |
implemented dvbapi service interface, added viewelement ecminfo in displaychannel
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | displaychannel.c | 12 | ||||
-rw-r--r-- | displaychannel.h | 2 | ||||
-rw-r--r-- | dtd/displaychannel.dtd | 8 | ||||
-rw-r--r-- | libtemplate/templateview.c | 6 | ||||
-rw-r--r-- | libtemplate/templateviewelement.h | 1 | ||||
-rw-r--r-- | services/dvbapi.h | 18 | ||||
-rw-r--r-- | skins/blackhole/xmlfiles/displaychannel.xml | 21 | ||||
-rw-r--r-- | skinskeleton/xmlfiles/displaychannel.xml | 12 | ||||
-rw-r--r-- | views/displaychannelview.c | 17 | ||||
-rw-r--r-- | views/displaychannelview.h | 2 | ||||
-rw-r--r-- | views/viewhelpers.c | 54 | ||||
-rw-r--r-- | views/viewhelpers.h | 5 |
13 files changed, 157 insertions, 3 deletions
@@ -300,4 +300,6 @@ Version 0.4.3 to compare strings in conditions - fixed sort order in lastrecordings viewelement - added tokens for progressbars in displamenudefault +- implemented dvbapi service interface, added viewelement ecminfo + in displaychannel diff --git a/displaychannel.c b/displaychannel.c index 603e80e..05c12d3 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -16,6 +16,8 @@ cSDDisplayChannel::cSDDisplayChannel(cTemplate *channelTemplate, bool WithInfo) channelChange = false; initial = true; devicesLast = cTimeMs::Now(); + currentChannelSid = -1; + isEncrypted = false; channelView = new cDisplayChannelView(channelTemplate->GetRootView()); if (!channelView->createOsd()) { @@ -33,17 +35,20 @@ cSDDisplayChannel::~cSDDisplayChannel() { void cSDDisplayChannel::SetChannel(const cChannel *Channel, int Number) { if (!doOutput) return; - channelChange = true; groupSep = false; cString ChannelNumber(""); cString ChannelName(""); cString ChannelID(""); + currentChannelSid = -1; + isEncrypted = false; if (Channel) { ChannelName = Channel->Name() ? Channel->Name() : ""; ChannelID = Channel->GetChannelID().ToString(); + currentChannelSid = Channel->Sid(); + isEncrypted = Channel->Ca(); if (!Channel->GroupSep()) { ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : ""); } else { @@ -54,12 +59,14 @@ void cSDDisplayChannel::SetChannel(const cChannel *Channel, int Number) { } else { ChannelName = ChannelString(NULL, 0); } + channelView->ClearChannel(); channelView->ClearEPGInfo(); channelView->ClearStatusIcons(); channelView->ClearChannelGroups(); channelView->ClearScraperContent(); channelView->ClearAudioInfo(); + channelView->ClearEncryptionInfo(); if (!groupSep) { channelView->DrawChannel(ChannelNumber, ChannelName, ChannelID, (Number > 0)?true:false); channelView->DrawProgressBarBack(); @@ -189,6 +196,9 @@ void cSDDisplayChannel::Flush(void) { channelView->DrawDevices(initial); devicesLast = cTimeMs::Now(); } + if (isEncrypted) { + channelView->DrawEncryptionInfo(currentChannelSid); + } } else { channelView->ClearStatusIcons(); channelView->ClearScreenResolution(); diff --git a/displaychannel.h b/displaychannel.h index 12c6922..b8d8973 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -20,6 +20,8 @@ private: int currentLast; uint64_t devicesLast; const cEvent *present; + int currentChannelSid; + int isEncrypted; void SetProgressBar(const cEvent *present); public: cSDDisplayChannel(cTemplate *channelTemplate, bool WithInfo); diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd index baea223..2038d12 100644 --- a/dtd/displaychannel.dtd +++ b/dtd/displaychannel.dtd @@ -3,7 +3,7 @@ <!ENTITY % functions SYSTEM "functions.dtd">
<!ELEMENT displaychannel (background | channelinfo | epginfo | progressbar | progressbarback |
- statusinfo | audioinfo | screenresolution | channelgroup |
+ statusinfo | audioinfo | ecminfo | screenresolution | channelgroup |
signalquality | signalqualityback | devices | currentweather | scrapercontent |
datetime | time | message | customtokens)* >
<!ATTLIST displaychannel
@@ -61,6 +61,12 @@ condition CDATA #IMPLIED
>
+<!ELEMENT ecminfo (area|areascroll)*>
+<!ATTLIST ecminfo
+ debug CDATA #IMPLIED
+ condition CDATA #IMPLIED
+>
+
<!ELEMENT screenresolution (area|areascroll)*>
<!ATTLIST screenresolution
debug CDATA #IMPLIED
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 1117d10..ddd6094 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -894,6 +894,7 @@ void cTemplateViewChannel::SetViewElements(void) { viewElementsAllowed.insert("progressbarback"); viewElementsAllowed.insert("statusinfo"); viewElementsAllowed.insert("audioinfo"); + viewElementsAllowed.insert("ecminfo"); viewElementsAllowed.insert("screenresolution"); viewElementsAllowed.insert("signalquality"); viewElementsAllowed.insert("signalqualityback"); @@ -936,6 +937,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) { case veScreenResolution: name = "Screen Resolution"; break; + case veEcmInfo: + name = "ECM Info"; + break; case veSignalQuality: name = "Signal Quality"; break; @@ -989,6 +993,8 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, ve = veStatusInfo; } else if (!sViewElement.compare("audioinfo")) { ve = veAudioInfo; + } else if (!sViewElement.compare("ecminfo")) { + ve = veEcmInfo; } else if (!sViewElement.compare("screenresolution")) { ve = veScreenResolution; } else if (!sViewElement.compare("signalquality")) { diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index 8293109..a291c7c 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -41,6 +41,7 @@ enum eViewElement { veSignalQuality,
veSignalQualityBack,
veScraperContent,
+ veEcmInfo,
//DisplayMenu ViewElements
veHeader,
veButtons,
diff --git a/services/dvbapi.h b/services/dvbapi.h new file mode 100644 index 0000000..540a49c --- /dev/null +++ b/services/dvbapi.h @@ -0,0 +1,18 @@ +#ifndef __DVBAPISERVICES_H +#define __DVBAPISERVICES_H + +struct sDVBAPIEcmInfo { + //in parameters + uint16_t sid; + //out parameters + uint16_t caid; + uint16_t pid; + uint32_t prid; + uint32_t ecmtime; + cString reader; + cString from; + cString protocol; + int8_t hops; +}; + +#endif //__DVBAPISERVICES_H
\ No newline at end of file diff --git a/skins/blackhole/xmlfiles/displaychannel.xml b/skins/blackhole/xmlfiles/displaychannel.xml index 993d7eb..ff8282e 100644 --- a/skins/blackhole/xmlfiles/displaychannel.xml +++ b/skins/blackhole/xmlfiles/displaychannel.xml @@ -133,6 +133,24 @@ <audioinfo> </audioinfo> + <!-- Available Variables ecminfo: + {caid} id of currently used CA + {pid} pID + {prid} provider ID + {ecmtime} ecm time in ms + {hops} number of hops + {reader} name of used reader + {from} name of originating host + {protocol} used protocol of reader + --> + + <ecminfo> + <area x="60%" y="95%" width="24%" height="5%" layer="4"> + <drawtext x="0" y="5%" font="{semibold}" fontsize="40%" color="{clrWhite}" text="CAID: {caid} Reader: {reader}" /> + <drawtext x="0" y="50%" font="{semibold}" fontsize="40%" color="{clrWhite}" text="ECM Time: {ecmtime} ms" /> + </area> + </ecminfo> + <!-- Available Variables screenresolution: {screenwidth} width of currently displayed channel in px {screenheight} height of currently displayed channel in px @@ -194,6 +212,7 @@ {devices[channelid]} ID of the currently tuned channel {devices[source]} source of the currently tuned channel --> + <!-- <devices condition="{showdevices}"> <area x="56%" y="94%" width="28%" height="6%" layer="2"> <loop name="devices" x="0" y="0" orientation="horizontal" columnwidth="{areawidth}/{numdevices}" rowheight="{areaheight}"> @@ -207,7 +226,7 @@ </loop> </area> </devices> - + --> <!-- Available Variables scrapercontent: {posterpath} Full Path of Poster to use in image path attribute {posterwidth} width of poster in pixel diff --git a/skinskeleton/xmlfiles/displaychannel.xml b/skinskeleton/xmlfiles/displaychannel.xml index f7c4d68..351709c 100644 --- a/skinskeleton/xmlfiles/displaychannel.xml +++ b/skinskeleton/xmlfiles/displaychannel.xml @@ -71,6 +71,18 @@ <audioinfo> </audioinfo> + <!-- Available Variables ecminfo: + {caid} id of currently used CA + {pid} pID + {prid} provider ID + {ecmtime} ecm time in ms + {hops} number of hops + {reader} name of used reader + {from} name of originating host + {protocol} used protocol of reader + --> + <ecminfo> + </ecminfo> <!-- Available Variables screenresolution: {screenwidth} width of currently displayed channel in px diff --git a/views/displaychannelview.c b/views/displaychannelview.c index 9252c40..a189429 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -282,6 +282,23 @@ void cDisplayChannelView::ClearAudioInfo(void) { ClearViewElement(veAudioInfo); } +void cDisplayChannelView::DrawEncryptionInfo(int channelSid) { + if (!ExecuteViewElement(veEcmInfo)) { + return; + } + map < string, int > intTokens; + map < string, string > stringTokens; + + if (SetEcmInfos(channelSid, stringTokens, intTokens)) { + ClearEncryptionInfo(); + DrawViewElement(veEcmInfo, &stringTokens, &intTokens); + } +} + +void cDisplayChannelView::ClearEncryptionInfo(void) { + ClearViewElement(veEcmInfo); +} + void cDisplayChannelView::DrawScreenResolution(void) { if (!ExecuteViewElement(veScreenResolution)) { return; diff --git a/views/displaychannelview.h b/views/displaychannelview.h index e3f33c3..f533e1c 100644 --- a/views/displaychannelview.h +++ b/views/displaychannelview.h @@ -34,6 +34,8 @@ public: void ClearStatusIcons(void); void DrawAudioInfo(void); void ClearAudioInfo(void); + void DrawEncryptionInfo(int channelSid); + void ClearEncryptionInfo(void); void DrawScreenResolution(void); void ClearScreenResolution(void); void DrawScraperContent(const cEvent *event); diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 294ac22..50f197b 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -21,6 +21,11 @@ cViewHelpers::cViewHelpers(void) { lastMinute = -1; lastSystemLoad = 0.0; lastMemUsage = -1; + lastEcmInfo.hops = -1; + lastEcmInfo.ecmtime = -1; + lastEcmInfo.caid = -1; + lastEcmInfo.pid = -1; + lastEcmInfo.prid = -1; } cViewHelpers::~cViewHelpers() { @@ -855,6 +860,55 @@ void cViewHelpers::SetCurrentSchedule(string recName, map < string, string > &st } } +bool cViewHelpers::SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens) { + static cPlugin *pDVBApi = cPluginManager::GetPlugin("dvbapi"); + if (!pDVBApi) + return false; + + sDVBAPIEcmInfo ecmInfo; + ecmInfo.sid = channelSid; + + if (!pDVBApi->Service("GetEcmInfo", &ecmInfo)) { + return false; + } + + if (ecmInfo.hops < 0 || ecmInfo.ecmtime <= 0) + return false; + if (CompareECMInfos(&ecmInfo)) + return false; + lastEcmInfo = ecmInfo; + + intTokens.insert(pair<string,int>("caid", ecmInfo.caid)); + intTokens.insert(pair<string,int>("pid", ecmInfo.pid)); + intTokens.insert(pair<string,int>("prid", ecmInfo.prid)); + intTokens.insert(pair<string,int>("ecmtime", ecmInfo.ecmtime)); + intTokens.insert(pair<string,int>("hops", ecmInfo.hops)); + + stringTokens.insert(pair<string,string>("reader", *ecmInfo.reader ? *ecmInfo.reader : "")); + stringTokens.insert(pair<string,string>("from", *ecmInfo.from ? *ecmInfo.from : "")); + stringTokens.insert(pair<string,string>("protocol", *ecmInfo.protocol ? *ecmInfo.protocol : "")); + + return true; +} + +bool cViewHelpers::CompareECMInfos(sDVBAPIEcmInfo *ecmInfo) { + if (ecmInfo->caid != lastEcmInfo.caid) + return false; + if (ecmInfo->pid != lastEcmInfo.pid) + return false; + if (ecmInfo->prid != lastEcmInfo.prid) + return false; + if (ecmInfo->ecmtime != lastEcmInfo.ecmtime) + return false; + if (ecmInfo->hops != lastEcmInfo.hops) + return false; + return true; +} + +/******************************************************************************** +* Private Functions +********************************************************************************/ + void cViewHelpers::RecName(string &path, string &name, string &folder) { size_t delim = path.find_last_of('~'); if (delim == string::npos) { diff --git a/views/viewhelpers.h b/views/viewhelpers.h index 112b3ca..bc0adcf 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -1,6 +1,8 @@ #ifndef __VIEWHELPERS_H #define __VIEWHELPERS_H +#include "../services/dvbapi.h" + class cViewHelpers { private: int numDevices; @@ -15,10 +17,12 @@ private: int lastMinute; double lastSystemLoad; int lastMemUsage; + sDVBAPIEcmInfo lastEcmInfo; void RecName(string &path, string &name, string &folder); void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster); void SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens); void SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens); + bool CompareECMInfos(sDVBAPIEcmInfo *ecmInfo); protected: void InitDevices(void); bool SetDevices(bool initial, bool light, map<string,int> *intTokens, vector<map<string,string> > *devices); @@ -37,6 +41,7 @@ protected: bool SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens); bool SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens); void SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens); + bool SetEcmInfos(int channelSid, map < string, string > &stringTokens, map < string, int > &intTokens); public: cViewHelpers(void); virtual ~cViewHelpers(void); |