summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-04-09 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-04-09 18:00:00 +0200
commit396d0ad36712d8c07d91b36283a14838900ca5a2 (patch)
tree0c3933f085dad61d933c31f4d43acd68a84e7781 /timers.c
parent49b561fcad16d3315fce8cb854de9f4ee6156640 (diff)
downloadvdr-patch-lnbsharing-396d0ad36712d8c07d91b36283a14838900ca5a2.tar.gz
vdr-patch-lnbsharing-396d0ad36712d8c07d91b36283a14838900ca5a2.tar.bz2
Version 1.3.46vdr-1.3.46
- Fixed handling broken PMT records (thanks to Marcel Wiesweg for pointing out how to detect these). - Added a missing "Button$" for the Timer button and "Key$" in skinclassic.c (thanks to Rolf Ahrenberg). - Fixed broken entry 'A111.1W' in sources.conf (reported by Luca Olivetti). - Replaced the obsolete entry 'S21.5E' in the default 'diseqc.conf' with 'S13.0E' (reported by Ville Skyttä). - Fixed learning keys when VDR is already running (thanks to Jurij Retzlaff). - Fixed handling the system time transponder setting in the Setup/EPG menu, which was broken by the min/max fix in cMenuEditIntItem. - VPS timers now record only events that have exactly the given start time. This fix also implements recording several subsequent events that have the same VPS time (like a sports event with intermittent news breaks). - When checking for timers that have entered the "VPS margin", any free devices are now used to switch to the needed transponder. This improves cases where more than one VPS timer is about to start. - Fixed handling the VPS margin in case the event's duration is shorter than the margin. - Fixed handling VPS timers in case the primary device needs to switch to the timer's transponder. - Now avoiding the 'actual' device when starting a recording, so that a Transfer Mode for live tv isn't interrupted. - Fixed a typo in skins.h (thanks to Alexander Rieger). - cSkins::QueueMessage() called from a background thread with an empty message now clears all messages that have been previously queued by that thread and have not yet beed displayed (thanks to Alexander Rieger). - Fixed handling the color button texts when switching from the 'Schedule' menu of a channel without EPG info to the 'What's on now' menu (reported by Rolf Ahrenberg). - cMenuEditIntItem and cMenuEditChanItem can now be given strings to label the minimum and maximum values, and the case that no channel has been selected, respectively. - The initial channel and volume can now be defined in the "Setup/Miscellaneous" menu (based on a patch from Thomas Keil). - When hitting the end of a recording in fast forward mode, VDR no longer switches back to normal speed if the recording is already finished (thanks to Reinhard Nissl). - No longer calling cPlugin::ProcessArgs() if VDR is run with the --help or --version option, to avoid error messages from plugins (reported by Udo Richter). - Now checking whether there is any text before calling cStatus::MsgOsdTextItem() (reported by Joachim Wilke).
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/timers.c b/timers.c
index 0e764d3..f620735 100644
--- a/timers.c
+++ b/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.55 2006/03/26 14:08:57 kls Exp $
+ * $Id: timers.c 1.57 2006/04/09 09:10:08 kls Exp $
*/
#include "timers.h"
@@ -330,7 +330,7 @@ char *cTimer::SetFile(const char *File)
return file;
}
-bool cTimer::Matches(time_t t, bool Directly) const
+bool cTimer::Matches(time_t t, bool Directly, int Margin) const
{
startTime = stopTime = 0;
if (t == 0)
@@ -370,7 +370,7 @@ bool cTimer::Matches(time_t t, bool Directly) const
stopTime = event->EndTime();
return event->IsRunning(true);
}
- return startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers
+ return startTime <= t + Margin && t < stopTime; // must stop *before* stopTime to allow adjacent timers
}
return false;
}
@@ -401,7 +401,9 @@ int cTimer::Matches(const cEvent *Event, int *Overlap) const
startTime = stopTime = 0;
if (Overlap)
*Overlap = overlap;
- return overlap >= 1000 ? tmFull : overlap > 0 ? tmPartial : tmNone;
+ if (UseVps)
+ return overlap > FULLMATCH ? tmFull : tmNone;
+ return overlap >= FULLMATCH ? tmFull : overlap > 0 ? tmPartial : tmNone;
}
return tmNone;
}
@@ -435,8 +437,6 @@ time_t cTimer::StopTime(void) const
#define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and
#define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration.
-#define VPSLIMITBEFORE (2 * 3600) // Same for VPS timers, which need to
-#define VPSLIMITAFTER (24 * 3600) // look further into the future to catch shifted broadcasts.
void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
{
@@ -447,51 +447,51 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
return;
}
const cSchedule *Schedule = Schedules->GetSchedule(Channel());
- if (Schedule) {
+ if (Schedule && Schedule->Events()->First()) {
time_t now = time(NULL);
if (!lastSetEvent || Schedule->Modified() >= lastSetEvent) {
+ lastSetEvent = now;
const cEvent *Event = NULL;
- int Overlap = 0;
- int Distance = INT_MIN;
- bool UseVps = HasFlags(tfVps);
- const cEvent *PresentEvent = UseVps ? Schedule->GetPresentEvent() : NULL;
- const cEvent *FollowingEvent = UseVps ? Schedule->GetFollowingEvent() : NULL;
- // Set up the time frame within which to check events:
- Matches(0, true);
- time_t TimeFrameBegin = StartTime() - (UseVps ? VPSLIMITBEFORE : EPGLIMITBEFORE);
- time_t TimeFrameEnd = StopTime() + (UseVps ? VPSLIMITAFTER : EPGLIMITAFTER);
- for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
- if (!UseVps || e != event && e != PresentEvent && e != FollowingEvent) { // always check these if this is a VPS timer
+ if (HasFlags(tfVps) && Schedule->Events()->First()->Vps()) {
+ if (event && Recording())
+ return; // let the recording end first
+ // VPS timers only match if their start time exactly matches the event's VPS time:
+ for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
+ if (e->StartTime() && e->RunningStatus() != SI::RunningStatusNotRunning) { // skip outdated events
+ int overlap = 0;
+ Matches(e, &overlap);
+ if (overlap > FULLMATCH) {
+ Event = e;
+ break; // take the first matching event
+ }
+ }
+ }
+ if (!Event && event && (now <= event->EndTime() || Matches(0, true)))
+ return; // stay with the old event until the timer has completely expired
+ }
+ else {
+ // Normal timers match the event they have the most overlap with:
+ int Overlap = 0;
+ // Set up the time frame within which to check events:
+ Matches(0, true);
+ time_t TimeFrameBegin = StartTime() - EPGLIMITBEFORE;
+ time_t TimeFrameEnd = StopTime() + EPGLIMITAFTER;
+ for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
if (e->EndTime() < TimeFrameBegin)
continue; // skip events way before the timer starts
if (e->StartTime() > TimeFrameEnd)
break; // the rest is way after the timer ends
- }
- int overlap = 0;
- Matches(e, &overlap);
- if (overlap && overlap >= Overlap) {
- int distance = 0;
- if (now < e->StartTime())
- distance = e->StartTime() - now;
- else if (now > e->EndTime())
- distance = e->EndTime() - now;
- if (Event && overlap == Overlap) {
- if (Overlap > FULLMATCH) { // this means VPS
- if (abs(Distance) < abs(distance))
- break; // we've already found the closest VPS event
- }
- else if (e->Duration() <= Event->Duration())
+ int overlap = 0;
+ Matches(e, &overlap);
+ if (overlap && overlap >= Overlap) {
+ if (Event && overlap == Overlap && e->Duration() <= Event->Duration())
continue; // if overlap is the same, we take the longer event
+ Overlap = overlap;
+ Event = e;
}
- Overlap = overlap;
- Distance = distance;
- Event = e;
}
- }
- if (Event && Event->EndTime() < now - EXPIRELATENCY && Overlap > FULLMATCH && !Event->IsRunning())
- Event = NULL;
+ }
SetEvent(Event);
- lastSetEvent = now;
}
}
}