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

Added a compile-time option to split any mixed model server into several single ones.

This commit is contained in:
Rolf Ahrenberg 2015-01-13 21:24:31 +02:00
parent 21261f8042
commit bcb11b6257
3 changed files with 35 additions and 1 deletions

View File

@ -14,6 +14,10 @@
#SATIP_XCI = 1 #SATIP_XCI = 1
# Split any mixed model server into several single ones
#SATIP_USE_SINGLE_MODEL_SERVERS_ONLY = 1
# Strip debug symbols? Set eg. to /bin/true if not # Strip debug symbols? Set eg. to /bin/true if not
STRIP = strip STRIP = strip
@ -91,6 +95,12 @@ DEFINES += -DXCI
endif endif
endif endif
ifdef SATIP_USE_SINGLE_MODEL_SERVERS_ONLY
ifeq ($(SATIP_USE_SINGLE_MODEL_SERVERS_ONLY),1)
DEFINES += -DUSE_SINGLE_MODEL_SERVERS_ONLY
endif
endif
ifneq ($(strip $(GITTAG)),) ifneq ($(strip $(GITTAG)),)
DEFINES += -DGITVERSION='"-GIT-$(GITTAG)"' DEFINES += -DGITVERSION='"-GIT-$(GITTAG)"'
endif endif

View File

@ -233,6 +233,23 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
{ {
debug1("%s (%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP); debug1("%s (%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP);
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
#ifdef USE_SINGLE_MODEL_SERVERS_ONLY
int n = 0;
char *s, *p = (char *)modelP;
char *r = strtok_r(p, ",", &s);
while (r) {
r = skipspace(r);
cString desc = cString::sprintf("%s #%d", descP, n++);
cSatipServer *tmp = new cSatipServer(addrP, r, desc);
if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
serversM.Add(tmp);
}
else
DELETENULL(tmp);
r = strtok_r(NULL, ",\n", &s);
}
#else
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP); cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
// Validate against existing servers // Validate against existing servers
if (!serversM.Update(tmp)) { if (!serversM.Update(tmp)) {
@ -241,6 +258,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
} }
else else
DELETENULL(tmp); DELETENULL(tmp);
#endif
} }
int cSatipDiscover::GetServerCount(void) int cSatipDiscover::GetServerCount(void)

View File

@ -99,7 +99,13 @@ cSatipServer::~cSatipServer()
int cSatipServer::Compare(const cListObject &listObjectP) const int cSatipServer::Compare(const cListObject &listObjectP) const
{ {
const cSatipServer *s = (const cSatipServer *)&listObjectP; const cSatipServer *s = (const cSatipServer *)&listObjectP;
return strcasecmp(*addressM, *s->addressM); int result = strcasecmp(*addressM, *s->addressM);
if (!result) {
result = strcasecmp(*modelM, *s->modelM);
if (!result)
result = strcasecmp(*descriptionM, *s->descriptionM);
}
return result;
} }
void cSatipServer::Use(bool onOffP) void cSatipServer::Use(bool onOffP)