mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Changed SATIP_USE_SINGLE_MODEL_SERVERS_ONLY into a command-line switch.
This commit is contained in:
parent
fb7a7fe3a2
commit
c9abfddf11
4
Makefile
4
Makefile
@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
#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
|
||||||
|
3
config.c
3
config.c
@ -16,7 +16,8 @@ cSatipConfig::cSatipConfig(void)
|
|||||||
traceModeM(eTraceModeNormal),
|
traceModeM(eTraceModeNormal),
|
||||||
ciExtensionM(0),
|
ciExtensionM(0),
|
||||||
eitScanM(1),
|
eitScanM(1),
|
||||||
useBytesM(1)
|
useBytesM(1),
|
||||||
|
useSingleModelServersM(false)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < ELEMENTS(cicamsM); ++i)
|
for (unsigned int i = 0; i < ELEMENTS(cicamsM); ++i)
|
||||||
cicamsM[i] = 0;
|
cicamsM[i] = 0;
|
||||||
|
3
config.h
3
config.h
@ -19,6 +19,7 @@ private:
|
|||||||
unsigned int ciExtensionM;
|
unsigned int ciExtensionM;
|
||||||
unsigned int eitScanM;
|
unsigned int eitScanM;
|
||||||
unsigned int useBytesM;
|
unsigned int useBytesM;
|
||||||
|
bool useSingleModelServersM;
|
||||||
int cicamsM[MAX_CICAM_COUNT];
|
int cicamsM[MAX_CICAM_COUNT];
|
||||||
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
|
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
|
||||||
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
|
int disabledFiltersM[SECTION_FILTER_TABLE_SIZE];
|
||||||
@ -64,6 +65,7 @@ public:
|
|||||||
int GetCICAM(unsigned int indexP) const;
|
int GetCICAM(unsigned int indexP) const;
|
||||||
unsigned int GetEITScan(void) const { return eitScanM; }
|
unsigned int GetEITScan(void) const { return eitScanM; }
|
||||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||||
|
bool GetUseSingleModelServers(void) const { return useSingleModelServersM; }
|
||||||
unsigned int GetDisabledSourcesCount(void) const;
|
unsigned int GetDisabledSourcesCount(void) const;
|
||||||
int GetDisabledSources(unsigned int indexP) const;
|
int GetDisabledSources(unsigned int indexP) const;
|
||||||
unsigned int GetDisabledFiltersCount(void) const;
|
unsigned int GetDisabledFiltersCount(void) const;
|
||||||
@ -75,6 +77,7 @@ public:
|
|||||||
void SetCICAM(unsigned int indexP, int cicamP);
|
void SetCICAM(unsigned int indexP, int cicamP);
|
||||||
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
|
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
|
||||||
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
|
||||||
|
void SetUseSingleModelServers(bool onOffP) { useSingleModelServersM = onOffP; }
|
||||||
void SetDisabledSources(unsigned int indexP, int sourceP);
|
void SetDisabledSources(unsigned int indexP, int sourceP);
|
||||||
void SetDisabledFilters(unsigned int indexP, int numberP);
|
void SetDisabledFilters(unsigned int indexP, int numberP);
|
||||||
};
|
};
|
||||||
|
50
discover.c
50
discover.c
@ -233,33 +233,33 @@ 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
|
if (SatipConfig.GetUseSingleModelServers()) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char *s, *p = strdup(modelP);
|
char *s, *p = strdup(modelP);
|
||||||
char *r = strtok_r(p, ",", &s);
|
char *r = strtok_r(p, ",", &s);
|
||||||
while (r) {
|
while (r) {
|
||||||
r = skipspace(r);
|
r = skipspace(r);
|
||||||
cString desc = cString::sprintf("%s #%d", descP, n++);
|
cString desc = cString::sprintf("%s #%d", descP, n++);
|
||||||
cSatipServer *tmp = new cSatipServer(addrP, r, desc);
|
cSatipServer *tmp = new cSatipServer(addrP, r, desc);
|
||||||
if (!serversM.Update(tmp)) {
|
if (!serversM.Update(tmp)) {
|
||||||
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
|
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
|
||||||
serversM.Add(tmp);
|
serversM.Add(tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DELETENULL(tmp);
|
||||||
|
r = strtok_r(NULL, ",\n", &s);
|
||||||
}
|
}
|
||||||
else
|
FREE_POINTER(p);
|
||||||
DELETENULL(tmp);
|
}
|
||||||
r = strtok_r(NULL, ",\n", &s);
|
else {
|
||||||
}
|
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
|
||||||
FREE_POINTER(p);
|
if (!serversM.Update(tmp)) {
|
||||||
#else
|
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
|
||||||
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
|
serversM.Add(tmp);
|
||||||
// Validate against existing servers
|
}
|
||||||
if (!serversM.Update(tmp)) {
|
else
|
||||||
info("Adding server '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
|
DELETENULL(tmp);
|
||||||
serversM.Add(tmp);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
DELETENULL(tmp);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipDiscover::GetServerCount(void)
|
int cSatipDiscover::GetServerCount(void)
|
||||||
|
9
satip.c
9
satip.c
@ -84,7 +84,8 @@ const char *cPluginSatip::CommandLineHelp(void)
|
|||||||
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>|<model2>|<desc2>\n"
|
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
|
||||||
" define hard-coded SAT>IP server(s)\n";
|
" define hard-coded SAT>IP server(s)"
|
||||||
|
" -S, --single set the single model server mode on/off\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||||
@ -95,11 +96,12 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
|||||||
{ "devices", required_argument, NULL, 'd' },
|
{ "devices", required_argument, NULL, 'd' },
|
||||||
{ "trace", required_argument, NULL, 't' },
|
{ "trace", required_argument, NULL, 't' },
|
||||||
{ "server", required_argument, NULL, 's' },
|
{ "server", required_argument, NULL, 's' },
|
||||||
|
{ "single", no_argument, NULL, 'S' },
|
||||||
{ NULL, no_argument, NULL, 0 }
|
{ NULL, no_argument, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt_long(argc, argv, "d:t:s:", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "d:t:s:S", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
deviceCountM = strtol(optarg, NULL, 0);
|
deviceCountM = strtol(optarg, NULL, 0);
|
||||||
@ -110,6 +112,9 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
ParseServer(optarg);
|
ParseServer(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
SatipConfig.SetUseSingleModelServers(true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user