21 #define VALID_TIME (31536000 * 2) // two years
37 if (!SectionSyncerEntry) {
39 SectionSyncerHash.
Add(SectionSyncerEntry, HashId);
42 if (Tid != 0x4E && !Process)
45 time_t Now = time(NULL);
52 SectionSyncerEntry->
Repeat();
58 ChannelsStateKey.
Remove(
false);
65 SectionSyncerEntry->
Repeat();
66 ChannelsStateKey.
Remove(
false);
71 SchedulesStateKey.
Remove(
false);
72 ChannelsStateKey.
Remove(
false);
76 bool ChannelsModified =
false;
81 bool Modified =
false;
83 time_t SegmentStart = 0;
84 time_t SegmentEnd = 0;
86 localtime_r(&Now, &t);
95 if (StartTime == 0 || StartTime > 0 && Duration == 0)
99 if (StartTime + Duration < LingerLimit)
102 SegmentStart = StartTime;
103 SegmentEnd = StartTime + Duration;
107 if (!pEvent || handledExternally) {
115 if (!handledExternally)
140 int LanguagePreferenceShort = -1;
141 int LanguagePreferenceExt = -1;
142 bool UseExtendedEventDescriptor =
false;
153 delete ExtendedEventDescriptors;
155 UseExtendedEventDescriptor =
true;
157 if (UseExtendedEventDescriptor) {
158 if (ExtendedEventDescriptors->
Add(eed))
162 UseExtendedEventDescriptor =
false;
168 delete ShortEventDescriptor;
169 ShortEventDescriptor = sed;
189 int LanguagePreferenceRating = -1;
194 int ParentalRating = (Rating.
getRating() & 0xFF);
195 switch (ParentalRating) {
197 case 0x01 ... 0x0F: ParentalRating += 3;
break;
199 case 0x11: ParentalRating = 10;
break;
200 case 0x12: ParentalRating = 12;
break;
201 case 0x13: ParentalRating = 16;
break;
202 default: ParentalRating = 0;
212 int month = t.tm_mon;
218 if (month == 11 && t.tm_mon == 0)
220 else if (month == 0 && t.tm_mon == 11)
222 time_t vps = mktime(&t);
243 bool hit = StartTime <= Now && Now < StartTime + Duration;
249 if (link != Channel) {
252 ChannelsModified |= link->
SetName(linkName,
"",
"");
259 ChannelsModified =
true;
278 if (1 <= Stream && Stream <= 6 && Type != 0) {
292 if (ShortEventDescriptor) {
301 if (ExtendedEventDescriptors) {
308 delete ExtendedEventDescriptors;
309 delete ShortEventDescriptor;
318 if (handledExternally)
332 SchedulesStateKey.
Remove(Modified);
333 ChannelsStateKey.
Remove(ChannelsModified);
339 #define MAX_TIME_DIFF 1 // number of seconds the local time may differ from dvb time before making any corrections
340 #define MAX_ADJ_DIFF 10 // number of seconds the local time may differ from dvb time to allow smooth adjustment
341 #define ADJ_DELTA 300 // number of seconds between calls for smooth time adjustment
355 :
SI::TDT(Data, false)
360 time_t loctim = time(NULL);
362 int diff = dvbtim - loctim;
366 if (stime(&dvbtim) == 0)
369 esyslog(
"ERROR while setting system time: %m");
376 if (adjtime(&delta, NULL) == 0)
379 esyslog(
"ERROR while adjusting system time: %m");
392 Set(0x12, 0x40, 0xE0);
420 if (Tid == 0x4E || Tid >= 0x50 && Tid <= 0x5F)
int getOriginalNetworkId() const
int getReferenceEventId() const
bool SetName(const char *Name, const char *ShortName, const char *Provider)
void SetContents(cEvent *Event, uchar *Contents)
StructureLoop< Nibble > nibbleLoop
StructureLoop< Rating > ratingLoop
const cChannel * GetByTransponderID(tChannelID ChannelID) const
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
bool SetPortalName(const char *PortalName)
void SetComponent(int Index, const char *s)
void SetDescription(cEvent *Event, const char *Description)
void SetStartTime(time_t StartTime)
void SetDuration(int Duration)
StructureLoop< Event > eventLoop
void SetTableID(uchar TableID)
void Add(cListObject *Object, cListObject *After=NULL)
static void SetDisableUntil(time_t Time)
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
int getTransportStreamId() const
void SetParentalRating(cEvent *Event, int ParentalRating)
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
void SetTitle(cEvent *Event, const char *Title)
time_t getDuration() const
void SetEventID(cEvent *Event, tEventID EventID)
int EPGLanguages[I18N_MAX_LANGUAGES+1]
DescriptorTag getDescriptorTag() const
bool HandledExternally(const cChannel *Channel)
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
T * Get(unsigned int Id) const
bool BeginSegmentTransfer(const cChannel *Channel)
void ClrRunningStatus(cChannel *Channel=NULL)
void HandleEvent(cEvent *Event)
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
int getSectionNumber() const
void SetStartTime(cEvent *Event, time_t StartTime)
bool Sync(uchar Version, int Number, int LastNumber)
cChannel * NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid=0)
uchar TableID(void) const
#define ISTRANSPONDER(f1, f2)
int getLastDescriptorNumber()
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
int Source(void)
Returns the source of the data delivered to this filter.
int getContentNibbleLevel2() const
const cEvent * GetEvent(tEventID EventID, time_t StartTime=0) const
void SetDuration(cEvent *Event, int Duration)
bool Add(GroupDescriptor *d)
static time_t disableUntil
int getOriginalNetworkId() const
void FixEpgBugs(cEvent *Event)
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
void SortSchedule(cSchedule *Schedule)
LinkageType getLinkageType() const
RunningStatus getRunningStatus() const
int getContentNibbleLevel1() const
void SetPresentSeen(void)
time_t getStartTime() const
cEvent * AddEvent(cEvent *Event)
const char * Title(void) const
void SetVps(cEvent *Event, time_t Vps)
bool IgnoreChannel(const cChannel *Channel)
const cSchedule * GetSchedule(tChannelID ChannelID) const
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...
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
int getDescriptorNumber()
cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data)
int getVersionNumber() const
int getTransportStreamId() const
int getLastSectionNumber() const
int getReferenceServiceId() const
int getStreamContent() const
int NumComponents(void) const
bool SetLinkChannels(cLinkChannels *LinkChannels)
const char * Description(void) const
void SetVersion(uchar Version)
cSectionSyncerHash sectionSyncerHash
void Add(cListObject *Object, unsigned int Id)
int Transponder(void)
Returns the transponder of the data delivered to this filter.
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
char * getText(const char *separation1="\t", const char *separation2="\n")
void SetComponents(cEvent *Event, cComponents *Components)
void SetShortText(cEvent *Event, const char *ShortText)
const char * ShortText(void) const
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
int getComponentType() const
const unsigned char * getData() const
void EndSegmentTransfer(bool Modified)
DescriptorLoop eventDescriptors
Descriptor * getNext(Iterator &it)
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")