From 1b1465a6775c1f53d1f7ef5ef13c7efdbc42a74a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 19 Jan 2021 13:21:51 +0100 Subject: Now making sure a spawned timer only fully overlaps the given event --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- timers.c | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0586bd79..208f106e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3665,6 +3665,8 @@ J event has no short text for reporting a bug in VPS handling when spawning a pattern timer, in case Setup.UseVps is false + for reporting an endless spawning of pattern timers in case the spawned timer doesn't + use VPS and fully overlaps a second event that is longer than the original one Stefan Verse for fixing an occasional black screen when switching channels diff --git a/HISTORY b/HISTORY index 4e163508..d019d608 100644 --- a/HISTORY +++ b/HISTORY @@ -9578,7 +9578,7 @@ Video Disk Recorder Revision History given (reported by Manuel Reimer). - Fixed handling $(PKG_CONFIG) in newplugin (thanks to Winfried Köhler). -2021-01-18: +2021-01-19: - Fixed strreplace() to handle NULL strings (reported by Jürgen Schneider). - Somewhere down the road the 'x' bit of Doxyfile.filter got lost, so the @@ -9601,3 +9601,5 @@ Video Disk Recorder Revision History (thanks to Peter Bieringer). - Fixed setting the 'title' of a recording's info to the recording's name if there is no info file (the change in version 1.7.28 broke the fallback to the old 'summary.vdr'). +- Now making sure a spawned timer only fully overlaps the given event (reported by + Jürgen Schneider). diff --git a/timers.c b/timers.c index 02c08969..5c794309 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 5.4 2021/01/15 13:52:40 kls Exp $ + * $Id: timers.c 5.5 2021/01/19 13:21:51 kls Exp $ */ #include "timers.h" @@ -191,8 +191,18 @@ cTimer::cTimer(const cEvent *Event, const char *FileName, const cTimer *PatternT time_t tstart = (flags & tfVps) ? Event->Vps() : Event->StartTime(); time_t tstop = tstart + Event->Duration(); if (!(HasFlags(tfVps))) { - tstop += Setup.MarginStop * 60; - tstart -= Setup.MarginStart * 60; + int MarginStart = Setup.MarginStart * 60; + int MarginStop = Setup.MarginStop * 60; + if (PatternTimer) { + // To make sure a spawned timer gets assigned to the correct event, we must + // make sure that this is the only event that overlaps 100%: + if (const cEvent *e = dynamic_cast(Event->Prev())) + MarginStart = max(0, min(MarginStart, e->Duration() - 60)); + if (const cEvent *e = dynamic_cast(Event->Next())) + MarginStop = max(0, min(MarginStop, e->Duration() - 60)); + } + tstart -= MarginStart; + tstop += MarginStop; } struct tm tm_r; struct tm *time = localtime_r(&tstart, &tm_r); -- cgit v1.2.3