Go to the documentation of this file.
38 #define VALID_TIME (31536000 * 2) // two years
61 int LastIndex =
Index(LastTableId);
65 for (
int i = 0; i <= LastIndex; i++) {
90 EitTablesHash.
Add(EitTables, HashId);
93 if (Tid != 0x4E && !Process)
96 time_t Now = time(NULL);
107 ChannelsStateKey.
Remove(
false);
114 ChannelsStateKey.
Remove(
false);
120 if (pSchedule->
OnActualTp(Tid) && (Tid & 0xF0) == 0x60) {
121 SchedulesStateKey.
Remove(
false);
122 ChannelsStateKey.
Remove(
false);
127 SchedulesStateKey.
Remove(
false);
128 ChannelsStateKey.
Remove(
false);
132 bool ChannelsModified =
false;
136 bool Modified =
false;
138 time_t SegmentStart = 0;
139 time_t SegmentEnd = 0;
141 localtime_r(&Now, &t);
150 if (StartTime == 0 || StartTime > 0 && Duration == 0)
154 if (StartTime + Duration < LingerLimit)
157 SegmentStart = StartTime;
158 SegmentEnd = StartTime + Duration;
168 if (Tid == 0x4E || (Tid & 0xF0) == 0x50)
172 if (!pEvent || handledExternally) {
180 if (!handledExternally)
188 if (TableID == 0x4E && Tid != 0x4E)
211 int OverrideStatus = -1;
218 if (OverrideStatus >= 0) {
234 int LanguagePreferenceShort = -1;
235 int LanguagePreferenceExt = -1;
236 bool UseExtendedEventDescriptor =
false;
247 delete ExtendedEventDescriptors;
249 UseExtendedEventDescriptor =
true;
251 if (UseExtendedEventDescriptor) {
252 if (ExtendedEventDescriptors->
Add(eed))
256 UseExtendedEventDescriptor =
false;
262 delete ShortEventDescriptor;
263 ShortEventDescriptor = sed;
283 int LanguagePreferenceRating = -1;
288 int ParentalRating = (Rating.
getRating() & 0xFF);
289 switch (ParentalRating) {
291 case 0x01 ... 0x0F: ParentalRating += 3;
break;
293 case 0x11: ParentalRating = 10;
break;
294 case 0x12: ParentalRating = 12;
break;
295 case 0x13: ParentalRating = 16;
break;
296 default: ParentalRating = 0;
306 int month = t.tm_mon;
312 if (month == 11 && t.tm_mon == 0)
314 else if (month == 0 && t.tm_mon == 11)
316 time_t vps = mktime(&t);
337 bool hit = StartTime <= Now && Now < StartTime + Duration;
343 if (link != Channel) {
346 ChannelsModified |= link->
SetName(linkName,
"",
"");
353 ChannelsModified =
true;
373 if ((1 <= Stream && Stream <= 6 && Type != 0)
374 || (Stream == 9 && Ext < 2)) {
390 if (ShortEventDescriptor) {
399 if (ExtendedEventDescriptors) {
406 delete ExtendedEventDescriptors;
407 delete ShortEventDescriptor;
416 if (handledExternally)
427 if (Modified && (Tid >= 0x50 || Complete)) {
437 SchedulesStateKey.
Remove(Modified);
438 ChannelsStateKey.
Remove(ChannelsModified);
443 #define MAX_TIME_DIFF 1 // number of seconds the local time may differ from dvb time before making any corrections
444 #define MAX_ADJ_DIFF 10 // number of seconds the local time may differ from dvb time to allow smooth adjustment
445 #define ADJ_DELTA 300 // number of seconds between calls for smooth time adjustment
459 :
SI::TDT(Data, false)
464 time_t loctim = time(NULL);
466 int diff = dvbtim - loctim;
472 if (clock_settime(CLOCK_REALTIME, &ts) == 0)
475 esyslog(
"ERROR while setting system time: %m");
482 if (adjtime(&delta, NULL) == 0)
485 esyslog(
"ERROR while adjusting system time: %m");
497 Set(0x12, 0x40, 0xC0);
524 if (Tid == 0x4E || Tid >= 0x50 && Tid <= 0x6F)
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
int getTransportStreamId() const
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
int getReferenceServiceId() const
int Transponder(void)
Returns the transponder of the data delivered to this filter.
bool SetName(const char *Name, const char *ShortName, const char *Provider)
void SortSchedule(cSchedule *Schedule)
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
bool OnActualTp(uchar TableId)
const char * Name(void) const
uchar TableID(void) const
void SetContents(cEvent *Event, uchar *Contents)
bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode, int &OldPreference, int *Position)
Checks the given LanguageCode (which may be something like "eng" or "eng+deu") against the PreferredL...
bool Processed(uchar TableId, uchar LastTableId, int SectionNumber, int LastSectionNumber, int SegmentLastSectionNumber=-1)
Returns true if all sections of the table with the given TableId have been processed.
bool IgnoreChannel(const cChannel *Channel)
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
void SetComponent(int Index, const char *s)
void Add(cListObject *Object, cListObject *After=NULL)
void SetTableEnd(time_t t)
const char * Title(void) const
void SetTableID(uchar TableID)
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
int getLastSectionNumber() const
void SetEventID(cEvent *Event, tEventID EventID)
int NumComponents(void) const
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
const cSchedule * GetSchedule(tChannelID ChannelID) const
bool Check(uchar TableId, uchar Version, int SectionNumber)
cString ToDescr(void) const
int getSectionNumber() const
bool SetLinkChannels(cLinkChannels *LinkChannels)
int getLastTableId() const
int getReferenceEventId() const
void SetVersion(uchar Version)
@ ParentalRatingDescriptorTag
const cEvent * GetEventById(tEventID EventID) const
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
RunningStatus getRunningStatus() const
int getLastDescriptorNumber()
void Add(cListObject *Object, unsigned int Id)
cEitTablesHash eitTablesHash
bool Add(GroupDescriptor *d)
const unsigned char * getData() const
int EPGLanguages[I18N_MAX_LANGUAGES+1]
void SetDuration(cEvent *Event, int Duration)
@ RunningStatusNotRunning
DescriptorTag getDescriptorTag() const
void FixEpgBugs(cEvent *Event)
@ TimeShiftedEventDescriptorTag
const cChannel * GetByTransponderID(tChannelID ChannelID) const
void SetPresentSeen(void)
void EndSegmentTransfer(bool Modified)
cSectionSyncerRandom sectionSyncer[NUM_EIT_TABLES]
int getStreamContentExt() const
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
StructureLoop< Rating > ratingLoop
bool SetPortalName(const char *PortalName)
void SetStartTime(time_t StartTime)
time_t StartTime(void) const
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
void SetVps(cEvent *Event, time_t Vps)
void SetTableStart(time_t t)
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
T * Get(unsigned int Id) const
int getSegmentLastSectionNumber() const
void SetDescription(cEvent *Event, const char *Description)
cChannel * NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid=0)
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
char * getText(const char *separation1="\t", const char *separation2="\n")
static void SetDisableUntil(time_t Time)
int getOriginalNetworkId() const
int getStreamContent() const
@ ShortEventDescriptorTag
bool Complete(void)
Returns true if all sections of all tables have been processed.
bool HasTimer(void) const
time_t getStartTime() const
#define ISTRANSPONDER(f1, f2)
void SetTitle(cEvent *Event, const char *Title)
bool Check(uchar Version, int SectionNumber)
Returns true if Version is not the current version, or the given SectionNumber has not been marked as...
cEvent * AddEvent(cEvent *Event)
int getDescriptorNumber()
time_t getDuration() const
int getContentNibbleLevel1() const
void SetParentalRating(cEvent *Event, int ParentalRating)
DescriptorLoop eventDescriptors
const char * Description(void) const
Descriptor * getNext(Iterator &it)
int getComponentType() const
bool BeginSegmentTransfer(const cChannel *Channel)
@ ExtendedEventDescriptorTag
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")
void SetShortText(cEvent *Event, const char *ShortText)
int RunningStatus(void) const
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
void ClrRunningStatus(cChannel *Channel=NULL)
bool HandledExternally(const cChannel *Channel)
int Source(void)
Returns the source of the data delivered to this filter.
void SetStartTime(cEvent *Event, time_t StartTime)
StructureLoop< Nibble > nibbleLoop
int getContentNibbleLevel2() const
cEIT(cEitTablesHash &EitTablesHash, int Source, u_char Tid, const u_char *Data)
const cEvent * GetEventByTime(time_t StartTime) const
StructureLoop< Event > eventLoop
int getOriginalNetworkId() const
void SetDuration(int Duration)
void HandleEvent(cEvent *Event)
int getVersionNumber() const
const char * ShortText(void) const
int getTransportStreamId() const
static time_t disableUntil
void SetComponents(cEvent *Event, cComponents *Components)
LinkageType getLinkageType() const