vdr  2.4.1
eit.c
Go to the documentation of this file.
1 /*
2  * eit.c: EIT section filter
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * Original version (as used in VDR before 1.3.0) written by
8  * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
9  * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
10  *
11  * $Id: eit.c 4.5.1.2 2019/05/21 21:25:00 kls Exp $
12  */
13 
14 #include "eit.h"
15 #include <sys/time.h>
16 #include "epg.h"
17 #include "i18n.h"
18 #include "libsi/section.h"
19 #include "libsi/descriptor.h"
20 
21 #define VALID_TIME (31536000 * 2) // two years
22 
23 #define DBGEIT 0
24 
25 // --- cEIT ------------------------------------------------------------------
26 
27 class cEIT : public SI::EIT {
28 public:
29  cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data);
30  };
31 
32 cEIT::cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data)
33 :SI::EIT(Data, false)
34 {
35  if (!CheckCRCAndParse())
36  return;
37  int HashId = Tid * getServiceId();
38  cSectionSyncerEntry *SectionSyncerEntry = SectionSyncerHash.Get(HashId);
39  if (!SectionSyncerEntry) {
40  SectionSyncerEntry = new cSectionSyncerEntry;
41  SectionSyncerHash.Add(SectionSyncerEntry, HashId);
42  }
43  bool Process = SectionSyncerEntry->Sync(getVersionNumber(), getSectionNumber(), getLastSectionNumber());
44  if (Tid != 0x4E && !Process) // we need to set the 'seen' tag to watch the running status of the present/following event
45  return;
46 
47  time_t Now = time(NULL);
48  if (Now < VALID_TIME)
49  return; // we need the current time for handling PDC descriptors
50 
51  cStateKey ChannelsStateKey;
52  cChannels *Channels = cChannels::GetChannelsWrite(ChannelsStateKey, 10);
53  if (!Channels) {
54  SectionSyncerEntry->Repeat(); // let's not miss any section of the EIT
55  return;
56  }
58  cChannel *Channel = Channels->GetByChannelID(channelID, true);
59  if (!Channel || EpgHandlers.IgnoreChannel(Channel)) {
60  ChannelsStateKey.Remove(false);
61  return;
62  }
63 
64  cStateKey SchedulesStateKey;
65  cSchedules *Schedules = cSchedules::GetSchedulesWrite(SchedulesStateKey, 10);
66  if (!Schedules) {
67  SectionSyncerEntry->Repeat(); // let's not miss any section of the EIT
68  ChannelsStateKey.Remove(false);
69  return;
70  }
71 
72  if (!EpgHandlers.BeginSegmentTransfer(Channel)) {
73  SchedulesStateKey.Remove(false);
74  ChannelsStateKey.Remove(false);
75  return;
76  }
77 
78  bool ChannelsModified = false;
79  bool handledExternally = EpgHandlers.HandledExternally(Channel);
80  cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(Channel, true);
81 
82  bool Empty = true;
83  bool Modified = false;
84  time_t LingerLimit = Now - Setup.EPGLinger * 60;
85  time_t SegmentStart = 0;
86  time_t SegmentEnd = 0;
87  struct tm t = { 0 };
88  localtime_r(&Now, &t); // this initializes the time zone in 't'
89 
90  SI::EIT::Event SiEitEvent;
91  for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) {
92  if (EpgHandlers.HandleEitEvent(pSchedule, &SiEitEvent, Tid, getVersionNumber()))
93  continue; // an EPG handler has done all of the processing
94  time_t StartTime = SiEitEvent.getStartTime();
95  int Duration = SiEitEvent.getDuration();
96  // Drop bogus events - but keep NVOD reference events, where all bits of the start time field are set to 1, resulting in a negative number.
97  if (StartTime == 0 || StartTime > 0 && Duration == 0)
98  continue;
99  Empty = false;
100  // Ignore events that ended before the "EPG linger time":
101  if (StartTime + Duration < LingerLimit)
102  continue;
103  if (!SegmentStart)
104  SegmentStart = StartTime;
105  SegmentEnd = StartTime + Duration;
106  cEvent *newEvent = NULL;
107  cEvent *rEvent = NULL;
108  cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), StartTime);
109  if (!pEvent || handledExternally) {
110  if (handledExternally && !EpgHandlers.IsUpdate(SiEitEvent.getEventId(), StartTime, Tid, getVersionNumber()))
111  continue;
112  // If we don't have that event yet, we create a new one.
113  // Otherwise we copy the information into the existing event anyway, because the data might have changed.
114  pEvent = newEvent = new cEvent(SiEitEvent.getEventId());
115  newEvent->SetStartTime(StartTime);
116  newEvent->SetDuration(Duration);
117  if (!handledExternally)
118  pSchedule->AddEvent(newEvent);
119  }
120  else {
121  // We have found an existing event, either through its event ID or its start time.
122  pEvent->SetSeen();
123  uchar TableID = max(pEvent->TableID(), uchar(0x4E)); // for backwards compatibility, table ids less than 0x4E are treated as if they were "present"
124  // If the new event has a higher table ID, let's skip it.
125  // The lower the table ID, the more "current" the information.
126  if (Tid > TableID)
127  continue;
128  EpgHandlers.SetEventID(pEvent, SiEitEvent.getEventId()); // unfortunately some stations use different event ids for the same event in different tables :-(
129  EpgHandlers.SetStartTime(pEvent, StartTime);
130  EpgHandlers.SetDuration(pEvent, Duration);
131  }
132  if (pEvent->TableID() > 0x4E) // for backwards compatibility, table ids less than 0x4E are never overwritten
133  pEvent->SetTableID(Tid);
134  if (Tid == 0x4E) { // we trust only the present/following info on the actual TS
135  int RunningStatus = SiEitEvent.getRunningStatus();
136 #if DBGEIT
137  if (Process)
138  dsyslog("channel %d (%s) event %s status %d (raw data from '%s' section)", Channel->Number(), Channel->Name(), *pEvent->ToDescr(), RunningStatus, getSectionNumber() ? "following" : "present");
139 #endif
141  // Workaround for broadcasters who set an event to status "not running" where
142  // this is inappropriate:
143  if (RunningStatus != pEvent->RunningStatus()) { // if the running status of the event has changed...
144  if (RunningStatus == SI::RunningStatusNotRunning) { // ...and the new status is "not running"...
145  int OverrideStatus = -1;
146  if (getSectionNumber() == 0) { // ...and if this the "present" event...
147  if (pEvent->RunningStatus() == SI::RunningStatusPausing) // ...and if the event has already been set to "pausing"...
148  OverrideStatus = SI::RunningStatusPausing; // ...then we ignore the faulty new status and stay with "pausing"
149  }
150  else // ...and if this is the "following" event...
151  OverrideStatus = SI::RunningStatusUndefined; // ...then we ignore the faulty new status and fall back to "undefined"
152  if (OverrideStatus >= 0) {
153 #if DBGEIT
154  if (Process)
155  dsyslog("channel %d (%s) event %s status %d (ignored status %d from '%s' section)", Channel->Number(), Channel->Name(), *pEvent->ToDescr(), OverrideStatus, RunningStatus, getSectionNumber() ? "following" : "present");
156 #endif
157  RunningStatus = OverrideStatus;
158  }
159  }
160  }
161  pSchedule->SetRunningStatus(pEvent, RunningStatus, Channel);
162  }
163  if (!Process)
164  continue;
165  }
166  pEvent->SetVersion(getVersionNumber());
167 
168  int LanguagePreferenceShort = -1;
169  int LanguagePreferenceExt = -1;
170  bool UseExtendedEventDescriptor = false;
171  SI::Descriptor *d;
172  SI::ExtendedEventDescriptors *ExtendedEventDescriptors = NULL;
173  SI::ShortEventDescriptor *ShortEventDescriptor = NULL;
174  cLinkChannels *LinkChannels = NULL;
175  cComponents *Components = NULL;
176  for (SI::Loop::Iterator it2; (d = SiEitEvent.eventDescriptors.getNext(it2)); ) {
177  switch (d->getDescriptorTag()) {
180  if (I18nIsPreferredLanguage(Setup.EPGLanguages, eed->languageCode, LanguagePreferenceExt) || !ExtendedEventDescriptors) {
181  delete ExtendedEventDescriptors;
182  ExtendedEventDescriptors = new SI::ExtendedEventDescriptors;
183  UseExtendedEventDescriptor = true;
184  }
185  if (UseExtendedEventDescriptor) {
186  if (ExtendedEventDescriptors->Add(eed))
187  d = NULL; // so that it is not deleted
188  }
189  if (eed->getDescriptorNumber() == eed->getLastDescriptorNumber())
190  UseExtendedEventDescriptor = false;
191  }
192  break;
195  if (I18nIsPreferredLanguage(Setup.EPGLanguages, sed->languageCode, LanguagePreferenceShort) || !ShortEventDescriptor) {
196  delete ShortEventDescriptor;
197  ShortEventDescriptor = sed;
198  d = NULL; // so that it is not deleted
199  }
200  }
201  break;
205  int NumContents = 0;
206  uchar Contents[MaxEventContents] = { 0 };
207  for (SI::Loop::Iterator it3; cd->nibbleLoop.getNext(Nibble, it3); ) {
208  if (NumContents < MaxEventContents) {
209  Contents[NumContents] = ((Nibble.getContentNibbleLevel1() & 0xF) << 4) | (Nibble.getContentNibbleLevel2() & 0xF);
210  NumContents++;
211  }
212  }
213  EpgHandlers.SetContents(pEvent, Contents);
214  }
215  break;
217  int LanguagePreferenceRating = -1;
220  for (SI::Loop::Iterator it3; prd->ratingLoop.getNext(Rating, it3); ) {
221  if (I18nIsPreferredLanguage(Setup.EPGLanguages, Rating.languageCode, LanguagePreferenceRating)) {
222  int ParentalRating = (Rating.getRating() & 0xFF);
223  switch (ParentalRating) {
224  // values defined by the DVB standard (minimum age = rating + 3 years):
225  case 0x01 ... 0x0F: ParentalRating += 3; break;
226  // values defined by broadcaster CSAT (now why didn't they just use 0x07, 0x09 and 0x0D?):
227  case 0x11: ParentalRating = 10; break;
228  case 0x12: ParentalRating = 12; break;
229  case 0x13: ParentalRating = 16; break;
230  default: ParentalRating = 0;
231  }
232  EpgHandlers.SetParentalRating(pEvent, ParentalRating);
233  }
234  }
235  }
236  break;
237  case SI::PDCDescriptorTag: {
239  t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
240  int month = t.tm_mon;
241  t.tm_mon = pd->getMonth() - 1;
242  t.tm_mday = pd->getDay();
243  t.tm_hour = pd->getHour();
244  t.tm_min = pd->getMinute();
245  t.tm_sec = 0;
246  if (month == 11 && t.tm_mon == 0) // current month is dec, but event is in jan
247  t.tm_year++;
248  else if (month == 0 && t.tm_mon == 11) // current month is jan, but event is in dec
249  t.tm_year--;
250  time_t vps = mktime(&t);
251  EpgHandlers.SetVps(pEvent, vps);
252  }
253  break;
256  cSchedule *rSchedule = (cSchedule *)Schedules->GetSchedule(tChannelID(Source, Channel->Nid(), Channel->Tid(), tsed->getReferenceServiceId()));
257  if (!rSchedule)
258  break;
259  rEvent = (cEvent *)rSchedule->GetEvent(tsed->getReferenceEventId());
260  if (!rEvent)
261  break;
262  EpgHandlers.SetTitle(pEvent, rEvent->Title());
263  EpgHandlers.SetShortText(pEvent, rEvent->ShortText());
264  EpgHandlers.SetDescription(pEvent, rEvent->Description());
265  }
266  break;
269  tChannelID linkID(Source, ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId());
270  if (ld->getLinkageType() == SI::LinkageTypePremiere) { // Premiere World
271  bool hit = StartTime <= Now && Now < StartTime + Duration;
272  if (hit) {
273  char linkName[ld->privateData.getLength() + 1];
274  strn0cpy(linkName, (const char *)ld->privateData.getData(), sizeof(linkName));
275  // TODO is there a standard way to determine the character set of this string?
276  cChannel *link = Channels->GetByChannelID(linkID);
277  if (link != Channel) { // only link to other channels, not the same one
278  if (link) {
279  if (Setup.UpdateChannels == 1 || Setup.UpdateChannels >= 3)
280  ChannelsModified |= link->SetName(linkName, "", "");
281  }
282  else if (Setup.UpdateChannels >= 4) {
283  cChannel *Transponder = Channel;
284  if (Channel->Tid() != ld->getTransportStreamId())
285  Transponder = Channels->GetByTransponderID(linkID);
286  link = Channels->NewChannel(Transponder, linkName, "", "", ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId());
287  ChannelsModified = true;
288  //XXX patFilter->Trigger();
289  }
290  if (link) {
291  if (!LinkChannels)
292  LinkChannels = new cLinkChannels;
293  LinkChannels->Add(new cLinkChannel(link));
294  }
295  }
296  else
297  ChannelsModified |= Channel->SetPortalName(linkName);
298  }
299  }
300  }
301  break;
304  uchar Stream = cd->getStreamContent();
305  uchar Type = cd->getComponentType();
306  if (1 <= Stream && Stream <= 6 && Type != 0) { // 1=MPEG2-video, 2=MPEG1-audio, 3=subtitles, 4=AC3-audio, 5=H.264-video, 6=HEAAC-audio
307  if (!Components)
308  Components = new cComponents;
309  char buffer[Utf8BufSize(256)];
310  Components->SetComponent(Components->NumComponents(), Stream, Type, I18nNormalizeLanguageCode(cd->languageCode), cd->description.getText(buffer, sizeof(buffer)));
311  }
312  }
313  break;
314  default: ;
315  }
316  delete d;
317  }
318 
319  if (!rEvent) {
320  if (ShortEventDescriptor) {
321  char buffer[Utf8BufSize(256)];
322  EpgHandlers.SetTitle(pEvent, ShortEventDescriptor->name.getText(buffer, sizeof(buffer)));
323  EpgHandlers.SetShortText(pEvent, ShortEventDescriptor->text.getText(buffer, sizeof(buffer)));
324  }
325  else {
326  EpgHandlers.SetTitle(pEvent, NULL);
327  EpgHandlers.SetShortText(pEvent, NULL);
328  }
329  if (ExtendedEventDescriptors) {
330  char buffer[Utf8BufSize(ExtendedEventDescriptors->getMaximumTextLength(": ")) + 1];
331  EpgHandlers.SetDescription(pEvent, ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": "));
332  }
333  else
334  EpgHandlers.SetDescription(pEvent, NULL);
335  }
336  delete ExtendedEventDescriptors;
337  delete ShortEventDescriptor;
338 
339  EpgHandlers.SetComponents(pEvent, Components);
340 
341  EpgHandlers.FixEpgBugs(pEvent);
342  if (LinkChannels)
343  ChannelsModified |= Channel->SetLinkChannels(LinkChannels);
344  Modified = true;
345  EpgHandlers.HandleEvent(pEvent);
346  if (handledExternally)
347  delete pEvent;
348  }
349  if (Tid == 0x4E) {
350  if (Empty && getSectionNumber() == 0)
351  // ETR 211: an empty entry in section 0 of table 0x4E means there is currently no event running
352  pSchedule->ClrRunningStatus(Channel);
353  pSchedule->SetPresentSeen();
354  }
355  if (Modified) {
356  EpgHandlers.SortSchedule(pSchedule);
357  EpgHandlers.DropOutdated(pSchedule, SegmentStart, SegmentEnd, Tid, getVersionNumber());
358  pSchedule->SetModified();
359  }
360  SchedulesStateKey.Remove(Modified);
361  ChannelsStateKey.Remove(ChannelsModified);
363 }
364 
365 // --- cTDT ------------------------------------------------------------------
366 
367 #define MAX_TIME_DIFF 1 // number of seconds the local time may differ from dvb time before making any corrections
368 #define MAX_ADJ_DIFF 10 // number of seconds the local time may differ from dvb time to allow smooth adjustment
369 #define ADJ_DELTA 300 // number of seconds between calls for smooth time adjustment
370 
371 class cTDT : public SI::TDT {
372 private:
373  static cMutex mutex;
374  static time_t lastAdj;
375 public:
376  cTDT(const u_char *Data);
377  };
378 
380 time_t cTDT::lastAdj = 0;
381 
382 cTDT::cTDT(const u_char *Data)
383 :SI::TDT(Data, false)
384 {
385  CheckParse();
386 
387  time_t dvbtim = getTime();
388  time_t loctim = time(NULL);
389 
390  int diff = dvbtim - loctim;
391  if (abs(diff) > MAX_TIME_DIFF) {
392  mutex.Lock();
393  if (abs(diff) > MAX_ADJ_DIFF) {
394  if (stime(&dvbtim) == 0)
395  isyslog("system time changed from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
396  else
397  esyslog("ERROR while setting system time: %m");
398  }
399  else if (time(NULL) - lastAdj > ADJ_DELTA) {
400  lastAdj = time(NULL);
401  timeval delta;
402  delta.tv_sec = diff;
403  delta.tv_usec = 0;
404  if (adjtime(&delta, NULL) == 0)
405  isyslog("system time adjustment initiated from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
406  else
407  esyslog("ERROR while adjusting system time: %m");
408  }
409  mutex.Unlock();
410  }
411 }
412 
413 // --- cEitFilter ------------------------------------------------------------
414 
415 time_t cEitFilter::disableUntil = 0;
416 
418 {
419  Set(0x12, 0x40, 0xC0); // event info now&next actual/other TS (0x4E/0x4F), future actual/other TS (0x5X/0x6X)
420  Set(0x14, 0x70); // TDT
421 }
422 
424 {
425  cMutexLock MutexLock(&mutex);
426  cFilter::SetStatus(On);
428 }
429 
431 {
432  disableUntil = Time;
433 }
434 
435 void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
436 {
437  cMutexLock MutexLock(&mutex);
438  if (disableUntil) {
439  if (time(NULL) > disableUntil)
440  disableUntil = 0;
441  else
442  return;
443  }
444  switch (Pid) {
445  case 0x12: {
446  if (Tid >= 0x4E && Tid <= 0x6F)
447  cEIT EIT(sectionSyncerHash, Source(), Tid, Data);
448  }
449  break;
450  case 0x14: {
452  cTDT TDT(Data);
453  }
454  break;
455  default: ;
456  }
457 }
int getOriginalNetworkId() const
Definition: section.c:168
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
Definition: channels.c:1018
unsigned char uchar
Definition: tools.h:31
bool SetName(const char *Name, const char *ShortName, const char *Provider)
Definition: channels.c:258
Definition: epg.h:71
int getEventId() const
Definition: section.c:205
void Lock(void)
Definition: thread.c:222
void SetContents(cEvent *Event, uchar *Contents)
Definition: epg.c:1458
StructureLoop< Nibble > nibbleLoop
Definition: descriptor.h:102
StructureLoop< Rating > ratingLoop
Definition: descriptor.h:119
#define dsyslog(a...)
Definition: tools.h:37
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
Definition: epg.c:1395
int getVersionNumber() const
Definition: si.c:84
bool SetPortalName(const char *PortalName)
Definition: channels.c:286
void SetComponent(int Index, const char *s)
Definition: epg.c:77
char * getText()
Definition: si.c:222
cEpgHandlers EpgHandlers
Definition: epg.c:1384
int getOriginalNetworkId() const
Definition: descriptor.c:763
void SetDescription(cEvent *Event, const char *Description)
Definition: epg.c:1449
void SetStartTime(time_t StartTime)
Definition: epg.c:216
void SetDuration(int Duration)
Definition: epg.c:227
StructureLoop< Event > eventLoop
Definition: section.h:182
int getMinute() const
Definition: descriptor.c:831
void Clear(void)
Definition: tools.c:2372
RunningStatus
Definition: si.h:197
void SetTableID(uchar TableID)
Definition: epg.c:167
void Add(cListObject *Object, cListObject *After=NULL)
Definition: tools.c:2152
int getHour() const
Definition: descriptor.c:827
int NumComponents(void) const
Definition: epg.h:59
Definition: eit.c:27
time_t getStartTime() const
Definition: section.c:197
cString ToDescr(void) const
Definition: epg.c:248
static void SetDisableUntil(time_t Time)
Definition: eit.c:430
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
Definition: epg.c:1538
void SetParentalRating(cEvent *Event, int ParentalRating)
Definition: epg.c:1467
int getContentNibbleLevel1() const
Definition: descriptor.c:284
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
Definition: thread.c:859
#define esyslog(a...)
Definition: tools.h:35
void SetTitle(cEvent *Event, const char *Title)
Definition: epg.c:1431
void SetEventID(cEvent *Event, tEventID EventID)
Definition: epg.c:1422
char * strn0cpy(char *dest, const char *src, size_t n)
Definition: tools.c:131
#define ADJ_DELTA
Definition: eit.c:369
int EPGLanguages[I18N_MAX_LANGUAGES+1]
Definition: config.h:290
T max(T a, T b)
Definition: tools.h:60
int Nid(void) const
Definition: channels.h:174
int EPGLinger
Definition: config.h:293
time_t getTime() const
Definition: section.c:254
#define MAX_ADJ_DIFF
Definition: eit.c:368
bool HandledExternally(const cChannel *Channel)
Definition: epg.c:1404
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: eit.c:423
bool BeginSegmentTransfer(const cChannel *Channel)
Definition: epg.c:1547
int getLength() const
Definition: util.h:58
void SetSeen(void)
Definition: epg.c:237
void ClrRunningStatus(cChannel *Channel=NULL)
Definition: epg.c:1035
int TimeTransponder
Definition: config.h:282
Definition: descriptor.c:16
void HandleEvent(cEvent *Event)
Definition: epg.c:1521
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
Definition: channels.c:855
cString TimeToString(time_t t)
Converts the given time to a string of the form "www mmm dd hh:mm:ss yyyy".
Definition: tools.c:1203
void SetStartTime(cEvent *Event, time_t StartTime)
Definition: epg.c:1476
#define VALID_TIME
Definition: eit.c:21
bool Sync(uchar Version, int Number, int LastNumber)
Definition: filter.c:36
Definition: eit.c:371
void CheckParse()
Definition: util.c:182
cChannel * NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid=0)
Definition: channels.c:1113
static cMutex mutex
Definition: eit.c:373
#define ISTRANSPONDER(f1, f2)
Definition: channels.h:18
int getServiceId() const
Definition: descriptor.c:767
int getContentNibbleLevel2() const
Definition: descriptor.c:288
int Source(void)
Returns the source of the data delivered to this filter.
Definition: filter.c:114
cMutex mutex
Definition: eit.h:25
void SetDuration(cEvent *Event, int Duration)
Definition: epg.c:1485
const char * ShortText(void) const
Definition: epg.h:104
bool Add(GroupDescriptor *d)
Definition: si.c:201
static time_t disableUntil
Definition: eit.h:27
int TimeSource
Definition: config.h:281
cSetup Setup
Definition: config.c:372
time_t getDuration() const
Definition: section.c:201
void FixEpgBugs(cEvent *Event)
Definition: epg.c:1512
#define MAX_TIME_DIFF
Definition: eit.c:367
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
Processes the data delivered to this filter.
Definition: eit.c:435
const cSchedule * GetSchedule(tChannelID ChannelID) const
Definition: epg.c:1331
void Repeat(void)
Definition: filter.c:29
const cEvent * GetEvent(tEventID EventID, time_t StartTime=0) const
Definition: epg.c:993
void SortSchedule(cSchedule *Schedule)
Definition: epg.c:1529
Definition: thread.h:67
int Tid(void) const
Definition: channels.h:175
cEitFilter(void)
Definition: eit.c:417
void SetPresentSeen(void)
Definition: epg.h:168
cEvent * AddEvent(cEvent *Event)
Definition: epg.c:933
int getMonth() const
Definition: descriptor.c:823
int getSectionNumber() const
Definition: si.c:88
bool CheckCRCAndParse()
Definition: si.c:65
void SetVps(cEvent *Event, time_t Vps)
Definition: epg.c:1494
const char * Name(void) const
Definition: channels.c:108
T * Get(unsigned int Id) const
Definition: tools.h:882
bool IgnoreChannel(const cChannel *Channel)
Definition: epg.c:1386
int SetSystemTime
Definition: config.h:280
int RunningStatus(void) const
Definition: epg.h:102
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...
Definition: i18n.c:269
const char * Title(void) const
Definition: epg.h:103
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:129
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
Definition: epg.c:1236
const unsigned char * getData() const
Definition: util.h:51
cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data)
Definition: eit.c:32
int getStreamContent() const
Definition: descriptor.c:562
Definition: epg.h:150
unsigned char u_char
Definition: headers.h:24
int UpdateChannels
Definition: config.h:318
bool SetLinkChannels(cLinkChannels *LinkChannels)
Definition: channels.c:487
#define isyslog(a...)
Definition: tools.h:36
static time_t lastAdj
Definition: eit.c:374
int getTransportStreamId() const
Definition: section.c:164
void SetVersion(uchar Version)
Definition: epg.c:172
cSectionSyncerHash sectionSyncerHash
Definition: eit.h:26
void SetModified(void)
Definition: epg.h:167
void Add(cListObject *Object, unsigned int Id)
Definition: tools.c:2351
DescriptorTag getDescriptorTag() const
Definition: si.c:100
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition: filter.c:119
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
Definition: filter.c:162
char * getText(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:86
LinkageType getLinkageType() const
Definition: descriptor.c:771
int getTransportStreamId() const
Definition: descriptor.c:759
void SetComponents(cEvent *Event, cComponents *Components)
Definition: epg.c:1503
int getComponentType() const
Definition: descriptor.c:566
void SetShortText(cEvent *Event, const char *ShortText)
Definition: epg.c:1440
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
Definition: epg.c:1017
uchar TableID(void) const
Definition: epg.h:100
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
Definition: epg.c:1413
const cChannel * GetByTransponderID(tChannelID ChannelID) const
Definition: channels.c:1048
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:238
cTDT(const u_char *Data)
Definition: eit.c:382
void EndSegmentTransfer(bool Modified)
Definition: epg.c:1556
DescriptorLoop eventDescriptors
Definition: section.h:170
Descriptor * getNext(Iterator &it)
Definition: si.c:112
RunningStatus getRunningStatus() const
Definition: section.c:237
int getServiceId() const
Definition: section.c:160
int getDay() const
Definition: descriptor.c:819
int Number(void) const
Definition: channels.h:179
int getLastSectionNumber() const
Definition: si.c:92
#define Utf8BufSize(s)
Definition: tools.h:141
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:81
void Unlock(void)
Definition: thread.c:228
const char * Description(void) const
Definition: epg.h:105