38 #define VALID_TIME (31536000 * 2)
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
444 #define MAX_ADJ_DIFF 10
445 #define ADJ_DELTA 300
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)
#define ISTRANSPONDER(f1, f2)
const unsigned char * getData() const
int getComponentType() const
int getStreamContentExt() const
int getStreamContent() const
int getContentNibbleLevel1() const
int getContentNibbleLevel2() const
StructureLoop< Nibble > nibbleLoop
bool Add(GroupDescriptor *d)
Descriptor * getNext(Iterator &it)
DescriptorTag getDescriptorTag() const
DescriptorLoop eventDescriptors
time_t getDuration() const
time_t getStartTime() const
RunningStatus getRunningStatus() const
int getOriginalNetworkId() const
int getSegmentLastSectionNumber() const
StructureLoop< Event > eventLoop
int getTransportStreamId() const
int getLastTableId() const
int getLastDescriptorNumber()
int getDescriptorNumber()
char * getText(const char *separation1="\t", const char *separation2="\n")
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")
int getOriginalNetworkId() const
int getTransportStreamId() const
LinkageType getLinkageType() const
int getSectionNumber() const
int getLastSectionNumber() const
int getVersionNumber() const
StructureLoop< Rating > ratingLoop
int getReferenceServiceId() const
int getReferenceEventId() const
bool SetName(const char *Name, const char *ShortName, const char *Provider)
bool SetPortalName(const char *PortalName)
bool SetLinkChannels(cLinkChannels *LinkChannels)
const char * Name(void) const
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
cChannel * NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid=0)
const cChannel * GetByTransponderID(tChannelID ChannelID) const
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
int NumComponents(void) const
void SetComponent(int Index, const char *s)
cEIT(cEitTablesHash &EitTablesHash, int Source, u_char Tid, const u_char *Data)
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
static void SetDisableUntil(time_t Time)
cEitTablesHash eitTablesHash
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
static time_t disableUntil
void SetTableStart(time_t t)
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.
cSectionSyncerRandom sectionSyncer[NUM_EIT_TABLES]
bool Complete(void)
Returns true if all sections of all tables have been processed.
void SetTableEnd(time_t t)
bool Check(uchar TableId, uchar Version, int SectionNumber)
void SortSchedule(cSchedule *Schedule)
void EndSegmentTransfer(bool Modified)
bool IgnoreChannel(const cChannel *Channel)
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
void SetStartTime(cEvent *Event, time_t StartTime)
void SetTitle(cEvent *Event, const char *Title)
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
void FixEpgBugs(cEvent *Event)
void HandleEvent(cEvent *Event)
void SetComponents(cEvent *Event, cComponents *Components)
void SetVps(cEvent *Event, time_t Vps)
void SetParentalRating(cEvent *Event, int ParentalRating)
bool BeginSegmentTransfer(const cChannel *Channel)
bool HandledExternally(const cChannel *Channel)
void SetContents(cEvent *Event, uchar *Contents)
void SetShortText(cEvent *Event, const char *ShortText)
void SetDuration(cEvent *Event, int Duration)
void SetDescription(cEvent *Event, const char *Description)
void SetEventID(cEvent *Event, tEventID EventID)
cString ToDescr(void) const
uchar TableID(void) const
int RunningStatus(void) const
time_t StartTime(void) const
void SetStartTime(time_t StartTime)
bool HasTimer(void) const
const char * Title(void) const
void SetVersion(uchar Version)
void SetDuration(int Duration)
const char * ShortText(void) const
void SetTableID(uchar TableID)
const char * Description(void) const
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
int Transponder(void)
Returns the transponder of the data delivered to this filter.
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
int Source(void)
Returns the source of the data delivered to this filter.
void Add(cListObject *Object, unsigned int Id)
T * Get(unsigned int Id) const
void Add(cListObject *Object, cListObject *After=NULL)
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
const cEvent * GetEventByTime(time_t StartTime) const
bool OnActualTp(uchar TableId)
void SetPresentSeen(void)
void ClrRunningStatus(cChannel *Channel=NULL)
const cEvent * GetEventById(tEventID EventID) const
cEvent * AddEvent(cEvent *Event)
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
const cSchedule * GetSchedule(tChannelID ChannelID) const
bool Check(uchar Version, int SectionNumber)
Returns true if Version is not the current version, or the given SectionNumber has not been marked as...
int EPGLanguages[I18N_MAX_LANGUAGES+1]
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
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...
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
@ RunningStatusNotRunning
@ ExtendedEventDescriptorTag
@ ShortEventDescriptorTag
@ ParentalRatingDescriptorTag
@ TimeShiftedEventDescriptorTag