1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Add command-line support for setting server quirks.

This commit is contained in:
Rolf Ahrenberg 2016-10-09 18:53:40 +03:00
parent e7c9b04ad2
commit 94b7f1132f
6 changed files with 47 additions and 37 deletions

4
README
View File

@ -52,9 +52,9 @@ separated list of "<ipaddress>|<model>|<description>" entries. The model
consists of a DVB system (DVBS2,DVBT2,DVBT,DVBC) and number of available consists of a DVB system (DVBS2,DVBT2,DVBT,DVBC) and number of available
frontends separated by a hyphen: frontends separated by a hyphen:
vdr -P 'satip -s <ipaddress>[:<port>]|<model>[:<filter>]|<description>;...' vdr -P 'satip -s <ipaddress>[:<port>]|<model>[:<filter>]|<description>[:<quirk>];...'
vdr -P 'satip -s 192.168.0.1|DVBS2-2,DVBT2-2|OctopusNet' 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' 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 The plugin accepts a "--portrange" (-p) command-line parameter, that can

View File

@ -32,7 +32,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
if (instanceS) { if (instanceS) {
if (serversP) { if (serversP) {
for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s)) 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 else
instanceS->Activate(); instanceS->Activate();
@ -271,12 +271,12 @@ void cSatipDiscover::ParseDeviceInfo(const char *addrP, const int portP)
model = modelNode.text().as_string("DVBS2-1"); model = modelNode.text().as_string("DVBS2-1");
} }
#endif #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); cMutexLock MutexLock(&mutexM);
if (SatipConfig.GetUseSingleModelServers() && modelP && !isempty(modelP)) { if (SatipConfig.GetUseSingleModelServers() && modelP && !isempty(modelP)) {
int n = 0; int n = 0;
@ -285,7 +285,7 @@ void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *m
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++); 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)) { 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"); 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); serversM.Add(tmp);
@ -297,7 +297,7 @@ void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *m
FREE_POINTER(p); FREE_POINTER(p);
} }
else { else {
cSatipServer *tmp = new cSatipServer(addrP, portP, modelP, filtersP, descP); cSatipServer *tmp = new cSatipServer(addrP, portP, modelP, filtersP, descP, quirkP);
if (!serversM.Update(tmp)) { 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"); 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); serversM.Add(tmp);

View File

@ -22,16 +22,18 @@
class cSatipDiscoverServer : public cListObject { class cSatipDiscoverServer : public cListObject {
private: private:
int ipPortM; int ipPortM;
int quirkM;
cString ipAddressM; cString ipAddressM;
cString descriptionM; cString descriptionM;
cString modelM; cString modelM;
cString filtersM; cString filtersM;
public: 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 IpPort(void) { return ipPortM; }
int Quirk(void) { return quirkM; }
const char *IpAddress(void) { return *ipAddressM; } const char *IpAddress(void) { return *ipAddressM; }
const char *Model(void) { return *modelM; } const char *Model(void) { return *modelM; }
const char *Filters(void) { return *filtersM; } const char *Filters(void) { return *filtersM; }
@ -67,7 +69,7 @@ private:
void Deactivate(void); void Deactivate(void);
int ParseRtspPort(void); int ParseRtspPort(void);
void ParseDeviceInfo(const char *addrP, const int portP); 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); void Fetch(const char *urlP);
// constructor // constructor
cSatipDiscover(); cSatipDiscover();

16
satip.c
View File

@ -84,11 +84,11 @@ const char *cPluginSatip::CommandLineHelp(void)
// Return a string that describes all known command line options. // Return a string that describes all known command line options.
return " -d <num>, --devices=<number> set number of devices to be created\n" return " -d <num>, --devices=<number> set number of devices to be created\n"
" -t <mode>, --trace=<mode> set the tracing mode\n" " -t <mode>, --trace=<mode> set the tracing mode\n"
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>:<port>|<model2>:<filter>|<desc2>\n" " -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>:<port>|<model2>:<filter>|<desc2>:<quirk>\n"
" define hard-coded SAT>IP server(s)\n" " define hard-coded SAT>IP server(s)\n"
" -D, --detach set the detached mode on\n" " -D, --detach set the detached mode on\n"
" -S, --single set the single model server 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=<start>-<end> set a range of ports used for the RT[C]P server\n" " -p, --portrange=<start>-<end> set a range of ports used for the RT[C]P server\n"
" a minimum of 2 ports per device is required.\n"; " a minimum of 2 ports per device is required.\n";
} }
@ -233,6 +233,7 @@ void cPluginSatip::ParseServer(const char *paramP)
r = skipspace(r); r = skipspace(r);
debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r); debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r);
cString serverAddr, serverModel, serverFilters, serverDescription; cString serverAddr, serverModel, serverFilters, serverDescription;
int serverQuirk = cSatipServer::eSatipQuirkNone;
int serverPort = SATIP_DEFAULT_RTSP_PORT; int serverPort = SATIP_DEFAULT_RTSP_PORT;
int n2 = 0; int n2 = 0;
char *s2, *p2 = r; char *s2, *p2 = r;
@ -261,7 +262,14 @@ void cPluginSatip::ParseServer(const char *paramP)
} }
break; break;
case 2: case 2:
{
serverDescription = r2; serverDescription = r2;
char *r3 = strchr(r2, ':');
if (r3) {
serverQuirk = strtol(r3 + 1, NULL, 0);
serverDescription = serverDescription.Truncate(r3 - r2);
}
}
break; break;
default: default:
break; break;
@ -269,10 +277,10 @@ void cPluginSatip::ParseServer(const char *paramP)
r2 = strtok_r(NULL, "|", &s2); r2 = strtok_r(NULL, "|", &s2);
} }
if (*serverAddr && *serverModel && *serverDescription) { 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) if (!serversM)
serversM = new cSatipDiscoverServers(); serversM = new cSatipDiscoverServers();
serversM->Add(new cSatipDiscoverServer(*serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription)); serversM->Add(new cSatipDiscoverServer(*serverAddr, serverPort, *serverModel, *serverFilters, *serverDescription, serverQuirk));
} }
++n; ++n;
r = strtok_r(NULL, ";", &s); r = strtok_r(NULL, ";", &s);

