From 8d8dd8ecbd3a7c95800921009c72123939e3e571 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 4 Jun 2012 10:19:23 +0200 Subject: Added HandledExternally() to the EPG handler interface --- CONTRIBUTORS | 1 + HISTORY | 2 ++ eit.c | 10 +++++++--- epg.c | 11 ++++++++++- epg.h | 9 ++++++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c9a5660b..617e26c9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2465,6 +2465,7 @@ Ulf Kiener Jörg Wendel for reporting that cPlugin::Active() was called too often + for adding HandledExternally() 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 edc09622..8be42bb7 100644 --- a/HISTORY +++ b/HISTORY @@ -7162,3 +7162,5 @@ Video Disk Recorder Revision History - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed the call to ChannelString() in cSkinLCARSDisplayChannel::SetChannel() (thanks to Rolf Ahrenberg). +- Removed DeleteEvent() from the EPG handler interface (turned out not to be useful) + and replaced it with HandledExternally() (thanks to Jörg Wendel). diff --git a/eit.c b/eit.c index c746337b..9840d9a2 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.18 2012/06/04 09:48:57 kls Exp $ + * $Id: eit.c 2.19 2012/06/04 10:10:11 kls Exp $ */ #include "eit.h" @@ -45,6 +45,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo return; } + bool handledExternally = EpgHandlers.HandledExternally(channel); cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true); bool Empty = true; @@ -70,7 +71,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo cEvent *newEvent = NULL; cEvent *rEvent = NULL; cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), StartTime); - if (!pEvent) { + if (!pEvent || handledExternally) { if (OnlyRunningStatus) continue; // If we don't have that event yet, we create a new one. @@ -78,7 +79,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo pEvent = newEvent = new cEvent(SiEitEvent.getEventId()); newEvent->SetStartTime(StartTime); newEvent->SetDuration(Duration); - pSchedule->AddEvent(newEvent); + if (!handledExternally) + pSchedule->AddEvent(newEvent); } else { // We have found an existing event, either through its event ID or its start time. @@ -290,6 +292,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo channel->SetLinkChannels(LinkChannels); Modified = true; EpgHandlers.HandleEvent(pEvent); + if (handledExternally) + delete pEvent; } if (Tid == 0x4E) { if (Empty && getSectionNumber() == 0) diff --git a/epg.c b/epg.c index 54712cc9..48fff364 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.15 2012/06/04 09:49:48 kls Exp $ + * $Id: epg.c 2.16 2012/06/04 10:06:22 kls Exp $ */ #include "epg.h" @@ -1331,6 +1331,15 @@ bool cEpgHandlers::HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *Eit return false; } +bool cEpgHandlers::HandledExternally(const cChannel *Channel) +{ + for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { + if (eh->HandledExternally(Channel)) + 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 6930fe0c..714ac176 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.11 2012/06/04 09:49:24 kls Exp $ + * $Id: epg.h 2.12 2012/06/04 10:05:21 kls Exp $ */ #ifndef __EPG_H @@ -244,6 +244,12 @@ public: ///< EPG handlers are queried to see if any of them would like to do the ///< complete processing by itself. TableID and Version are from the ///< incoming section data. + virtual bool HandledExternally(const cChannel *Channel) { return false; } + ///< If any EPG handler returns true in this function, it is assumed that + ///< the EPG for the given Channel is handled completely from some external + ///< 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 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; } @@ -269,6 +275,7 @@ class cEpgHandlers : public cList { public: bool IgnoreChannel(const cChannel *Channel); bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version); + bool HandledExternally(const cChannel *Channel); void SetEventID(cEvent *Event, tEventID EventID); void SetTitle(cEvent *Event, const char *Title); void SetShortText(cEvent *Event, const char *ShortText); -- cgit v1.2.3