summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-12-26 14:44:28 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-12-26 14:44:28 +0100
commitad552300510a2b5c989d5eda181d58c11d355ee2 (patch)
treedaf9b7e186eb99417efc0e2f18247e879a97f657
parentf94046db2e2abc33434ab4f2f4203a4f1966660d (diff)
downloadvdr-ad552300510a2b5c989d5eda181d58c11d355ee2.tar.gz
vdr-ad552300510a2b5c989d5eda181d58c11d355ee2.tar.bz2
EPG events that are no longer in the currently broadcasted data stream are now automatically deleted
-rw-r--r--HISTORY4
-rw-r--r--eit.c8
-rw-r--r--epg.c23
-rw-r--r--epg.h3
4 files changed, 34 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index e1058af1..1eefa478 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
commands may now be executed at any time, and the message will be displayed
(no more "pending message").
-2005-12-25: Version 1.3.38
+2005-12-26: Version 1.3.38
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
(was broken in version 1.3.37).
@@ -3993,3 +3993,5 @@ Video Disk Recorder Revision History
recording or replay stops, etc.
- The version number of EPG events is now also stored in the epg.data file
(thanks to Kendy Kutzner).
+- EPG events that are no longer in the currently broadcasted data stream are
+ now automatically deleted.
diff --git a/eit.c b/eit.c
index 4a643685..a343a696 100644
--- a/eit.c
+++ b/eit.c
@@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
- * $Id: eit.c 1.112 2005/11/04 14:19:16 kls Exp $
+ * $Id: eit.c 1.113 2005/12/26 11:50:09 kls Exp $
*/
#include "eit.h"
@@ -43,6 +43,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
bool Empty = true;
bool Modified = false;
+ time_t SegmentStart = 0;
+ time_t SegmentEnd = 0;
SI::EIT::Event SiEitEvent;
for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) {
@@ -50,6 +52,9 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
if (SiEitEvent.getStartTime() == 0 || SiEitEvent.getStartTime() > 0 && SiEitEvent.getDuration() == 0)
continue;
Empty = false;
+ if (!SegmentStart)
+ SegmentStart = SiEitEvent.getStartTime();
+ SegmentEnd = SiEitEvent.getStartTime() + SiEitEvent.getDuration();
cEvent *newEvent = NULL;
cEvent *rEvent = NULL;
cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime());
@@ -242,6 +247,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
pSchedule->SetPresentSeen();
if (Modified) {
pSchedule->Sort();
+ pSchedule->DropOutdated(SegmentStart, SegmentEnd, Tid, getVersionNumber());
Schedules->SetModified(pSchedule);
}
}
diff --git a/epg.c b/epg.c
index cecc28e7..b9d9063c 100644
--- a/epg.c
+++ b/epg.c
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.c 1.41 2005/12/25 11:11:17 kls Exp $
+ * $Id: epg.c 1.42 2005/12/26 14:44:03 kls Exp $
*/
#include "epg.h"
@@ -739,6 +739,27 @@ void cSchedule::Sort(void)
events.Sort();
}
+void cSchedule::DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
+{
+ if (SegmentStart > 0 && SegmentEnd > 0) {
+ for (cEvent *p = events.First(); p; p = events.Next(p)) {
+ if (!(p->EndTime() <= SegmentStart || p->StartTime() >= SegmentEnd)) {
+ // The event overlaps with the given time segment.
+ if (p->TableID() > TableID || p->TableID() == TableID && p->Version() != Version) {
+ // The segment overwrites all events from tables with higher ids, and
+ // within the same table id all events must have the same version.
+ // We can't delete the event right here because a timer might have
+ // a pointer to it, so let's set its id and start time to 0 to have it
+ // "phased out":
+ UnhashEvent(p);
+ p->eventID = 0;
+ p->startTime = 0;
+ }
+ }
+ }
+ }
+}
+
void cSchedule::Cleanup(void)
{
Cleanup(time(NULL));
diff --git a/epg.h b/epg.h
index 9cefcb27..866db0ff 100644
--- a/epg.h
+++ b/epg.h
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.h 1.26 2005/09/11 12:54:30 kls Exp $
+ * $Id: epg.h 1.27 2005/12/26 11:59:44 kls Exp $
*/
#ifndef __EPG_H
@@ -128,6 +128,7 @@ public:
void ClrRunningStatus(cChannel *Channel = NULL);
void ResetVersions(void);
void Sort(void);
+ void DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version);
void Cleanup(time_t Time);
void Cleanup(void);
cEvent *AddEvent(cEvent *Event);