From 08ab22f987a7ce7489ac31e8e0d37c9054651ba8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 25 Aug 2012 11:31:35 +0200 Subject: [PATCH] Added IsUpdate() to the EPG handler interface --- CONTRIBUTORS | 1 + HISTORY | 3 ++- eit.c | 4 +++- epg.c | 11 ++++++++++- epg.h | 7 ++++++- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 608251b2..7ae8fb8a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2467,6 +2467,7 @@ Ulf Kiener Jörg Wendel for reporting that cPlugin::Active() was called too often for adding HandledExternally() to the EPG handler interface + for adding IsUpdate() to the EPG handler interface Peter Pinnau for reporting that 'uint32_t' requires including stdint.h in font.h on some systems diff --git a/HISTORY b/HISTORY index 5e2ca522..e275b9de 100644 --- a/HISTORY +++ b/HISTORY @@ -7191,7 +7191,7 @@ Video Disk Recorder Revision History turn on adding the source character to channel names whenever they are displayed (suggested by Ludi Kaleni). -2012-08-21: Version 1.7.30 +2012-08-25: Version 1.7.30 - Fixed sorting recordings in the top level video directory. - Fixed handling control characters in SI data in case of UTF-8 encoded strings @@ -7202,3 +7202,4 @@ Video Disk Recorder Revision History dot ('.') are now ignored and will be implicitly removed if the directory contains no other files. This fixes the leftover ".sort" files that were introduced in version 1.7.29. +- Added IsUpdate() to the EPG handler interface (thanks to Jörg Wendel). diff --git a/eit.c b/eit.c index 12e1d242..a236b896 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 2.20 2012/06/04 10:26:10 kls Exp $ + * $Id: eit.c 2.21 2012/08/25 11:13:00 kls Exp $ */ #include "eit.h" @@ -74,6 +74,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo if (!pEvent || handledExternally) { if (OnlyRunningStatus) continue; + if (handledExternally && !EpgHandlers.IsUpdate(SiEitEvent.getEventId(), StartTime, Tid, getVersionNumber())) + continue; // If we don't have that event yet, we create a new one. // Otherwise we copy the information into the existing event anyway, because the data might have changed. pEvent = newEvent = new cEvent(SiEitEvent.getEventId()); diff --git a/epg.c b/epg.c index d47c4a37..8ebfb6e7 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 and Rolf Hakenes . * - * $Id: epg.c 2.17 2012/06/04 10:26:10 kls Exp $ + * $Id: epg.c 2.18 2012/08/25 11:10:29 kls Exp $ */ #include "epg.h" @@ -1340,6 +1340,15 @@ bool cEpgHandlers::HandledExternally(const cChannel *Channel) return false; } +bool cEpgHandlers::IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version) +{ + for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { + if (eh->IsUpdate(EventID, StartTime, TableID, Version)) + return true; + } + return false; +} + void cEpgHandlers::SetEventID(cEvent *Event, tEventID EventID) { for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { diff --git a/epg.h b/epg.h index 98cb7764..b9a20935 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 and Rolf Hakenes . * - * $Id: epg.h 2.13 2012/06/04 10:26:10 kls Exp $ + * $Id: epg.h 2.14 2012/08/25 11:15:18 kls Exp $ */ #ifndef __EPG_H @@ -250,6 +250,10 @@ public: ///< source. Incoming EIT data is processed as usual, but any new EPG event ///< will not be added to the respective schedule. It's up to the EPG ///< handler to take care of this. + virtual bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version) { return false; } + ///< VDR can't perform the update check (version, tid) for externally handled events, + ///< therefore the EPG handlers have to take care of this. Otherwise the parsing of + ///< non-updates will waste a lot of resources. virtual bool SetEventID(cEvent *Event, tEventID EventID) { return false; } virtual bool SetTitle(cEvent *Event, const char *Title) { return false; } virtual bool SetShortText(cEvent *Event, const char *ShortText) { return false; } @@ -277,6 +281,7 @@ public: bool IgnoreChannel(const cChannel *Channel); bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version); bool HandledExternally(const cChannel *Channel); + bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version); void SetEventID(cEvent *Event, tEventID EventID); void SetTitle(cEvent *Event, const char *Title); void SetShortText(cEvent *Event, const char *ShortText);