From db59aa9c29d123d544fde5ad7a43b94e788b3c26 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 6 Jan 2015 00:58:35 +0200 Subject: [PATCH] Added support for Digital Devices CI extension. --- HISTORY | 1 + README | 5 +++++ config.c | 1 + config.h | 3 +++ device.c | 12 +++++++++++- device.h | 1 + deviceif.h | 1 + po/ca_ES.po | 9 +++++++++ po/de_DE.po | 12 ++++++++++++ po/es_ES.po | 9 +++++++++ po/fi_FI.po | 12 ++++++++++++ satip.c | 2 ++ server.c | 3 +++ server.h | 1 + setup.c | 7 +++++++ setup.h | 1 + tuner.c | 12 ++++++++++-- tuner.h | 1 + 18 files changed, 90 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 0e130e4..b1e7923 100644 --- a/HISTORY +++ b/HISTORY @@ -95,3 +95,4 @@ VDR Plugin 'satip' Revision History - Fixed the server teardown. - Removed the unnecessary config directory definition. - Added a fallback for older glibc libraries. +- Added support for Digital Devices CI extension. diff --git a/README b/README index 622feef..c0d9d0f 100644 --- a/README +++ b/README @@ -27,6 +27,7 @@ Requirements: http://www.gnu.org/software/libc/ - VDR >= 2.1.4 for scrambled channels + >= 2.1.7 for Digital Devices CI extension Description: @@ -79,6 +80,10 @@ Setup menu: option to "low". Similarly, the "high" value prefers the SAT>IP over the local DVB cards when selecting available devices. +- Use CI extension = no If you want to use the CI extension found + in some SAT>IP hardware (e.g. Digital + Devices OctopusNet), set this option to + "yes". - Enable EPG scanning = yes If you want exclude all SAT>IP devices from VDR's EIT background scanning, set this option to "no". diff --git a/config.c b/config.c index 57e3bce..c5c2112 100644 --- a/config.c +++ b/config.c @@ -14,6 +14,7 @@ cSatipConfig SatipConfig; cSatipConfig::cSatipConfig(void) : operatingModeM(eOperatingModeLow), traceModeM(eTraceModeNormal), + ciExtensionM(0), eitScanM(1), useBytesM(1) { diff --git a/config.h b/config.h index 8fb775f..e1f9f46 100644 --- a/config.h +++ b/config.h @@ -16,6 +16,7 @@ class cSatipConfig private: unsigned int operatingModeM; unsigned int traceModeM; + unsigned int ciExtensionM; unsigned int eitScanM; unsigned int useBytesM; int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT]; @@ -58,6 +59,7 @@ public: void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; } unsigned int GetTraceMode(void) const { return traceModeM; } bool IsTraceMode(eTraceMode modeP) const { return (traceModeM & modeP); } + unsigned int GetCIExtension(void) const { return ciExtensionM; } unsigned int GetEITScan(void) const { return eitScanM; } unsigned int GetUseBytes(void) const { return useBytesM; } unsigned int GetDisabledSourcesCount(void) const; @@ -67,6 +69,7 @@ public: void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; } void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); } + void SetCIExtension(unsigned int onOffP) { ciExtensionM = onOffP; } void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; } void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; } void SetDisabledSources(unsigned int indexP, int sourceP); diff --git a/device.c b/device.c index 1da060e..6c2a63e 100644 --- a/device.c +++ b/device.c @@ -406,7 +406,7 @@ bool cSatipDevice::HasLock(int timeoutMsP) const bool cSatipDevice::HasInternalCam(void) { debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); - return false; + return SatipConfig.GetCIExtension(); } void cSatipDevice::WriteData(uchar *bufferP, int lengthP) @@ -428,6 +428,16 @@ int cSatipDevice::GetId(void) return deviceIndexM; } +int cSatipDevice::GetPmtPid(void) +{ + int pid = 0; +#if defined(APIVERSNUM) && APIVERSNUM >= 20107 + pid = channelM.Ca() ? ::GetPmtPid(channelM.Source(), channelM.Transponder(), channelM.Sid()) : 0; +#endif + debug16("%s pmtpid=%d source=%c transponder=%d sid=%d name=%s [device %u]", __PRETTY_FUNCTION__, pid, cSource::ToChar(channelM.Source()), channelM.Transponder(), channelM.Sid(), channelM.Name(), deviceIndexM); + return pid; +} + uchar *cSatipDevice::GetData(int *availableP) { debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); diff --git a/device.h b/device.h index b53cec7..dd6d65a 100644 --- a/device.h +++ b/device.h @@ -108,6 +108,7 @@ public: public: virtual void WriteData(u_char *bufferP, int lengthP); virtual int GetId(void); + virtual int GetPmtPid(void); }; #endif // __SATIP_DEVICE_H diff --git a/deviceif.h b/deviceif.h index 3dda061..6ff4c48 100644 --- a/deviceif.h +++ b/deviceif.h @@ -14,6 +14,7 @@ public: virtual ~cSatipDeviceIf() {} virtual void WriteData(u_char *bufferP, int lengthP) = 0; virtual int GetId(void) = 0; + virtual int GetPmtPid(void) = 0; private: cSatipDeviceIf(const cSatipDeviceIf&); diff --git a/po/ca_ES.po b/po/ca_ES.po index 1fcc163..3a83c78 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -103,6 +103,15 @@ msgstr "" "Normal - Dispositius treballan en parametres normals\n" "Alta - Dispositius treballan a prioritat Alta" +msgid "Enable CI extension" +msgstr "" + +msgid "" +"Define whether a CI extension shall be used.\n" +"\n" +"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)." +msgstr "" + msgid "Enable EPG scanning" msgstr "Activa Escanneig EPG" diff --git a/po/de_DE.po b/po/de_DE.po index 576bd6f..f8ba6e8 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -103,6 +103,18 @@ msgstr "" "normal - Geräte arbeiten innerhalb der gewöhnlichen Parameter\n" "hoch - Geräte arbeiten mit höchste Priorität" +msgid "Enable CI extension" +msgstr "Aktiviere CI Erweiterung" + +msgid "" +"Define whether a CI extension shall be used.\n" +"\n" +"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)." +msgstr "" +"Legt fest ob eine CI Erweiterung genutzt werden soll.\n" +"\n" +"Diese Einstellung aktiviert die Nutzung des integrierten CI/CAM einiger SAT>IP Geräte (z.B. Digital Devices OctopusNet)." + msgid "Enable EPG scanning" msgstr "Aktiviere EPG Aktualisierung" diff --git a/po/es_ES.po b/po/es_ES.po index b8c0892..fa5a023 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -103,6 +103,15 @@ msgstr "" "Normal - Dispositivos trabajando con prioridad Normal\n" "Alta - Dispositivos trabajando con prioridad Alta" +msgid "Enable CI extension" +msgstr "" + +msgid "" +"Define whether a CI extension shall be used.\n" +"\n" +"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)." +msgstr "" + msgid "Enable EPG scanning" msgstr "Activa Escaneo EPG" diff --git a/po/fi_FI.po b/po/fi_FI.po index e167072..273a115 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -102,6 +102,18 @@ msgstr "" "normaali - laitteet toimivat normaalilla prioriteetilla\n" "korkea - laitteet toimivat korkealla prioriteetilla" +msgid "Enable CI extension" +msgstr "Käytä CI-laajennosta" + +msgid "" +"Define whether a CI extension shall be used.\n" +"\n" +"This setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet)." +msgstr "" +"Määrittele CI-laajennoksen käyttöönotto\n" +"\n" +"Tällä asetuksella saadaan otettua käyttöön SAT>IP-laitteiden sisäinen CI-paikka (esim. Digital Devices OctopusNet)." + msgid "Enable EPG scanning" msgstr "Käytä ohjelmaoppaan taustapäivitystä" diff --git a/satip.c b/satip.c index 1da6d39..45209da 100644 --- a/satip.c +++ b/satip.c @@ -274,6 +274,8 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP) // Parse your own setup parameters and store their values. if (!strcasecmp(nameP, "OperatingMode")) SatipConfig.SetOperatingMode(atoi(valueP)); + else if (!strcasecmp(nameP, "EnableCIExtension")) + SatipConfig.SetCIExtension(atoi(valueP)); else if (!strcasecmp(nameP, "EnableEITScan")) SatipConfig.SetEITScan(atoi(valueP)); else if (!strcasecmp(nameP, "DisabledSources")) { diff --git a/server.c b/server.c index 455dbeb..90a4afb 100644 --- a/server.c +++ b/server.c @@ -45,6 +45,9 @@ cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char quirkM |= eSatipQuirkForceLock; if (quirkM != eSatipQuirkNone) info("Malfunctioning '%s' server detected! Please, fix the firmware.", *descriptionM); + // These devices support the X_PMT protocol extension + if (strstr(*descriptionM, "OctopusNet")) // Digital Devices OctopusNet + quirkM |= eSatipQuirkUseXPMT; } char *s, *p = strdup(*modelM); char *r = strtok_r(p, ",", &s); diff --git a/server.h b/server.h index 4df2ec8..805531e 100644 --- a/server.h +++ b/server.h @@ -37,6 +37,7 @@ public: eSatipQuirkSessionId = 0x01, eSatipQuirkPlayPids = 0x02, eSatipQuirkForceLock = 0x04, + eSatipQuirkUseXPMT = 0x08, eSatipQuirkMask = 0x0F }; enum eSatipModelType { diff --git a/setup.c b/setup.c index d1745ae..9678bd7 100644 --- a/setup.c +++ b/setup.c @@ -329,6 +329,7 @@ eOSState cSatipMenuInfo::ProcessKey(eKeys keyP) cSatipPluginSetup::cSatipPluginSetup() : deviceCountM(0), operatingModeM(SatipConfig.GetOperatingMode()), + ciExtensionM(SatipConfig.GetCIExtension()), eitScanM(SatipConfig.GetEITScan()), numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()), numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount()) @@ -364,6 +365,10 @@ void cSatipPluginSetup::Setup(void) helpM.Append(tr("Define the used operating mode for all SAT>IP devices:\n\noff - devices are disabled\nlow - devices are working at the lowest priority\nnormal - devices are working within normal parameters\nhigh - devices are working at the highest priority")); if (operatingModeM) { +#if defined(APIVERSNUM) && APIVERSNUM >= 20107 + Add(new cMenuEditBoolItem(tr("Enable CI extension"), &ciExtensionM)); + helpM.Append(tr("Define whether a CI extension shall be used.\n\nThis setting enables integrated CI/CAM handling found in some SAT>IP hardware (e.g. Digital Devices OctopusNet).")); +#endif Add(new cMenuEditBoolItem(tr("Enable EPG scanning"), &eitScanM)); helpM.Append(tr("Define whether the EPG background scanning shall be used.\n\nThis setting disables the automatic EIT scanning functionality for all SAT>IP devices.")); @@ -510,11 +515,13 @@ void cSatipPluginSetup::Store(void) { // Store values into setup.conf SetupStore("OperatingMode", operatingModeM); + SetupStore("EnableCIExtension", ciExtensionM); SetupStore("EnableEITScan", eitScanM); StoreSources("DisabledSources", disabledSourcesM); StoreFilters("DisabledFilters", disabledFilterIndexesM); // Update global config SatipConfig.SetOperatingMode(operatingModeM); + SatipConfig.SetCIExtension(ciExtensionM); SatipConfig.SetEITScan(eitScanM); for (int i = 0; i < MAX_DISABLED_SOURCES_COUNT; ++i) SatipConfig.SetDisabledSources(i, disabledSourcesM[i]); diff --git a/setup.h b/setup.h index fdee144..8d4b986 100644 --- a/setup.h +++ b/setup.h @@ -18,6 +18,7 @@ private: int deviceCountM; int operatingModeM; const char *operatingModeTextsM[cSatipConfig::eOperatingModeCount]; + int ciExtensionM; int eitScanM; int numDisabledSourcesM; int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT]; diff --git a/tuner.c b/tuner.c index 58742a0..6971e17 100644 --- a/tuner.c +++ b/tuner.c @@ -41,6 +41,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) signalStrengthM(-1), signalQualityM(-1), streamIdM(-1), + pmtPidM(-1), addPidsM(), delPidsM(), pidsM() @@ -186,8 +187,6 @@ bool cSatipTuner::Connect(void) // Just retune if (streamIdM >= 0) { cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM); - //if (pidsM.Size()) - // uri = cString::sprintf("%s&pids=%s", *uri, *pidsM.ListPids()); debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (rtspM.Play(*uri)) { keepAliveM.Set(timeoutM); @@ -240,6 +239,7 @@ bool cSatipTuner::Disconnect(void) cSatipDiscover::GetInstance()->UseServer(currentServerM, false); statusUpdateM.Set(0); timeoutM = eMinKeepAliveIntervalMs; + pmtPidM = -1; addPidsM.Clear(); delPidsM.Clear(); @@ -391,6 +391,7 @@ bool cSatipTuner::UpdatePids(bool forceP) if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) && !isempty(*streamAddrM) && (streamIdM > 0)) { cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); + bool usexpmt = (SatipConfig.GetCIExtension() && !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkUseXPMT))); bool usedummy = !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkPlayPids)); if (forceP || usedummy) { if (pidsM.Size()) @@ -404,6 +405,13 @@ bool cSatipTuner::UpdatePids(bool forceP) if (delPidsM.Size()) uri = cString::sprintf("%s%sdelpids=%s", *uri, addPidsM.Size() ? "&" : "?", *delPidsM.ListPids()); } + if (usexpmt) { + int pid = deviceM->GetPmtPid(); + // issue TS rerouting only on pid changes + if ((pid > 0) && (pid != pmtPidM)) + uri = cString::sprintf("%s&x_pmt=%d", *uri, pid); + pmtPidM = pid; + } if (!rtspM.Play(*uri)) return false; addPidsM.Clear(); diff --git a/tuner.h b/tuner.h index e5fe551..21dd1b5 100644 --- a/tuner.h +++ b/tuner.h @@ -101,6 +101,7 @@ private: int signalStrengthM; int signalQualityM; int streamIdM; + int pmtPidM; cSatipPid addPidsM; cSatipPid delPidsM; cSatipPid pidsM;