From dfb1d78abf1a849302d2b93013ad2b8252c5035c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 21 Apr 2002 10:09:56 +0200 Subject: Fixed a possible endless loop in shifting recordings between DVB cards --- CONTRIBUTORS | 1 + HISTORY | 4 +++- config.h | 4 ++-- dvbapi.c | 9 ++++++--- dvbapi.h | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 727caedd..f0db96cd 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -122,6 +122,7 @@ Stefan Huelswitt for fixing a crash when replaying with DEBUG_OSD=1 for fixing a crash when selecting the "Jump" function directly after setting an editing mark + for reporting a possible endless loop in shifting recordings between DVB cards Ulrich Röder for pointing out that there are channels that have a symbol rate higher than diff --git a/HISTORY b/HISTORY index ce60e733..2d04ab19 100644 --- a/HISTORY +++ b/HISTORY @@ -1191,7 +1191,7 @@ Video Disk Recorder Revision History same name was manually deleted on a system with more than one video directory (thanks to Dirk Wiebel for reporting this one). -2002-04-20: Version 1.0.1 +2002-04-21: Version 1.0.1 - Added some DVB-T channels for Berlin (Germany) to channels.conf.terr (thanks to Andreas Roedl). @@ -1210,3 +1210,5 @@ Video Disk Recorder Revision History editing mark (thanks to Steffen Koch for reporting and Stefan Huelswitt for fixing this one). - Fixed some missing ',' in i18n.c (thanks to Matthias Hilbig). +- Fixed a possible endless loop in shifting recordings between DVB cards (thanks + to Stefan Huelswitt for reporting this one). diff --git a/config.h b/config.h index 00774b08..67ae92c0 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.109 2002/04/07 13:08:12 kls Exp $ + * $Id: config.h 1.110 2002/04/21 10:09:56 kls Exp $ */ #ifndef __CONFIG_H @@ -19,7 +19,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "1.0.0" +#define VDRVERSION "1.0.1" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/dvbapi.c b/dvbapi.c index 1c4a9521..786aff99 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.171 2002/04/20 10:45:33 kls Exp $ + * $Id: dvbapi.c 1.172 2002/04/21 09:54:40 kls Exp $ */ #include "dvbapi.h" @@ -1812,21 +1812,24 @@ bool cDvbApi::SetPrimaryDvbApi(int n) return false; } -int cDvbApi::CanShift(int Ca, int Priority) +int cDvbApi::CanShift(int Ca, int Priority, int UsedCards) { // Test whether a recording on this DVB device can be shifted to another one // in order to perform a new recording with the given Ca and Priority on this device: int ShiftLevel = -1; // default means this device can't be shifted + if (UsedCards & (1 << CardIndex()) != 0) + return ShiftLevel; // otherwise we would get into a loop if (Recording()) { if (ProvidesCa(Ca) // this device provides the requested Ca && (Ca != this->Ca() // the requested Ca is different from the one currently used... || Priority > this->Priority())) { // ...or the request comes from a higher priority cDvbApi *d = NULL; int Provides[MAXDVBAPI]; + UsedCards |= (1 << CardIndex()); for (int i = 0; i < NumDvbApis; i++) { if ((Provides[i] = dvbApi[i]->ProvidesCa(this->Ca())) != 0) { // this device is basicly able to do the job if (dvbApi[i] != this) { // it is not _this_ device - int sl = dvbApi[i]->CanShift(this->Ca(), Priority); // this is the original Priority! + int sl = dvbApi[i]->CanShift(this->Ca(), Priority, UsedCards); // this is the original Priority! if (sl >= 0 && (ShiftLevel < 0 || sl < ShiftLevel)) { d = dvbApi[i]; ShiftLevel = sl; diff --git a/dvbapi.h b/dvbapi.h index e9cf8c83..7e638786 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.68 2002/03/10 10:50:00 kls Exp $ + * $Id: dvbapi.h 1.69 2002/04/21 09:49:22 kls Exp $ */ #ifndef __DVBAPI_H @@ -104,7 +104,7 @@ private: static int useDvbApi; int cardIndex; int caCaps[MAXCACAPS]; - int CanShift(int Ca, int Priority); + int CanShift(int Ca, int Priority, int UsedCards = 0); public: static cDvbApi *PrimaryDvbApi; static void SetUseDvbApi(int n); -- cgit v1.2.3