Added a new plugin interface for implementing EPG handlers

This commit is contained in:
Klaus Schmidinger
2012-03-10 15:10:43 +01:00
parent bc06fc2ce3
commit 860786f809
12 changed files with 878 additions and 52 deletions

67
epg.h
View File

@@ -7,13 +7,14 @@
* 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 2.7 2012/02/26 13:58:26 kls Exp $
* $Id: epg.h 2.8 2012/03/10 13:50:10 kls Exp $
*/
#ifndef __EPG_H
#define __EPG_H
#include "channels.h"
#include "libsi/section.h"
#include "thread.h"
#include "tools.h"
@@ -221,4 +222,68 @@ public:
void ReportEpgBugFixStats(bool Reset = false);
class cEpgHandler : public cListObject {
public:
cEpgHandler(void);
///< Constructs a new EPG handler and adds it to the list of EPG handlers.
///< Whenever an event is received from the EIT data stream, the EPG
///< handlers are queried in the order they have been created.
///< As soon as one of the EPG handlers returns true in a member function,
///< none of the remaining handlers will be queried. If none of the EPG
///< handlers returns true in a particular call, the default processing
///< will take place.
///< EPG handlers will be deleted automatically at the end of the program.
virtual ~cEpgHandler();
virtual bool IgnoreChannel(const cChannel *Channel) { return false; }
///< Before any EIT data for the given Channel is processed, the EPG handlers
///< are asked whether this Channel shall be completely ignored. If any of
///< the EPG handlers returns true in this function, no EIT data at all will
///< be processed for this Channel.
virtual bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version) { return false; }
///< Before the raw EitEvent for the given Schedule is processed, 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
///< incoming section data.
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; }
virtual bool SetDescription(cEvent *Event, const char *Description) { return false; }
virtual bool SetContents(cEvent *Event, uchar *Contents) { return false; }
virtual bool SetParentalRating(cEvent *Event, int ParentalRating) { return false; }
virtual bool SetStartTime(cEvent *Event, time_t StartTime) { return false; }
virtual bool SetDuration(cEvent *Event, int Duration) { return false; }
virtual bool SetVps(cEvent *Event, time_t Vps) { return false; }
virtual bool FixEpgBugs(cEvent *Event) { return false; }
///< Fixes some known problems with EPG data.
virtual bool HandleEvent(cEvent *Event) { return false; }
///< After all modifications of the Event have been done, the EPG handler
///< can take a final look at it.
virtual bool SortSchedule(cSchedule *Schedule) { return false; }
///< Sorts the Schedule after the complete table has been processed.
virtual bool DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) { return false; }
///< Takes a look at all EPG events between SegmentStart and SegmentEnd and
///< drops outdated events.
};
class cEpgHandlers : public cList<cEpgHandler> {
public:
bool IgnoreChannel(const cChannel *Channel);
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version);
void SetEventID(cEvent *Event, tEventID EventID);
void SetTitle(cEvent *Event, const char *Title);
void SetShortText(cEvent *Event, const char *ShortText);
void SetDescription(cEvent *Event, const char *Description);
void SetContents(cEvent *Event, uchar *Contents);
void SetParentalRating(cEvent *Event, int ParentalRating);
void SetStartTime(cEvent *Event, time_t StartTime);
void SetDuration(cEvent *Event, int Duration);
void SetVps(cEvent *Event, time_t Vps);
void FixEpgBugs(cEvent *Event);
void HandleEvent(cEvent *Event);
void SortSchedule(cSchedule *Schedule);
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version);
};
extern cEpgHandlers EpgHandlers;
#endif //__EPG_H