mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Single shot timers are now reliably deleted when they have expired
This commit is contained in:
parent
e760b14f64
commit
ce0e97eb65
3
HISTORY
3
HISTORY
@ -3444,7 +3444,7 @@ Video Disk Recorder Revision History
|
||||
- Fixed handling repeated kAudio keys.
|
||||
- Improved displaying the the current audio track in the ST:TNG channel display.
|
||||
|
||||
2005-03-19: Version 1.3.23
|
||||
2005-03-20: Version 1.3.23
|
||||
|
||||
- The setup option "DVB/Video display format" is now only available if "Video format"
|
||||
is set to "4:3" (suggested by Mikko Salo).
|
||||
@ -3466,3 +3466,4 @@ Video Disk Recorder Revision History
|
||||
patch by Roman Krenický).
|
||||
- Some fixes to avoid compiler warnings in gcc 4.0 (thanks to Ville Skyttä for reporting
|
||||
these).
|
||||
- Single shot timers are now reliably deleted when they have expired.
|
||||
|
25
menu.c
25
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.345 2005/03/19 15:45:19 kls Exp $
|
||||
* $Id: menu.c 1.346 2005/03/20 11:06:56 kls Exp $
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
@ -3067,7 +3067,7 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause)
|
||||
|
||||
cRecordControl::~cRecordControl()
|
||||
{
|
||||
Stop(true);
|
||||
Stop();
|
||||
free(instantId);
|
||||
free(fileName);
|
||||
}
|
||||
@ -3102,16 +3102,11 @@ bool cRecordControl::GetEvent(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
void cRecordControl::Stop(bool KeepInstant)
|
||||
void cRecordControl::Stop(void)
|
||||
{
|
||||
if (timer) {
|
||||
DELETENULL(recorder);
|
||||
timer->SetRecording(false);
|
||||
if ((IsInstant() && !KeepInstant) || (timer->IsSingleEvent() && timer->StopTime() <= time(NULL))) {
|
||||
isyslog("deleting timer %d", timer->Index() + 1);
|
||||
Timers.Del(timer);
|
||||
Timers.SetModified();
|
||||
}
|
||||
timer = NULL;
|
||||
cStatus::MsgRecording(device, NULL);
|
||||
cRecordingUserCommand::InvokeCommand(RUC_AFTERRECORDING, fileName);
|
||||
@ -3172,8 +3167,16 @@ void cRecordControls::Stop(const char *InstantId)
|
||||
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
|
||||
if (RecordControls[i]) {
|
||||
const char *id = RecordControls[i]->InstantId();
|
||||
if (id && strcmp(id, InstantId) == 0)
|
||||
if (id && strcmp(id, InstantId) == 0) {
|
||||
cTimer *timer = RecordControls[i]->Timer();
|
||||
RecordControls[i]->Stop();
|
||||
if (timer) {
|
||||
isyslog("deleting timer %d", timer->Index() + 1);
|
||||
Timers.Del(timer);
|
||||
Timers.SetModified();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3184,7 +3187,7 @@ void cRecordControls::Stop(cDevice *Device)
|
||||
if (RecordControls[i]) {
|
||||
if (RecordControls[i]->Device() == Device) {
|
||||
isyslog("stopping recording on DVB device %d due to higher priority", Device->CardIndex() + 1);
|
||||
RecordControls[i]->Stop(true);
|
||||
RecordControls[i]->Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3261,7 +3264,7 @@ void cRecordControls::ChannelDataModified(cChannel *Channel)
|
||||
if (RecordControls[i]->Timer() && RecordControls[i]->Timer()->Channel() == Channel) {
|
||||
if (RecordControls[i]->Device()->ProvidesTransponder(Channel)) { // avoids retune on devices that don't really access the transponder
|
||||
isyslog("stopping recording due to modification of channel %d", Channel->Number());
|
||||
RecordControls[i]->Stop(true);
|
||||
RecordControls[i]->Stop();
|
||||
// This will restart the recording, maybe even from a different
|
||||
// device in case conditional access has changed.
|
||||
}
|
||||
|
5
menu.h
5
menu.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menu.h 1.68 2005/01/08 15:48:57 kls Exp $
|
||||
* $Id: menu.h 1.69 2005/03/20 10:57:29 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __MENU_H
|
||||
@ -155,8 +155,7 @@ public:
|
||||
virtual ~cRecordControl();
|
||||
bool Process(time_t t);
|
||||
cDevice *Device(void) { return device; }
|
||||
void Stop(bool KeepInstant = false);
|
||||
bool IsInstant(void) { return instantId; }
|
||||
void Stop(void);
|
||||
const char *InstantId(void) { return instantId; }
|
||||
const char *FileName(void) { return fileName; }
|
||||
cTimer *Timer(void) { return timer; }
|
||||
|
23
timers.c
23
timers.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: timers.c 1.25 2005/03/19 15:20:58 kls Exp $
|
||||
* $Id: timers.c 1.26 2005/03/20 11:19:36 kls Exp $
|
||||
*/
|
||||
|
||||
#include "timers.h"
|
||||
@ -389,6 +389,13 @@ int cTimer::Matches(const cEvent *Event, int *Overlap)
|
||||
return tmNone;
|
||||
}
|
||||
|
||||
#define EXPIRELATENCY 60 // seconds (just in case there's a short glitch in the VPS signal)
|
||||
|
||||
bool cTimer::Expired(void)
|
||||
{
|
||||
return IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL);
|
||||
}
|
||||
|
||||
time_t cTimer::StartTime(void) const
|
||||
{
|
||||
if (!startTime)
|
||||
@ -604,3 +611,17 @@ void cTimers::SetEvents(void)
|
||||
}
|
||||
lastSetEvents = time(NULL);
|
||||
}
|
||||
|
||||
void cTimers::DeleteExpired(void)
|
||||
{
|
||||
cTimer *ti = First();
|
||||
while (ti) {
|
||||
cTimer *next = Next(ti);
|
||||
if (ti->Expired()) {
|
||||
isyslog("deleting timer %d", ti->Index() + 1);
|
||||
Del(ti);
|
||||
SetModified();
|
||||
}
|
||||
ti = next;
|
||||
}
|
||||
}
|
||||
|
4
timers.h
4
timers.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: timers.h 1.15 2005/03/19 14:22:11 kls Exp $
|
||||
* $Id: timers.h 1.16 2005/03/20 10:55:49 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TIMERS_H
|
||||
@ -72,6 +72,7 @@ public:
|
||||
char *SetFile(const char *File);
|
||||
bool Matches(time_t t = 0, bool Directly = false) const;
|
||||
int Matches(const cEvent *Event, int *Overlap = NULL);
|
||||
bool Expired(void);
|
||||
time_t StartTime(void) const;
|
||||
time_t StopTime(void) const;
|
||||
void SetEvent(const cEvent *Event);
|
||||
@ -109,6 +110,7 @@ public:
|
||||
///< Returns true if any of the timers have been modified.
|
||||
///< Calling this function resets the 'modified' flag to false.
|
||||
void SetEvents(void);
|
||||
void DeleteExpired(void);
|
||||
};
|
||||
|
||||
extern cTimers Timers;
|
||||
|
4
vdr.c
4
vdr.c
@ -22,7 +22,7 @@
|
||||
*
|
||||
* The project's page is at http://www.cadsoft.de/vdr
|
||||
*
|
||||
* $Id: vdr.c 1.202 2005/02/12 15:06:16 kls Exp $
|
||||
* $Id: vdr.c 1.203 2005/03/20 10:58:59 kls Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -606,6 +606,8 @@ int main(int argc, char *argv[])
|
||||
PreviousChannel[PreviousChannelIndex ^= 1] = LastChannel;
|
||||
// Timers and Recordings:
|
||||
if (!Timers.BeingEdited()) {
|
||||
// Delete expired timers:
|
||||
Timers.DeleteExpired();
|
||||
// Assign events to timers:
|
||||
Timers.SetEvents();
|
||||
// Must do all following calls with the exact same time!
|
||||
|
Loading…
Reference in New Issue
Block a user