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

Added HandledExternally() to the EPG handler interface

This commit is contained in:
Klaus Schmidinger 2012-06-04 10:19:23 +02:00
parent 4bce65eb10
commit 8d8dd8ecbd
5 changed files with 28 additions and 5 deletions

View File

@ -2465,6 +2465,7 @@ Ulf Kiener <webmaster@ulf-kiener.de>
Jörg Wendel <vdr-ml@jwendel.de> Jörg Wendel <vdr-ml@jwendel.de>
for reporting that cPlugin::Active() was called too often for reporting that cPlugin::Active() was called too often
for adding HandledExternally() to the EPG handler interface
Peter Pinnau <vdr@unterbrecher.de> Peter Pinnau <vdr@unterbrecher.de>
for reporting that 'uint32_t' requires including stdint.h in font.h on some systems for reporting that 'uint32_t' requires including stdint.h in font.h on some systems

View File

@ -7162,3 +7162,5 @@ Video Disk Recorder Revision History
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed the call to ChannelString() in cSkinLCARSDisplayChannel::SetChannel() (thanks - Fixed the call to ChannelString() in cSkinLCARSDisplayChannel::SetChannel() (thanks
to Rolf Ahrenberg). 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).

10
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 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" #include "eit.h"
@ -45,6 +45,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
return; return;
} }
bool handledExternally = EpgHandlers.HandledExternally(channel);
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true); cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
bool Empty = 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 *newEvent = NULL;
cEvent *rEvent = NULL; cEvent *rEvent = NULL;
cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), StartTime); cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), StartTime);
if (!pEvent) { if (!pEvent || handledExternally) {
if (OnlyRunningStatus) if (OnlyRunningStatus)
continue; continue;
// If we don't have that event yet, we create a new one. // 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()); pEvent = newEvent = new cEvent(SiEitEvent.getEventId());
newEvent->SetStartTime(StartTime); newEvent->SetStartTime(StartTime);
newEvent->SetDuration(Duration); newEvent->SetDuration(Duration);
pSchedule->AddEvent(newEvent); if (!handledExternally)
pSchedule->AddEvent(newEvent);
} }
else { else {
// We have found an existing event, either through its event ID or its start time. // 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); channel->SetLinkChannels(LinkChannels);
Modified = true; Modified = true;
EpgHandlers.HandleEvent(pEvent); EpgHandlers.HandleEvent(pEvent);
if (handledExternally)
delete pEvent;
} }
if (Tid == 0x4E) { if (Tid == 0x4E) {
if (Empty && getSectionNumber() == 0) if (Empty && getSectionNumber() == 0)

11
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 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" #include "epg.h"
@ -1331,6 +1331,15 @@ bool cEpgHandlers::HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *Eit
return false; 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) void cEpgHandlers::SetEventID(cEvent *Event, tEventID EventID)
{ {
for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { for (cEpgHandler *eh = First(); eh; eh = Next(eh)) {

9
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 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 #ifndef __EPG_H
@ -244,6 +244,12 @@ public:
///< EPG handlers are queried to see if any of them would like to do the ///< 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 ///< complete processing by itself. TableID and Version are from the
///< incoming section data. ///< 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 SetEventID(cEvent *Event, tEventID EventID) { return false; }
virtual bool SetTitle(cEvent *Event, const char *Title) { return false; } virtual bool SetTitle(cEvent *Event, const char *Title) { return false; }
virtual bool SetShortText(cEvent *Event, const char *ShortText) { return false; } virtual bool SetShortText(cEvent *Event, const char *ShortText) { return false; }
@ -269,6 +275,7 @@ class cEpgHandlers : public cList<cEpgHandler> {
public: public:
bool IgnoreChannel(const cChannel *Channel); bool IgnoreChannel(const cChannel *Channel);
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version); 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 SetEventID(cEvent *Event, tEventID EventID);
void SetTitle(cEvent *Event, const char *Title); void SetTitle(cEvent *Event, const char *Title);
void SetShortText(cEvent *Event, const char *ShortText); void SetShortText(cEvent *Event, const char *ShortText);