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

EPG events that are no longer in the currently broadcasted data stream are now automatically deleted

This commit is contained in:
Klaus Schmidinger 2005-12-26 14:44:28 +01:00
parent f94046db2e
commit ad55230051
4 changed files with 34 additions and 4 deletions

View File

@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
commands may now be executed at any time, and the message will be displayed commands may now be executed at any time, and the message will be displayed
(no more "pending message"). (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 - Fixed handling second audio and Dolby Digital PIDs for encrypted channels
(was broken in version 1.3.37). (was broken in version 1.3.37).
@ -3993,3 +3993,5 @@ Video Disk Recorder Revision History
recording or replay stops, etc. recording or replay stops, etc.
- The version number of EPG events is now also stored in the epg.data file - The version number of EPG events is now also stored in the epg.data file
(thanks to Kendy Kutzner). (thanks to Kendy Kutzner).
- EPG events that are no longer in the currently broadcasted data stream are
now automatically deleted.

8
eit.c
View File

@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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>. * 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" #include "eit.h"
@ -43,6 +43,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
bool Empty = true; bool Empty = true;
bool Modified = false; bool Modified = false;
time_t SegmentStart = 0;
time_t SegmentEnd = 0;
SI::EIT::Event SiEitEvent; SI::EIT::Event SiEitEvent;
for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) { 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) if (SiEitEvent.getStartTime() == 0 || SiEitEvent.getStartTime() > 0 && SiEitEvent.getDuration() == 0)
continue; continue;
Empty = false; Empty = false;
if (!SegmentStart)
SegmentStart = SiEitEvent.getStartTime();
SegmentEnd = SiEitEvent.getStartTime() + SiEitEvent.getDuration();
cEvent *newEvent = NULL; cEvent *newEvent = NULL;
cEvent *rEvent = NULL; cEvent *rEvent = NULL;
cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime()); 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(); pSchedule->SetPresentSeen();
if (Modified) { if (Modified) {
pSchedule->Sort(); pSchedule->Sort();
pSchedule->DropOutdated(SegmentStart, SegmentEnd, Tid, getVersionNumber());
Schedules->SetModified(pSchedule); Schedules->SetModified(pSchedule);
} }
} }

23
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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" #include "epg.h"
@ -739,6 +739,27 @@ void cSchedule::Sort(void)
events.Sort(); 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) void cSchedule::Cleanup(void)
{ {
Cleanup(time(NULL)); Cleanup(time(NULL));

3
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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 #ifndef __EPG_H
@ -128,6 +128,7 @@ public:
void ClrRunningStatus(cChannel *Channel = NULL); void ClrRunningStatus(cChannel *Channel = NULL);
void ResetVersions(void); void ResetVersions(void);
void Sort(void); void Sort(void);
void DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version);
void Cleanup(time_t Time); void Cleanup(time_t Time);
void Cleanup(void); void Cleanup(void);
cEvent *AddEvent(cEvent *Event); cEvent *AddEvent(cEvent *Event);