vdr  2.4.7
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.11 2020/11/28 21:45:05 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() << 8);
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 Ext = cd->getStreamContentExt();
306  uchar Type = cd->getComponentType();
307  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
308  || (Stream == 9 && Ext < 2)) { // 0x09=HEVC-video, 0x19=AC-4-audio
309  if (!Components)
310  Components = new cComponents;
311  char buffer[Utf8BufSize(256)];
312  if (Stream == 9)
313  Stream |= Ext << 4;
314  Components->SetComponent(Components->NumComponents(), Stream, Type, I18nNormalizeLanguageCode(cd->languageCode), cd->description.getText(buffer, sizeof(buffer)));
315  }
316  }
317  break;
318  default: ;
319  }
320  delete d;
321  }
322 
323  if (!rEvent) {
324  if (ShortEventDescriptor) {
325  char buffer[Utf8BufSize(256)];
326  EpgHandlers.SetTitle(pEvent, ShortEventDescriptor->name.getText(buffer, sizeof(buffer)));
327  EpgHandlers.SetShortText(pEvent, ShortEventDescriptor->text.getText(buffer, sizeof(buffer)));
328  }
329  else {
330  EpgHandlers.SetTitle(pEvent, NULL);
331  EpgHandlers.SetShortText(pEvent, NULL);
332  }
333  if (ExtendedEventDescriptors) {
334  char buffer[Utf8BufSize(ExtendedEventDescriptors->getMaximumTextLength(": ")) + 1];
335  EpgHandlers.SetDescription(pEvent, ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": "));
336  }
337  else
338  EpgHandlers.SetDescription(pEvent, NULL);
339  }
340  delete ExtendedEventDescriptors;
341  delete ShortEventDescriptor;
342 
343  EpgHandlers.SetComponents(pEvent, Components);
344 
345  EpgHandlers.FixEpgBugs(pEvent);
346  if (LinkChannels)
347  ChannelsModified |= Channel->SetLinkChannels(LinkChannels);
348  Modified = true;
349  EpgHandlers.HandleEvent(pEvent);
350  if (handledExternally)
351  delete pEvent;
352  }
353  if (Tid == 0x4E) {
354  if (Empty && getSectionNumber() == 0)
355  // ETR 211: an empty entry in section 0 of table 0x4E means there is currently no event running
356  pSchedule->ClrRunningStatus(Channel);
357  pSchedule->SetPresentSeen();
358  }
359  if (Modified) {
360  EpgHandlers.SortSchedule(pSchedule);
361  EpgHandlers.DropOutdated(pSchedule, SegmentStart, SegmentEnd, Tid, getVersionNumber());
362  pSchedule->SetModified();
363  }
364  SchedulesStateKey.Remove(Modified);
365  ChannelsStateKey.Remove(ChannelsModified);
367 }
368 
369 // --- cTDT ------------------------------------------------------------------
370 
371 #define MAX_TIME_DIFF 1 // number of seconds the local time may differ from dvb time before making any corrections
372 #define MAX_ADJ_DIFF 10 // number of seconds the local time may differ from dvb time to allow smooth adjustment
373 #define ADJ_DELTA 300 // number of seconds between calls for smooth time adjustment
374 
375 class cTDT : public SI::TDT {
376 private:
377  static cMutex mutex;
378  static time_t lastAdj;
379 public:
380  cTDT(const u_char *Data);
381  };
382 
384 time_t cTDT::lastAdj = 0;
385 
386 cTDT::cTDT(const u_char *Data)
387 :SI::TDT(Data, false)
388 {
389  CheckParse();
390 
391  time_t dvbtim = getTime();
392  time_t loctim = time(NULL);
393 
394  int diff = dvbtim - loctim;
395  if (abs(diff) > MAX_TIME_DIFF) {
396  mutex.Lock();
397  if (abs(diff) > MAX_ADJ_DIFF) {
398  timespec ts = {};
399  ts.tv_sec = dvbtim;
400  if (clock_settime(CLOCK_REALTIME, &ts) == 0)
401  isyslog("system time changed from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
402  else
403  esyslog("ERROR while setting system time: %m");
404  }
405  else if (time(NULL) - lastAdj > ADJ_DELTA) {
406  lastAdj = time(NULL);
407  timeval delta;
408  delta.tv_sec = diff;
409  delta.tv_usec = 0;
410  if (adjtime(&delta, NULL) == 0)
411  isyslog("system time adjustment initiated from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
412  else
413  esyslog("ERROR while adjusting system time: %m");
414  }
415  mutex.Unlock();
416  }
417 }
418 
419 // --- cEitFilter ------------------------------------------------------------
420 
421 time_t cEitFilter::disableUntil = 0;
422 
424 {
425  Set(0x12, 0x40, 0xC0); // event info now&next actual/other TS (0x4E/0x4F), future actual/other TS (0x5X/0x6X)
426  Set(0x14, 0x70); // TDT
427 }
428 
430 {
431  cMutexLock MutexLock(&mutex);
432  cFilter::SetStatus(On);
434 }
435 
437 {
438  disableUntil = Time;
439 }
440 
441 void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
442 {
443  cMutexLock MutexLock(&mutex);
444  if (disableUntil) {
445  if (time(NULL) > disableUntil)
446  disableUntil = 0;
447  else
448  return;
449  }
450  switch (Pid) {
451  case 0x12: {
452  if (Tid >= 0x4E && Tid <= 0x6F)
453  cEIT EIT(sectionSyncerHash, Source(), Tid, Data);
454  }
455  break;
456  case 0x14: {
458  cTDT TDT(Data);
459  }
460  break;
461  default: ;
462  }
463 }
#define ISTRANSPONDER(f1, f2)
Definition: channels.h:18
bool CheckCRCAndParse()
Definition: si.c:65
int getLength() const
Definition: util.h:58
const unsigned char * getData() const
Definition: util.h:51
int getComponentType() const
Definition: descriptor.c:575
int getStreamContentExt() const
Definition: descriptor.c:571
int getStreamContent() const
Definition: descriptor.c:567
int getContentNibbleLevel1() const
Definition: descriptor.c:289
int getContentNibbleLevel2() const
Definition: descriptor.c:293
StructureLoop< Nibble > nibbleLoop
Definition: descriptor.h:102
bool Add(GroupDescriptor *d)
Definition: si.c:201
Descriptor * getNext(Iterator &it)
Definition: si.c:112
DescriptorTag getDescriptorTag() const
Definition: si.c:100
DescriptorLoop eventDescriptors
Definition: section.h:170
time_t getDuration() const
Definition: section.c:201
time_t getStartTime() const
Definition: section.c:197
int getEventId() const
Definition: section.c:205
RunningStatus getRunningStatus() const
Definition: section.c:237
int getOriginalNetworkId() const
Definition: section.c:168
StructureLoop< Event > eventLoop
Definition: section.h:182
int getServiceId() const
Definition: section.c:160
int getTransportStreamId() const
Definition: section.c:164
char * getText(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:86
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:81
int getOriginalNetworkId() const
Definition: descriptor.c:772
int getTransportStreamId() const
Definition: descriptor.c:768
int getServiceId() const
Definition: descriptor.c:776
LinkageType getLinkageType() const
Definition: descriptor.c:780
int getSectionNumber() const
Definition: si.c:88
int getLastSectionNumber() const
Definition: si.c:92
int getVersionNumber() const
Definition: si.c:84
int getDay() const
Definition: descriptor.c:828
int getMinute() const
Definition: descriptor.c:840
int getHour() const
Definition: descriptor.c:836
int getMonth() const
Definition: descriptor.c:832
StructureLoop< Rating > ratingLoop
Definition: descriptor.h:119
void CheckParse()
Definition: util.c:182
char * getText()
Definition: si.c:222
time_t getTime() const
Definition: section.c:254
int Nid(void) const
Definition: channels.h:174
bool SetName(const char *Name, const char *ShortName, const char *Provider)
Definition: channels.c:258
int Tid(void) const
Definition: channels.h:175
bool SetPortalName(const char *PortalName)
Definition: channels.c:286
bool SetLinkChannels(cLinkChannels *LinkChannels)
Definition: channels.c:487
int Number(void) const
Definition: channels.h:179
const char * Name(void) const
Definition: channels.c:108
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
Definition: channels.c:855
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:1132
const cChannel * GetByTransponderID(tChannelID ChannelID) const
Definition: channels.c:1067
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
Definition: channels.c:1037
int NumComponents(void) const
Definition: epg.h:59
void SetComponent(int Index, const char *s)
Definition: epg.c:77
Definition: eit.c:27
cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data)
Definition: eit.c:32
cMutex mutex
Definition: eit.h:25
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:441
static void SetDisableUntil(time_t Time)
Definition: eit.c:436
cSectionSyncerHash sectionSyncerHash
Definition: eit.h:26
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: eit.c:429
cEitFilter(void)
Definition: eit.c:423
static time_t disableUntil
Definition: eit.h:27
void SortSchedule(cSchedule *Schedule)
Definition: epg.c:1534
void EndSegmentTransfer(bool Modified)
Definition: epg.c:1561
bool IgnoreChannel(const cChannel *Channel)
Definition: epg.c:1391
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
Definition: epg.c:1400
void SetStartTime(cEvent *Event, time_t StartTime)
Definition: epg.c:1481
void SetTitle(cEvent *Event, const char *Title)
Definition: epg.c:1436
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
Definition: epg.c:1543
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
Definition: epg.c:1418
void FixEpgBugs(cEvent *Event)
Definition: epg.c:1517
void HandleEvent(cEvent *Event)
Definition: epg.c:1526
void SetComponents(cEvent *Event, cComponents *Components)
Definition: epg.c:1508
void SetVps(cEvent *Event, time_t Vps)
Definition: epg.c:1499
void SetParentalRating(cEvent *Event, int ParentalRating)
Definition: epg.c:1472
bool BeginSegmentTransfer(const cChannel *Channel)
Definition: epg.c:1552
bool HandledExternally(const cChannel *Channel)
Definition: epg.c:1409
void SetContents(cEvent *Event, uchar *Contents)
Definition: epg.c:1463
void SetShortText(cEvent *Event, const char *ShortText)
Definition: epg.c:1445
void SetDuration(cEvent *Event, int Duration)
Definition: epg.c:1490
void SetDescription(cEvent *Event, const char *Description)
Definition: epg.c:1454
void SetEventID(cEvent *Event, tEventID EventID)
Definition: epg.c:1427
Definition: epg.h:71
cString ToDescr(void) const
Definition: epg.c:248
void SetSeen(void)
Definition: epg.c:237
uchar TableID(void) const
Definition: epg.h:100
int RunningStatus(void) const
Definition: epg.h:102
void SetStartTime(time_t StartTime)
Definition: epg.c:216
const char * Title(void) const
Definition: epg.h:103
void SetVersion(uchar Version)
Definition: epg.c:172
void SetDuration(int Duration)
Definition: epg.c:227
const char * ShortText(void) const
Definition: epg.h:104
void SetTableID(uchar TableID)
Definition: epg.c:167
const char * Description(void) const
Definition: epg.h:105
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
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition: filter.c:119
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:129
int Source(void)
Returns the source of the data delivered to this filter.
Definition: filter.c:114
void Clear(void)
Definition: tools.c:2378
void Add(cListObject *Object, unsigned int Id)
Definition: tools.c:2357
T * Get(unsigned int Id) const
Definition: tools.h:886
void Add(cListObject *Object, cListObject *After=NULL)
Definition: tools.c:2158
Definition: thread.h:67
void Lock(void)
Definition: thread.c:222
void Unlock(void)
Definition: thread.c:228
Definition: epg.h:150
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
Definition: epg.c:1017
const cEvent * GetEvent(tEventID EventID, time_t StartTime=0) const
Definition: epg.c:993
void SetPresentSeen(void)
Definition: epg.h:168
void ClrRunningStatus(cChannel *Channel=NULL)
Definition: epg.c:1035
void SetModified(void)
Definition: epg.h:167
cEvent * AddEvent(cEvent *Event)
Definition: epg.c:933
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
Definition: epg.c:1236
const cSchedule * GetSchedule(tChannelID ChannelID) const
Definition: epg.c:1336
int EPGLanguages[I18N_MAX_LANGUAGES+1]
Definition: config.h:290
int UpdateChannels
Definition: config.h:318
int EPGLinger
Definition: config.h:293
int TimeTransponder
Definition: config.h:282
int SetSystemTime
Definition: config.h:280
int TimeSource
Definition: config.h:281
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
Definition: thread.c:859
Definition: eit.c:375
static cMutex mutex
Definition: eit.c:377
cTDT(const u_char *Data)
Definition: eit.c:386
static time_t lastAdj
Definition: eit.c:378
cSetup Setup
Definition: config.c:372
#define MAX_ADJ_DIFF
Definition: eit.c:372
#define MAX_TIME_DIFF
Definition: eit.c:371
#define VALID_TIME
Definition: eit.c:21
#define ADJ_DELTA
Definition: eit.c:373
cEpgHandlers EpgHandlers
Definition: epg.c:1389
@ MaxEventContents
Definition: epg.h:23
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:315
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:284
Definition: descriptor.c:16
RunningStatus
Definition: si.h:197
@ RunningStatusUndefined
Definition: si.h:197
@ RunningStatusPausing
Definition: si.h:200
@ RunningStatusNotRunning
Definition: si.h:198
@ ExtendedEventDescriptorTag
Definition: si.h:92
@ ShortEventDescriptorTag
Definition: si.h:91
@ ComponentDescriptorTag
Definition: si.h:94
@ ParentalRatingDescriptorTag
Definition: si.h:99
@ PDCDescriptorTag
Definition: si.h:119
@ ContentDescriptorTag
Definition: si.h:98
@ TimeShiftedEventDescriptorTag
Definition: si.h:93
@ LinkageDescriptorTag
Definition: si.h:88
@ LinkageTypePremiere
Definition: si.h:214
unsigned char u_char
Definition: headers.h:24
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:1209
char * strn0cpy(char *dest, const char *src, size_t n)
Definition: tools.c:131
unsigned char uchar
Definition: tools.h:31
#define dsyslog(a...)
Definition: tools.h:37
T max(T a, T b)
Definition: tools.h:59
#define esyslog(a...)
Definition: tools.h:35
#define Utf8BufSize(s)
Definition: tools.h:139
#define isyslog(a...)
Definition: tools.h:36