View File

@ -80,14 +80,14 @@ bool cSatipFrontends::Detach(int deviceIdP, int transponderP)
// --- cSatipServer ----------------------------------------------------------- // --- 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"), : addressM((addressP && *addressP) ? addressP : "0.0.0.0"),
modelM((modelP && *modelP) ? modelP : "DVBS-1"), modelM((modelP && *modelP) ? modelP : "DVBS-1"),
filtersM((filtersP && *filtersP) ? filtersP : ""), filtersM((filtersP && *filtersP) ? filtersP : ""),
descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"), descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"),
quirksM(""), quirksM(""),
portM(portP), portM(portP),
quirkM(eSatipQuirkNone), quirkM(quirkP),
hasCiM(false), hasCiM(false),
activeM(true), activeM(true),
createdM(time(NULL)), 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 if (strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400
strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1 strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1
strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400 strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400
) { )
quirkM |= eSatipQuirkSessionId; quirkM |= eSatipQuirkSessionId;
quirksM = cString::sprintf("%s%sSessionId", *quirksM, isempty(*quirksM) ? "" : ",");
}
// These devices contain support for RTP over TCP: // These devices contain support for RTP over TCP:
if (strstr(*descriptionM, "minisatip") || // minisatip server if (strstr(*descriptionM, "minisatip") || // minisatip server
strstr(*descriptionM, "DVBViewer") || // DVBViewer Media Server strstr(*descriptionM, "DVBViewer") || // DVBViewer Media Server
strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400 strstr(*descriptionM, "GSSBOX") || // Grundig Sat Systems GSS.box DSI 400
strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1 strstr(*descriptionM, "DIGIBIT") || // Telestar Digibit R1
strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400 strstr(*descriptionM, "Triax SatIP Converter") // Triax TSS 400
) { )
quirkM |= eSatipQuirkRtpOverTcp; quirkM |= eSatipQuirkRtpOverTcp;
quirksM = cString::sprintf("%s%sRtpOverTcp", *quirksM, isempty(*quirksM) ? "" : ",");
}
// These devices contain a play (add/delpids) parameter bug: // These devices contain a play (add/delpids) parameter bug:
if (strstr(*descriptionM, "fritzdvbc") // Fritz!WLAN Repeater DVB-C if (strstr(*descriptionM, "fritzdvbc") // Fritz!WLAN Repeater DVB-C
) { )
quirkM |= eSatipQuirkPlayPids; quirkM |= eSatipQuirkPlayPids;
quirksM = cString::sprintf("%s%sPlayPids", *quirksM, isempty(*quirksM) ? "" : ",");
}
// These devices contain a frontend locking bug: // These devices contain a frontend locking bug:
if (strstr(*descriptionM, "fritzdvbc") || // Fritz!WLAN Repeater DVB-C if (strstr(*descriptionM, "fritzdvbc") || // Fritz!WLAN Repeater DVB-C
strstr(*descriptionM, "Schwaiger Sat>IP Server") // Schwaiger MS41IP strstr(*descriptionM, "Schwaiger Sat>IP Server") // Schwaiger MS41IP
) { )
quirkM |= eSatipQuirkForceLock; quirkM |= eSatipQuirkForceLock;
quirksM = cString::sprintf("%s%sForceLock", *quirksM, isempty(*quirksM) ? "" : ",");
}
// These devices support the X_PMT protocol extension // These devices support the X_PMT protocol extension
if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet
strstr(*descriptionM, "minisatip") // minisatip server strstr(*descriptionM, "minisatip") // minisatip server
) { )
quirkM |= eSatipQuirkCiXpmt; quirkM |= eSatipQuirkCiXpmt;
quirksM = cString::sprintf("%s%sCiXpmt", *quirksM, isempty(*quirksM) ? "" : ",");
}
// These devices support the TNR protocol extension // These devices support the TNR protocol extension
if (strstr(*descriptionM, "DVBViewer") // DVBViewer Media Server if (strstr(*descriptionM, "DVBViewer") // DVBViewer Media Server
) { )
quirkM |= eSatipQuirkCiTnr; 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 // These devices support external CI
if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet if (strstr(*descriptionM, "OctopusNet") || // Digital Devices OctopusNet
strstr(*descriptionM, "minisatip") || // minisatip server strstr(*descriptionM, "minisatip") || // minisatip server

View File

@ -83,7 +83,7 @@ public:
eSatipQuirkCiTnr = 0x20, eSatipQuirkCiTnr = 0x20,
eSatipQuirkMask = 0xFF 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 ~cSatipServer();
virtual int Compare(const cListObject &listObjectP) const; virtual int Compare(const cListObject &listObjectP) const;
bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP); bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP);