Stopping finished timer recordings before starting new ones

This commit is contained in:
Klaus Schmidinger 2001-09-01 15:04:14 +02:00
parent e2701822e8
commit 5a5fc72814
6 changed files with 20 additions and 17 deletions

View File

@ -691,3 +691,6 @@ Video Disk Recorder Revision History
also copied.
- When a recording is running on the primary interface, any attempt to change
the current channel will now lead to a "Channel locked" message.
- The main program loop now first checks whether any timer recordings are
finished, before starting a new timer recording. This is important in case
one timer ends at the same time another timer starts.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 1.61 2001/09/01 10:02:21 kls Exp $
* $Id: config.c 1.62 2001/09/01 15:04:14 kls Exp $
*/
#include "config.h"
@ -571,7 +571,7 @@ bool cTimer::Matches(time_t t)
}
}
}
return active && startTime <= t && t <= stopTime;
return active && startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers
}
time_t cTimer::StartTime(void)
@ -762,9 +762,8 @@ cTimer *cTimers::GetTimer(cTimer *Timer)
return NULL;
}
cTimer *cTimers::GetMatch(void)
cTimer *cTimers::GetMatch(time_t t)
{
time_t t = time(NULL); // all timers must be checked against the exact same time to correctly handle Priority!
cTimer *t0 = NULL;
cTimer *ti = First();
while (ti) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.68 2001/09/01 10:01:51 kls Exp $
* $Id: config.h 1.69 2001/09/01 14:56:06 kls Exp $
*/
#ifndef __CONFIG_H
@ -256,7 +256,7 @@ public:
class cTimers : public cConfig<cTimer> {
public:
cTimer *GetTimer(cTimer *Timer);
cTimer *GetMatch(void);
cTimer *GetMatch(time_t t);
cTimer *GetNextActiveTimer(void);
};

10
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.110 2001/08/31 13:47:28 kls Exp $
* $Id: menu.c 1.111 2001/09/01 14:56:31 kls Exp $
*/
#include "menu.h"
@ -2163,9 +2163,9 @@ void cRecordControl::Stop(bool KeepInstant)
}
}
bool cRecordControl::Process(void)
bool cRecordControl::Process(time_t t)
{
if (!timer || !timer->Matches())
if (!timer || !timer->Matches(t))
return false;
AssertFreeDiskSpace(timer->priority);
return true;
@ -2235,11 +2235,11 @@ const char *cRecordControls::GetInstantId(const char *LastInstantId)
return NULL;
}
void cRecordControls::Process(void)
void cRecordControls::Process(time_t t)
{
for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i]) {
if (!RecordControls[i]->Process())
if (!RecordControls[i]->Process(t))
DELETENULL(RecordControls[i]);
}
}

6
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.24 2001/08/19 14:44:32 kls Exp $
* $Id: menu.h 1.25 2001/09/01 14:52:48 kls Exp $
*/
#ifndef _MENU_H
@ -78,7 +78,7 @@ private:
public:
cRecordControl(cDvbApi *DvbApi, cTimer *Timer = NULL);
virtual ~cRecordControl();
bool Process(void);
bool Process(time_t t);
bool Uses(cDvbApi *DvbApi) { return DvbApi == dvbApi; }
void Stop(bool KeepInstant = false);
bool IsInstant(void) { return instantId; }
@ -93,7 +93,7 @@ public:
static void Stop(const char *InstantId);
static void Stop(cDvbApi *DvbApi);
static const char *GetInstantId(const char *LastInstantId);
static void Process(void);
static void Process(time_t t);
static bool Active(void);
};

7
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.67 2001/09/01 13:48:44 kls Exp $
* $Id: vdr.c 1.68 2001/09/01 14:50:40 kls Exp $
*/
#define _GNU_SOURCE
@ -333,12 +333,13 @@ int main(int argc, char *argv[])
}
// Timers and Recordings:
if (!Menu) {
cTimer *Timer = Timers.GetMatch();
time_t Now = time(NULL); // must do both following calls with the exact same time!
cRecordControls::Process(Now);
cTimer *Timer = Timers.GetMatch(Now);
if (Timer) {
if (!cRecordControls::Start(Timer))
Timer->SetPending(true);
}
cRecordControls::Process();
}
// User Input:
cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl;