diff --git a/README b/README index 99b3bdc..0bff7a9 100644 --- a/README +++ b/README @@ -52,9 +52,9 @@ separated list of "||" entries. The model consists of a DVB system (DVBS2,DVBT2,DVBT,DVBC) and number of available frontends separated by a hyphen: -vdr -P 'satip -s [:]|[:]|;...' +vdr -P 'satip -s [:]|[:]|[:];...' vdr -P 'satip -s 192.168.0.1|DVBS2-2,DVBT2-2|OctopusNet' -vdr -P 'satip -s 192.168.0.1|DVBS2-4|OctopusNet;192.168.0.2|DVBT2-4|minisatip' +vdr -P 'satip -s 192.168.0.1|DVBS2-4|OctopusNet;192.168.0.2|DVBT2-4|minisatip:0x18' vdr -P 'satip -s 192.168.0.1:554|DVBS2-2:S19.2E|OctopusNet;192.168.0.2:8554|DVBS2-4:S19.2E,S1W|minisatip' The plugin accepts a "--portrange" (-p) command-line parameter, that can diff --git a/discover.c b/discover.c index 6ba16b2..7c128a8 100644 --- a/discover.c +++ b/discover.c @@ -32,7 +32,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP) if (instanceS) { if (serversP) { for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s)) - instanceS->AddServer(s->IpAddress(), s->IpPort(), s->Model(), s->Filters(), s->Description()); + instanceS->AddServer(s->IpAddress(), s->IpPort(), s->Model(), s->Filters(), s->Description(), s->Quirk()); } else instanceS->Activate(); @@ -271,12 +271,12 @@ void cSatipDiscover::ParseDeviceInfo(const char *addrP, const int portP) model = modelNode.text().as_string("DVBS2-1"); } #endif - AddServer(addrP, portP, model, NULL, desc); + AddServer(addrP, portP, model, NULL, desc, cSatipServer::eSatipQuirkNone); } -void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *modelP, const char *filtersP, const char *descP) +void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *modelP, const char *filtersP, const char *descP, const int quirkP) { - debug1("%s (%s, %d, %s, %s, %s)", __PRETTY_FUNCTION__, addrP, portP, modelP, filtersP, descP); + debug1("%s (%s, %d, %s, %s, %s, %d)", __PRETTY_FUNCTION__, addrP, portP, modelP, filtersP, descP, quirkP); cMutexLock MutexLock(&mutexM); if (SatipConfig.GetUseSingleModelServers() && modelP && !isempty(modelP)) { int n = 0; @@ -285,7 +285,7 @@ void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *m while (r) { r = skipspace(r); cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++); - cSatipServer *tmp = new cSatipServer(addrP, portP, r, filtersP, desc); + cSatipServer *tmp = new cSatipServer(addrP, portP, r, filtersP, desc, quirkP); if (!serversM.Update(tmp)) { info("Adding server '%s|%s|%s' Filters: %s CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), !isempty(tmp->Filters()) ? tmp->Filters() : "none", tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none"); serversM.Add(tmp); @@ -297,7 +297,7 @@ void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *m FREE_POINTER(p); } else { - cSatipServer *tmp = new cSatipServer(addrP, portP, modelP, filtersP, descP); + cSatipServer *tmp = new cSatipServer(addrP, portP, modelP, filtersP, descP, quirkP); if (!serversM.Update(tmp)) { info("Adding server '%s|%s|%s' Filters: %s CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), !isempty(tmp->Filters()) ? tmp->Filters() : "none", tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none"); serversM.Add(tmp); diff --git a/discover.h b/discover.h index 7c1148c..52c3d30 100644 --- a/discover.h +++ b/discover.h @@ -22,16 +22,18 @@ class cSatipDiscoverServer : public cListObject { private: int ipPortM; + int quirkM; cString ipAddressM; cString descriptionM; cString modelM; cString filtersM; public: - cSatipDiscoverServer(const char *ipAddressP, const int ipPortP, const char *modelP, const char *filtersP, const char *descriptionP) + cSatipDiscoverServer(const char *ipAddressP, const int ipPortP, const char *modelP, const char *filtersP, const char *descriptionP, const int quirkP) { - ipAddressM = ipAddressP; ipPortM = ipPortP; modelM = modelP; filtersM = filtersP; descriptionM = descriptionP; + ipAddressM = ipAddressP; ipPortM = ipPortP; modelM = modelP; filtersM = filtersP; descriptionM = descriptionP; quirkM = quirkP; } int IpPort(void) { return ipPortM; } + int Quirk(void) { return quirkM; } const char *IpAddress(void) { return *ipAddressM; } const char *Model(void) { return *modelM; } const char *Filters(void) { return *filtersM; } @@ -67,7 +69,7 @@ private: void Deactivate(void); int ParseRtspPort(void); void ParseDeviceInfo(const char *addrP, const int portP); - void AddServer(const char *addrP, const int portP, const char *modelP, const char *filtersP, const char *descP); + void AddServer(const char *addrP, const int portP, const char *modelP, const char *filtersP, const char *descP, const int quirkP); void Fetch(const char *urlP); // constructor cSatipDiscover(); diff --git a/satip.c b/satip.c index 8aab64d..78192b6 100644 --- a/satip.c +++ b/satip.c @@ -84,11 +84,11 @@ const char *cPluginSatip::CommandLineHelp(void) // Return a string that describes all known command line options. return " -d , --devices= set number of devices to be created\n" " -t , --trace= set the tracing mode\n" - " -s ||, --server=||;:|:|\n" + " -s ||, --server=||;:|:|:\n" " define hard-coded SAT>IP server(s)\n" " -D, --detach set the detached mode on\n" " -S, --single set the single model server mode on\n" - " -n, --noquirks disable all the server quirks\n" + " -n, --noquirks disable autodetection of the server quirks\n" " -p, --portrange=- set a range of ports used for the RT[C]P server\n" " a minimum of 2 ports per device is required.\n"; } @@ -233,6 +233,7 @@ void cPluginSatip::ParseServer(const char *paramP) r = skipspace(r); debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r); cString serverAddr, serverModel, serverFilters, serverDescription; + int serverQuirk = cSatipServer::eSatipQuirkNone; int serverPort = SATIP_DEFAULT_RTSP_PORT; int n2 = 0; char *s2, *p2 = r; @@ -261,7 +262,14 @@ void cPluginSatip::ParseServer(const char *paramP) } break; case 2: + { serverDescription = r2; + char *r3 = strchr(r2, ':'); + if (r3) { + serverQuirk = strtol(r3 + 1, NULL, 0); + serverDescription = serverDescription.Truncate(r3 - r2); + } + } break; default: break; @@ -269,10 +277,10 @@ void cPluginSatip::ParseServer(const char *paramP) r2 = strtok_r(NULL, "|", &s2); } if (*serverAddr && *serverModel && *serverDescription) { - debug1("%s ipaddr=%s port=%d model=%s (%s) desc=%s", __PRETTY_FUNCTION__, *serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription); + debug1("%s ipaddr=%s port=%d model=%s (%s) desc=%s (%d)", __PRETTY_FUNCTION__, *serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription, serverQuirk); if (!serversM) serversM = new cSatipDiscoverServers(); - serversM->Add(new cSatipDiscoverServer(*serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription)); + serversM->Add(new cSatipDiscoverServer(*serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription, serverQuirk)); } ++n; r = strtok_r(NULL, ";", &s); diff --git a/server.c b/server.c index c936752..bfaeef4 100644 --- a/server.c +++ b/server.c @@ -80,14 +80,14 @@ bool cSatipFrontends::Detach(int deviceIdP, int transponderP) // --- cSatipServer ----------------------------------------------------------- -cSatipServer::cSatipServer(const char *addressP, const int portP, const char *modelP, const char *filtersP, const char *descriptionP) +cSatipServer::cSatipServer(const char *addressP, const int portP, const char *modelP, const char *filtersP, const char *descriptionP, const int quirkP) : addressM((addressP && *addressP) ? addressP : "0.0.0.0"), modelM((modelP && *modelP) ? modelP : "DVBS-1"), filtersM((filtersP && *filtersP) ? filtersP : ""), descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"), quirksM(""), portM(portP), - quirkM(eSatipQuirkNone), + quirkM(quirkP), hasCiM(false), activeM(true), createdM(time(NULL)), @@ -119,48 +119,48 @@ cSatipServer::cSatipServer(const char *addressP, const int portP, const char *mo if (strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400 strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1 strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400 - ) { + ) quirkM |= eSatipQuirkSessionId; - quirksM = cString::sprintf("%s%sSessionId", *quirksM, isempty(*quirksM) ? "" : ","); - } // These devices contain support for RTP over TCP: if (strstr(*descriptionM, "minisatip") || // minisatip server strstr(*descriptionM, "DVBViewer") || // DVBViewer Media Server strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400 strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1 strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400 - ) { + ) quirkM |= eSatipQuirkRtpOverTcp; - quirksM = cString::sprintf("%s%sRtpOverTcp", *quirksM, isempty(*quirksM) ? "" : ","); - } // These devices contain a play (add/delpids) parameter bug: if (strstr(*descriptionM, "fritzdvbc") // Fritz!WLAN Repeater DVB-C - ) { + ) quirkM |= eSatipQuirkPlayPids; - quirksM = cString::sprintf("%s%sPlayPids", *quirksM, isempty(*quirksM) ? "" : ","); - } // These devices contain a frontend locking bug: if (strstr(*descriptionM, "fritzdvbc") || // Fritz!WLAN Repeater DVB-C strstr(*descriptionM, "Schwaiger Sat>IP Server") // Schwaiger MS41IP - ) { + ) quirkM |= eSatipQuirkForceLock; - quirksM = cString::sprintf("%s%sForceLock", *quirksM, isempty(*quirksM) ? "" : ","); - } // These devices support the X_PMT protocol extension if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet strstr(*descriptionM, "minisatip") // minisatip server - ) { + ) quirkM |= eSatipQuirkCiXpmt; - quirksM = cString::sprintf("%s%sCiXpmt", *quirksM, isempty(*quirksM) ? "" : ","); - } // These devices support the TNR protocol extension if (strstr(*descriptionM, "DVBViewer") // DVBViewer Media Server - ) { + ) quirkM |= eSatipQuirkCiTnr; - quirksM = cString::sprintf("%s%sCiTnr", *quirksM, isempty(*quirksM) ? "" : ","); - } - debug3("%s description=%s quirks=%s", __PRETTY_FUNCTION__, *descriptionM, *quirksM); } + if ((quirkM & eSatipQuirkMask) & eSatipQuirkSessionId) + quirksM = cString::sprintf("%s%sSessionId", *quirksM, isempty(*quirksM) ? "" : ","); + if ((quirkM & eSatipQuirkMask) & eSatipQuirkPlayPids) + quirksM = cString::sprintf("%s%sPlayPids", *quirksM, isempty(*quirksM) ? "" : ","); + if ((quirkM & eSatipQuirkMask) & eSatipQuirkForceLock) + quirksM = cString::sprintf("%s%sForceLock", *quirksM, isempty(*quirksM) ? "" : ","); + if ((quirkM & eSatipQuirkMask) & eSatipQuirkRtpOverTcp) + quirksM = cString::sprintf("%s%sRtpOverTcp", *quirksM, isempty(*quirksM) ? "" : ","); + if ((quirkM & eSatipQuirkMask) & eSatipQuirkCiXpmt) + quirksM = cString::sprintf("%s%sCiXpmt", *quirksM, isempty(*quirksM) ? "" : ","); + if ((quirkM & eSatipQuirkMask) & eSatipQuirkCiTnr) + quirksM = cString::sprintf("%s%sCiTnr", *quirksM, isempty(*quirksM) ? "" : ","); + debug3("%s description=%s quirks=%s", __PRETTY_FUNCTION__, *descriptionM, *quirksM); // These devices support external CI if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet strstr(*descriptionM, "minisatip") || // minisatip server diff --git a/server.h b/server.h index 1956013..1ce46e3 100644 --- a/server.h +++ b/server.h @@ -83,7 +83,7 @@ public: eSatipQuirkCiTnr = 0x20, eSatipQuirkMask = 0xFF }; - cSatipServer(const char *addressP, const int portP, const char *modelP, const char *filtersP, const char *descriptionP); + cSatipServer(const char *addressP, const int portP, const char *modelP, const char *filtersP, const char *descriptionP, const int quirkP); virtual ~cSatipServer(); virtual int Compare(const cListObject &listObjectP) const; bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP);