diff options
author | Lars Hanisch <dvb@flensrocker.de> | 2011-04-06 22:28:18 +0200 |
---|---|---|
committer | Lars Hanisch <dvb@flensrocker.de> | 2011-04-06 22:28:18 +0200 |
commit | 90297b1053cdb81be59a69cbee6681d2bbff7bda (patch) | |
tree | f0aa3120e4139e81f277118c533d6aa98f498708 | |
parent | 4d1102780085b25c02cdf4c87a3fe73b67890730 (diff) | |
download | vdr-plugin-dynamite-90297b1053cdb81be59a69cbee6681d2bbff7bda.tar.gz vdr-plugin-dynamite-90297b1053cdb81be59a69cbee6681d2bbff7bda.tar.bz2 |
add new parameter "--free-device-slots"
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | dynamite.c | 33 |
3 files changed, 36 insertions, 5 deletions
@@ -139,3 +139,7 @@ VDR Plugin 'dynamite' Revision History 2011-03-25: Version 0.0.6a - add some OSD functionality + +2011-04-06: Version 0.0.6b + +- add new parameter "--free-device-slots" @@ -194,6 +194,7 @@ Parameters in setup.conf ------------------------ dynamite.DefaultGetTSTimeout = 0 dynamite.GetTSTimeoutHandler = /path/to/program +dynamite.FreeDeviceSlots = 0 Commandline Arguments --------------------- @@ -205,6 +206,9 @@ Commandline Arguments set default GetTS-timeout to n seconds -h, --GetTSTimeoutHandler=/path/to/program set program to be called on GetTS-timeout +-f, --free-device-slots=n + leave n slots free for non-dynamic devices of + incompatible plugins "GetTS" watchdog ---------------- @@ -62,6 +62,7 @@ class cPluginDynamite : public cPlugin { private: cDynamiteDeviceProbe *probe; cString *getTSTimeoutHandler; + int freeDeviceSlots; public: cPluginDynamite(void); virtual ~cPluginDynamite(); @@ -88,6 +89,7 @@ public: cPluginDynamite::cPluginDynamite(void) :probe(NULL) ,getTSTimeoutHandler(NULL) +,freeDeviceSlots(0) { cDynamicDevice::dynamite = this; cDynamicDevice::dvbprobe = new cDynamiteDvbDeviceProbe; @@ -116,8 +118,10 @@ const char *cPluginDynamite::CommandLineHelp(void) " log all udev events to syslog (useful for diagnostics)\n" " --dummy-probe\n" " start dummy-device probe\n" - " --GetTSTimeoutHandler /path/to/program\n" - " set program to be called on GetTS-timeout"; + " --GetTSTimeoutHandler=/path/to/program\n" + " set program to be called on GetTS-timeout\n" + " --free-device-slots=n\n" + " leave n slots free for non-dynamic devices"; } bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) @@ -128,12 +132,13 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) {"dummy-probe", no_argument, 0, 'd'}, {"GetTSTimeout", required_argument, 0, 't'}, {"GetTSTimeoutHandler", required_argument, 0, 'h'}, + {"free-device-slots", required_argument, 0, 'f'}, {0, 0, 0, 0} }; while (true) { int option_index = 0; - int c = getopt_long(argc, argv, "udt:h:", options, &option_index); + int c = getopt_long(argc, argv, "udt:h:f:", options, &option_index); if (c == -1) break; switch (c) { @@ -166,6 +171,17 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) } break; } + case 'f': + { + if ((optarg != NULL) && isnumber(optarg)) { + int tmp = strtol(optarg, NULL, 10); + if ((tmp >= 0) && (tmp < MAXDEVICES)) + freeDeviceSlots = tmp; + else + esyslog("dynamite: \"%d\" free device slots is out of range", tmp); + } + break; + } } } return true; @@ -174,9 +190,9 @@ bool cPluginDynamite::ProcessArgs(int argc, char *argv[]) bool cPluginDynamite::Initialize(void) { // create dynamic devices - if (cDevice::NumDevices() < MAXDEVICES) { + if (cDevice::NumDevices() < (MAXDEVICES - freeDeviceSlots)) { isyslog("dynamite: creating dynamic device slots as much as possible"); - while (cDevice::NumDevices() < MAXDEVICES) + while (cDevice::NumDevices() < (MAXDEVICES - freeDeviceSlots)) new cDynamicDevice; } // look for all dvb devices @@ -263,6 +279,13 @@ bool cPluginDynamite::SetupParse(const char *Name, const char *Value) isyslog("dynamite: installing GetTS-Timeout-Handler %s", **getTSTimeoutHandler); } } + else if (strcasecmp(Name, "FreeDeviceSlots") == 0) { + int tmp = strtol(Value, NULL, 10); + if ((tmp >= 0) && (tmp < MAXDEVICES)) + freeDeviceSlots = tmp; + else + esyslog("dynamite: \"%d\" free device slots is out of range", tmp); + } else return false; return true; |