From edacac5f91713ff996853c0de665ff3c237eaf8a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 24 Feb 2001 14:03:39 +0100 Subject: Implemented PrimaryLimit setup parameter --- HISTORY | 3 +++ MANUAL | 9 +++++++++ config.c | 5 ++++- config.h | 3 ++- dvbapi.c | 20 ++++++++++++++++---- i18n.c | 7 ++++++- menu.c | 5 +++-- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/HISTORY b/HISTORY index cb1d0e32..2451edf1 100644 --- a/HISTORY +++ b/HISTORY @@ -404,3 +404,6 @@ Video Disk Recorder Revision History - Fixed an occasional segfault in the EIT processor. - A value of '0' for the EPGScanTimeout setup parameter now completely turns off scanning for EPG data on both single and multiple card systems. +- New setup parameter "PrimaryLimit" that allows to prevent timers from using the + primary DVB interface in multi card systems. Default value is 0, which means + that every timer may use the primary interface. diff --git a/MANUAL b/MANUAL index 009f8de1..f77bd276 100644 --- a/MANUAL +++ b/MANUAL @@ -333,6 +333,15 @@ Video Disk Recorder User's Manual connection after which the connection is automatically closed. Default is 300, a value of 0 means no timeout. + PrimaryLimit = 0 The minimum priority a timer must have to be allowed to + use the primary DVB interface, or to force another timer + with higher priority to use the primary DVB interface. + This is mainly useful for recordings that should take + place only when there is nothing else to do, but should + never keep the user from viewing stuff on the primary + interface. On systems with only one DVB card, timers + with a priority below PrimaryLimit will never execute. + * Executing system commands The "Main" menu option "Commands" allows you to execute any system commands diff --git a/config.c b/config.c index 21d8c581..66eb1780 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.42 2001/02/18 13:11:59 kls Exp $ + * $Id: config.c 1.43 2001/02/24 13:20:18 kls Exp $ */ #include "config.h" @@ -739,6 +739,7 @@ cSetup::cSetup(void) MarginStop = 10; EPGScanTimeout = 5; SVDRPTimeout = 300; + PrimaryLimit = 0; CurrentChannel = -1; } @@ -760,6 +761,7 @@ bool cSetup::Parse(char *s) else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value); else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value); else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value); + else if (!strcasecmp(Name, "PrimaryLimit")) PrimaryLimit = atoi(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else return false; @@ -814,6 +816,7 @@ bool cSetup::Save(const char *FileName) fprintf(f, "MarginStop = %d\n", MarginStop); fprintf(f, "EPGScanTimeout = %d\n", EPGScanTimeout); fprintf(f, "SVDRPTimeout = %d\n", SVDRPTimeout); + fprintf(f, "PrimaryLimit = %d\n", PrimaryLimit); fprintf(f, "CurrentChannel = %d\n", CurrentChannel); f.Close(); isyslog(LOG_INFO, "saved setup to %s", FileName); diff --git a/config.h b/config.h index 963bcae3..60a95c3a 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.41 2001/02/18 13:12:06 kls Exp $ + * $Id: config.h 1.42 2001/02/24 13:19:39 kls Exp $ */ #ifndef __CONFIG_H @@ -270,6 +270,7 @@ public: int MarginStart, MarginStop; int EPGScanTimeout; int SVDRPTimeout; + int PrimaryLimit; int CurrentChannel; cSetup(void); bool Load(const char *FileName); diff --git a/dvbapi.c b/dvbapi.c index 15b5f357..8518d7f9 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.60 2001/02/24 12:18:30 kls Exp $ + * $Id: dvbapi.c 1.61 2001/02/24 13:13:19 kls Exp $ */ #include "dvbapi.h" @@ -1609,7 +1609,7 @@ bool cDvbApi::SetPrimaryDvbApi(int n) cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority) { - cDvbApi *d = NULL; + cDvbApi *d = NULL, *dMinPriority = NULL; int index = Ca - 1; for (int i = MAXDVBAPI; --i >= 0; ) { if (dvbApi[i]) { @@ -1619,13 +1619,25 @@ cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority) } else if (Ca == 0) { // means any device would be acceptable if (!d || !dvbApi[i]->Recording() || (d->Recording() && d->Priority() > dvbApi[i]->Priority())) - d = dvbApi[i]; + d = dvbApi[i]; // this is one that is either not currently recording or has the lowest priority if (d && d != PrimaryDvbApi && !d->Recording()) // avoids the PrimaryDvbApi if possible break; + if (d && d->Recording() && d->Priority() < Setup.PrimaryLimit && (!dMinPriority || d->Priority() < dMinPriority->Priority())) + dMinPriority = d; // this is the one with the lowest priority below Setup.PrimaryLimit } } } - return (d && (!d->Recording() || d->Priority() < Priority || (!d->Ca() && Ca))) ? d : NULL; + if (d == PrimaryDvbApi) { // the PrimaryDvbApi was the only one that was free + if (Priority < Setup.PrimaryLimit) + return NULL; // not enough priority to use the PrimaryDvbApi + if (dMinPriority) // there's one that must not use the PrimaryDvbApi... + d = dMinPriority; // ...so let's kick out that one + } + return (d // we found one... + && (!d->Recording() // ...that's either not currently recording... + || d->Priority() < Priority // ...or has a lower priority... + || (!d->Ca() && Ca))) // ...or doesn't need this card + ? d : NULL; } int cDvbApi::Index(void) diff --git a/i18n.c b/i18n.c index 89915264..f81a2029 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.13 2001/02/18 13:14:00 kls Exp $ + * $Id: i18n.c 1.14 2001/02/24 13:57:14 kls Exp $ * * Slovenian translations provided by Miha Setina * Italian translations provided by Alberto Carraro @@ -421,6 +421,11 @@ const tPhrase Phrases[] = { "", // TODO "Timeout SVDRP", }, + { "PrimaryLimit", + "Primär-Limit", + "", // TODO + "", // TODO + }, // The days of the week: { "MTWTFSS", "MDMDFSS", diff --git a/menu.c b/menu.c index 37c1a16c..651ae70c 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.66 2001/02/18 13:12:32 kls Exp $ + * $Id: menu.c 1.67 2001/02/24 14:03:39 kls Exp $ */ #include "menu.h" @@ -1609,6 +1609,7 @@ void cMenuSetup::Set(void) Add(new cMenuEditIntItem( tr("MarginStop"), &data.MarginStop)); Add(new cMenuEditIntItem( tr("EPGScanTimeout"), &data.EPGScanTimeout)); Add(new cMenuEditIntItem( tr("SVDRPTimeout"), &data.SVDRPTimeout)); + Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit)); } eOSState cMenuSetup::ProcessKey(eKeys Key) @@ -1996,7 +1997,7 @@ bool cRecordControls::Start(cTimer *Timer) } } } - else + else if (!Timer || Timer->priority >= Setup.PrimaryLimit) esyslog(LOG_ERR, "ERROR: no free DVB device to record channel %d!", ch); } else -- cgit v1.2.3