1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

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. also copied.
- When a recording is running on the primary interface, any attempt to change - 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 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #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) time_t cTimer::StartTime(void)
@ -762,9 +762,8 @@ cTimer *cTimers::GetTimer(cTimer *Timer)
return NULL; 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 *t0 = NULL;
cTimer *ti = First(); cTimer *ti = First();
while (ti) { while (ti) {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __CONFIG_H
@ -256,7 +256,7 @@ public:
class cTimers : public cConfig<cTimer> { class cTimers : public cConfig<cTimer> {
public: public:
cTimer *GetTimer(cTimer *Timer); cTimer *GetTimer(cTimer *Timer);
cTimer *GetMatch(void); cTimer *GetMatch(time_t t);
cTimer *GetNextActiveTimer(void); cTimer *GetNextActiveTimer(void);
}; };

10
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #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; return false;
AssertFreeDiskSpace(timer->priority); AssertFreeDiskSpace(timer->priority);
return true; return true;
@ -2235,11 +2235,11 @@ const char *cRecordControls::GetInstantId(const char *LastInstantId)
return NULL; return NULL;
} }
void cRecordControls::Process(void) void cRecordControls::Process(time_t t)
{ {
for (int i = 0; i < MAXDVBAPI; i++) { for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i]) { if (RecordControls[i]) {
if (!RecordControls[i]->Process()) if (!RecordControls[i]->Process(t))
DELETENULL(RecordControls[i]); DELETENULL(RecordControls[i]);
} }
} }

6
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef _MENU_H
@ -78,7 +78,7 @@ private:
public: public:
cRecordControl(cDvbApi *DvbApi, cTimer *Timer = NULL); cRecordControl(cDvbApi *DvbApi, cTimer *Timer = NULL);
virtual ~cRecordControl(); virtual ~cRecordControl();
bool Process(void); bool Process(time_t t);
bool Uses(cDvbApi *DvbApi) { return DvbApi == dvbApi; } bool Uses(cDvbApi *DvbApi) { return DvbApi == dvbApi; }
void Stop(bool KeepInstant = false); void Stop(bool KeepInstant = false);
bool IsInstant(void) { return instantId; } bool IsInstant(void) { return instantId; }
@ -93,7 +93,7 @@ public:
static void Stop(const char *InstantId); static void Stop(const char *InstantId);
static void Stop(cDvbApi *DvbApi); static void Stop(cDvbApi *DvbApi);
static const char *GetInstantId(const char *LastInstantId); static const char *GetInstantId(const char *LastInstantId);
static void Process(void); static void Process(time_t t);
static bool Active(void); 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 * 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 #define _GNU_SOURCE
@ -333,12 +333,13 @@ int main(int argc, char *argv[])
} }
// Timers and Recordings: // Timers and Recordings:
if (!Menu) { 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 (Timer) {
if (!cRecordControls::Start(Timer)) if (!cRecordControls::Start(Timer))
Timer->SetPending(true); Timer->SetPending(true);
} }
cRecordControls::Process();
} }
// User Input: // User Input:
cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl; cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl;