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  timespec ts = {};
395  ts.tv_sec = dvbtim;
396  if (clock_settime(CLOCK_REALTIME, &ts) == 0)
397  isyslog("system time changed from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
398  else
399  esyslog("ERROR while setting system time: %m");
400  }
401  else if (time(NULL) - lastAdj > ADJ_DELTA) {
402  lastAdj = time(NULL);
403  timeval delta;
404  delta.tv_sec = diff;
405  delta.tv_usec = 0;
406  if (adjtime(&delta, NULL) == 0)
407  isyslog("system time adjustment initiated from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(dvbtim), dvbtim);
408  else
409  esyslog("ERROR while adjusting system time: %m");
410  }
411  mutex.Unlock();
412  }
413 }
414 
415 // --- cEitFilter ------------------------------------------------------------
416 
417 time_t cEitFilter::disableUntil = 0;
418 
420 {
421  Set(0x12, 0x40, 0xC0); // event info now&next actual/other TS (0x4E/0x4F), future actual/other TS (0x5X/0x6X)
422  Set(0x14, 0x70); // TDT
423 }
424 
426 {
427  cMutexLock MutexLock(&mutex);
428  cFilter::SetStatus(On);
430 }
431 
433 {
434  disableUntil = Time;
435 }
436 
437 void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
438 {
439  cMutexLock MutexLock(&mutex);
440  if (disableUntil) {
441  if (time(NULL) > disableUntil)
442  disableUntil = 0;
443  else
444  return;
445  }
446  switch (Pid) {
447  case 0x12: {
448  if (Tid >= 0x4E && Tid <= 0x6F)
449  cEIT EIT(sectionSyncerHash, Source(), Tid, Data);
450  }
451  break;
452  case 0x14: {
454  cTDT TDT(Data);
455  }
456  break;
457  default: ;
458  }
459 }
cEpgHandlers::HandleEitEvent
bool HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version)
Definition: epg.c:1395
SI::LinkageDescriptor::getTransportStreamId
int getTransportStreamId() const
Definition: descriptor.c:769
cFilter::SetStatus
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:129
SI::TimeShiftedEventDescriptor::getReferenceServiceId
int getReferenceServiceId() const
Definition: descriptor.c:277
MAX_ADJ_DIFF
#define MAX_ADJ_DIFF
Definition: eit.c:368
cEitFilter::mutex
cMutex mutex
Definition: eit.h:25
cFilter::Transponder
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition: filter.c:119
cChannel::SetName
bool SetName(const char *Name, const char *ShortName, const char *Provider)
Definition: channels.c:258
EpgHandlers
cEpgHandlers EpgHandlers
Definition: epg.c:1384
cEpgHandlers::SortSchedule
void SortSchedule(cSchedule *Schedule)
Definition: epg.c:1529
cFilter::Set
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
SI::Loop::Iterator
Definition: si.h:333
cEIT::cEIT
cEIT(cSectionSyncerHash &SectionSyncerHash, int Source, u_char Tid, const u_char *Data)
Definition: eit.c:32
SI::PDCDescriptor::getDay
int getDay() const
Definition: descriptor.c:829
cChannel::Name
const char * Name(void) const
Definition: channels.c:108
cEvent::TableID
uchar TableID(void) const
Definition: epg.h:100
VALID_TIME
#define VALID_TIME
Definition: eit.c:21
SI::LinkageDescriptor
Definition: descriptor.h:469
eit.h
cChannel::Number
int Number(void) const
Definition: channels.h:179
SI::ParentalRatingDescriptor::Rating::getRating
int getRating() const
Definition: descriptor.c:319
cEpgHandlers::SetContents
void SetContents(cEvent *Event, uchar *Contents)
Definition: epg.c:1458
cSetup::SetSystemTime
int SetSystemTime
Definition: config.h:280
I18nIsPreferredLanguage
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
SI::ShortEventDescriptor::text
String text
Definition: descriptor.h:45
section.h
SI::EIT::Event::getEventId
int getEventId() const
Definition: section.c:215
SI::CRCSection::CheckCRCAndParse
bool CheckCRCAndParse()
Definition: si.c:75
cEpgHandlers::IgnoreChannel
bool IgnoreChannel(const cChannel *Channel)
Definition: epg.c:1386
SI::ComponentDescriptorTag
@ ComponentDescriptorTag
Definition: si.h:104
cEitFilter::Process
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:437
cComponents::SetComponent
void SetComponent(int Index, const char *s)
Definition: epg.c:77
cHashBase::Clear
void Clear(void)
Definition: tools.c:2372
SI::EIT::getServiceId
int getServiceId() const
Definition: section.c:170
cListBase::Add
void Add(cListObject *Object, cListObject *After=NULL)
Definition: tools.c:2152
cSetup::UpdateChannels
int UpdateChannels
Definition: config.h:318
cEvent::Title
const char * Title(void) const
Definition: epg.h:103
cEvent::SetTableID
void SetTableID(uchar TableID)
Definition: epg.c:167
SI::u_char
unsigned char u_char
Definition: headers.h:38
cEvent
Definition: epg.h:71
cChannels::GetChannelsWrite
static cChannels * GetChannelsWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of channels for write access.
Definition: channels.c:855
cMutexLock
Definition: thread.h:141
SI::NumberedSection::getLastSectionNumber
int getLastSectionNumber() const
Definition: si.c:102
tChannelID
Definition: channels.h:49
cEpgHandlers::SetEventID
void SetEventID(cEvent *Event, tEventID EventID)
Definition: epg.c:1422
SI::EIT
Definition: section.h:160
cComponents::NumComponents
int NumComponents(void) const
Definition: epg.h:59
Setup
cSetup Setup
Definition: config.c:372
SI::LinkageDescriptor::privateData
CharArray privateData
Definition: descriptor.h:478
cEpgHandlers::DropOutdated
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version)
Definition: epg.c:1538
cSchedules::GetSchedule
const cSchedule * GetSchedule(tChannelID ChannelID) const
Definition: epg.c:1331
cEvent::ToDescr
cString ToDescr(void) const
Definition: epg.c:248
SI::NumberedSection::getSectionNumber
int getSectionNumber() const
Definition: si.c:98
cStateKey
Definition: thread.h:233
cChannel::SetLinkChannels
bool SetLinkChannels(cLinkChannels *LinkChannels)
Definition: channels.c:487
cChannel::Nid
int Nid(void) const
Definition: channels.h:174
SI::PDCDescriptor::getMonth
int getMonth() const
Definition: descriptor.c:833
SI::TimeShiftedEventDescriptor::getReferenceEventId
int getReferenceEventId() const
Definition: descriptor.c:281
cSectionSyncer::Repeat
void Repeat(void)
Definition: filter.c:29
cEitFilter::sectionSyncerHash
cSectionSyncerHash sectionSyncerHash
Definition: eit.h:26
cMutex
Definition: thread.h:67
cTDT::cTDT
cTDT(const u_char *Data)
Definition: eit.c:382
cEvent::SetVersion
void SetVersion(uchar Version)
Definition: epg.c:172
SI::ParentalRatingDescriptorTag
@ ParentalRatingDescriptorTag
Definition: si.h:109
SI::ParentalRatingDescriptor::Rating::languageCode
char languageCode[4]
Definition: descriptor.h:121
cEpgHandlers::IsUpdate
bool IsUpdate(tEventID EventID, time_t StartTime, uchar TableID, uchar Version)
Definition: epg.c:1413
cSetup::TimeSource
int TimeSource
Definition: config.h:281
SI::EIT::Event::getRunningStatus
RunningStatus getRunningStatus() const
Definition: section.c:247
SI::ExtendedEventDescriptor::getLastDescriptorNumber
int getLastDescriptorNumber()
Definition: descriptor.c:46
cHashBase::Add
void Add(cListObject *Object, unsigned int Id)
Definition: tools.c:2351
SI::DescriptorGroup::Add
bool Add(GroupDescriptor *d)
Definition: si.c:211
cChannel::Tid
int Tid(void) const
Definition: channels.h:175
SI::PDCDescriptor::getMinute
int getMinute() const
Definition: descriptor.c:841
ADJ_DELTA
#define ADJ_DELTA
Definition: eit.c:369
SI::LinkageTypePremiere
@ LinkageTypePremiere
Definition: si.h:224
SI::RunningStatusPausing
@ RunningStatusPausing
Definition: si.h:210
i18n.h
SI::CharArray::getData
const unsigned char * getData() const
Definition: util.h:51
cSetup::EPGLanguages
int EPGLanguages[I18N_MAX_LANGUAGES+1]
Definition: config.h:290
cEpgHandlers::SetDuration
void SetDuration(cEvent *Event, int Duration)
Definition: epg.c:1485
cTDT::lastAdj
static time_t lastAdj
Definition: eit.c:374
SI::RunningStatusNotRunning
@ RunningStatusNotRunning
Definition: si.h:208
uchar
unsigned char uchar
Definition: tools.h:31
SI::Descriptor::getDescriptorTag
DescriptorTag getDescriptorTag() const
Definition: si.c:110
cEpgHandlers::FixEpgBugs
void FixEpgBugs(cEvent *Event)
Definition: epg.c:1512
SI::LinkageDescriptorTag
@ LinkageDescriptorTag
Definition: si.h:98
SI::TimeShiftedEventDescriptorTag
@ TimeShiftedEventDescriptorTag
Definition: si.h:103
cChannels::GetByTransponderID
const cChannel * GetByTransponderID(tChannelID ChannelID) const
Definition: channels.c:1048
SI::Parsable::CheckParse
void CheckParse()
Definition: util.c:192
cSchedule::SetPresentSeen
void SetPresentSeen(void)
Definition: epg.h:168
cEpgHandlers::EndSegmentTransfer
void EndSegmentTransfer(bool Modified)
Definition: epg.c:1556
cMutex::Unlock
void Unlock(void)
Definition: thread.c:228
SI::ParentalRatingDescriptor
Definition: descriptor.h:117
SI::TimeShiftedEventDescriptor
Definition: descriptor.h:88
cStateKey::Remove
void Remove(bool IncState=true)
Removes this key from the lock it was previously used with.
Definition: thread.c:859
cChannels::GetByChannelID
const cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false) const
Definition: channels.c:1018
SI::ParentalRatingDescriptor::ratingLoop
StructureLoop< Rating > ratingLoop
Definition: descriptor.h:129
cChannels
Definition: channels.h:210
cChannel::SetPortalName
bool SetPortalName(const char *PortalName)
Definition: channels.c:286
cEvent::SetStartTime
void SetStartTime(time_t StartTime)
Definition: epg.c:216
SI::ExtendedEventDescriptors
Definition: descriptor.h:61
SI::ComponentDescriptor
Definition: descriptor.h:305
SI::ExtendedEventDescriptor
Definition: descriptor.h:40
cMutex::Lock
void Lock(void)
Definition: thread.c:222
cSectionSyncerEntry
Definition: eit.h:16
cSchedules::GetSchedulesWrite
static cSchedules * GetSchedulesWrite(cStateKey &StateKey, int TimeoutMs=0)
Gets the list of schedules for write access.
Definition: epg.c:1236
MaxEventContents
@ MaxEventContents
Definition: epg.h:23
cEpgHandlers::SetVps
void SetVps(cEvent *Event, time_t Vps)
Definition: epg.c:1494
SI::ShortEventDescriptor::name
String name
Definition: descriptor.h:44
cSchedule::SetRunningStatus
void SetRunningStatus(cEvent *Event, int RunningStatus, const cChannel *Channel=NULL)
Definition: epg.c:1017
SI::ShortEventDescriptor::languageCode
char languageCode[4]
Definition: descriptor.h:43
cHash::Get
T * Get(unsigned int Id) const
Definition: tools.h:882
SI::LinkageDescriptor::getServiceId
int getServiceId() const
Definition: descriptor.c:777
cEpgHandlers::SetDescription
void SetDescription(cEvent *Event, const char *Description)
Definition: epg.c:1449
dsyslog
#define dsyslog(a...)
Definition: tools.h:37
SI::Descriptor
Definition: si.h:312
cChannels::NewChannel
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
cComponents
Definition: epg.h:51
cChannel
Definition: channels.h:89
I18nNormalizeLanguageCode
const char * I18nNormalizeLanguageCode(const char *Code)
Returns a 3 letter language code that may not be zero terminated.
Definition: i18n.c:238
SI::ExtendedEventDescriptors::getText
char * getText(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:96
cEitFilter::SetDisableUntil
static void SetDisableUntil(time_t Time)
Definition: eit.c:432
SI::PDCDescriptor::getHour
int getHour() const
Definition: descriptor.c:837
SI::RunningStatusUndefined
@ RunningStatusUndefined
Definition: si.h:207
SI::EIT::getOriginalNetworkId
int getOriginalNetworkId() const
Definition: section.c:178
TimeToString
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
SI::ComponentDescriptor::getStreamContent
int getStreamContent() const
Definition: descriptor.c:572
SI
Definition: descriptor.c:16
SI::ShortEventDescriptorTag
@ ShortEventDescriptorTag
Definition: si.h:101
cEIT
Definition: eit.c:27
cLinkChannel
Definition: channels.h:75
Utf8BufSize
#define Utf8BufSize(s)
Definition: tools.h:141
MAX_TIME_DIFF
#define MAX_TIME_DIFF
Definition: eit.c:367
cSchedule::GetEvent
const cEvent * GetEvent(tEventID EventID, time_t StartTime=0) const
Definition: epg.c:993
cSchedules
Definition: epg.h:192
cSectionSyncer::Sync
bool Sync(uchar Version, int Number, int LastNumber)
Definition: filter.c:36
SI::EIT::Event::getStartTime
time_t getStartTime() const
Definition: section.c:207
SI::TDT::getTime
time_t getTime() const
Definition: section.c:264
ISTRANSPONDER
#define ISTRANSPONDER(f1, f2)
Definition: channels.h:18
cLinkChannels
Definition: channels.h:83
cEpgHandlers::SetTitle
void SetTitle(cEvent *Event, const char *Title)
Definition: epg.c:1431
SI::ShortEventDescriptor
Definition: descriptor.h:31
SI::ComponentDescriptor::description
String description
Definition: descriptor.h:311
cSchedule::AddEvent
cEvent * AddEvent(cEvent *Event)
Definition: epg.c:933
SI::RunningStatus
RunningStatus
Definition: si.h:207
cSchedule::SetModified
void SetModified(void)
Definition: epg.h:167
cSetup::EPGLinger
int EPGLinger
Definition: config.h:293
SI::ExtendedEventDescriptor::getDescriptorNumber
int getDescriptorNumber()
Definition: descriptor.c:42
SI::EIT::Event::getDuration
time_t getDuration() const
Definition: section.c:211
SI::ContentDescriptor::Nibble::getContentNibbleLevel1
int getContentNibbleLevel1() const
Definition: descriptor.c:294
cEpgHandlers::SetParentalRating
void SetParentalRating(cEvent *Event, int ParentalRating)
Definition: epg.c:1467
SI::ContentDescriptorTag
@ ContentDescriptorTag
Definition: si.h:108
strn0cpy
char * strn0cpy(char *dest, const char *src, size_t n)
Definition: tools.c:131
SI::EIT::Event::eventDescriptors
DescriptorLoop eventDescriptors
Definition: section.h:180
cEvent::Description
const char * Description(void) const
Definition: epg.h:105
SI::DescriptorLoop::getNext
Descriptor * getNext(Iterator &it)
Definition: si.c:122
max
T max(T a, T b)
Definition: tools.h:60
SI::ExtendedEventDescriptor::languageCode
char languageCode[4]
Definition: descriptor.h:50
SI::ComponentDescriptor::getComponentType
int getComponentType() const
Definition: descriptor.c:576
cEpgHandlers::BeginSegmentTransfer
bool BeginSegmentTransfer(const cChannel *Channel)
Definition: epg.c:1547
SI::EIT::Event
Definition: section.h:164
SI::ExtendedEventDescriptorTag
@ ExtendedEventDescriptorTag
Definition: si.h:102
cSectionSyncerHash
Definition: eit.h:18
SI::ExtendedEventDescriptors::getMaximumTextLength
int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n")
Definition: descriptor.c:91
cEpgHandlers::SetShortText
void SetShortText(cEvent *Event, const char *ShortText)
Definition: epg.c:1440
cEvent::RunningStatus
int RunningStatus(void) const
Definition: epg.h:102
epg.h
SI::ComponentDescriptor::languageCode
char languageCode[4]
Definition: descriptor.h:310
SI::PDCDescriptor
Definition: descriptor.h:504
cEitFilter::SetStatus
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: eit.c:425
cSchedule::ClrRunningStatus
void ClrRunningStatus(cChannel *Channel=NULL)
Definition: epg.c:1035
cEpgHandlers::HandledExternally
bool HandledExternally(const cChannel *Channel)
Definition: epg.c:1404
SI::TDT
Definition: section.h:204
SI::ParentalRatingDescriptor::Rating
Definition: descriptor.h:119
cFilter::Source
int Source(void)
Returns the source of the data delivered to this filter.
Definition: filter.c:114
SI::String::getText
char * getText()
Definition: si.c:232
SI::PDCDescriptorTag
@ PDCDescriptorTag
Definition: si.h:129
cEpgHandlers::SetStartTime
void SetStartTime(cEvent *Event, time_t StartTime)
Definition: epg.c:1476
isyslog
#define isyslog(a...)
Definition: tools.h:36
cSchedule
Definition: epg.h:150
SI::ContentDescriptor::nibbleLoop
StructureLoop< Nibble > nibbleLoop
Definition: descriptor.h:112
SI::ContentDescriptor::Nibble::getContentNibbleLevel2
int getContentNibbleLevel2() const
Definition: descriptor.c:298
SI::CharArray::getLength
int getLength() const
Definition: util.h:58
cTDT::mutex
static cMutex mutex
Definition: eit.c:373
cEvent::SetSeen
void SetSeen(void)
Definition: epg.c:237
SI::ContentDescriptor
Definition: descriptor.h:98
esyslog
#define esyslog(a...)
Definition: tools.h:35
SI::EIT::eventLoop
StructureLoop< Event > eventLoop
Definition: section.h:192
SI::LinkageDescriptor::getOriginalNetworkId
int getOriginalNetworkId() const
Definition: descriptor.c:773
cSetup::TimeTransponder
int TimeTransponder
Definition: config.h:282
cEvent::SetDuration
void SetDuration(int Duration)
Definition: epg.c:227
cEpgHandlers::HandleEvent
void HandleEvent(cEvent *Event)
Definition: epg.c:1521
SI::NumberedSection::getVersionNumber
int getVersionNumber() const
Definition: si.c:94
cEvent::ShortText
const char * ShortText(void) const
Definition: epg.h:104
cEitFilter::cEitFilter
cEitFilter(void)
Definition: eit.c:419
descriptor.h
SI::EIT::getTransportStreamId
int getTransportStreamId() const
Definition: section.c:174
cEitFilter::disableUntil
static time_t disableUntil
Definition: eit.h:27
cTDT
Definition: eit.c:371
cEpgHandlers::SetComponents
void SetComponents(cEvent *Event, cComponents *Components)
Definition: epg.c:1503
SI::ContentDescriptor::Nibble
Definition: descriptor.h:100
SI::LinkageDescriptor::getLinkageType
LinkageType getLinkageType() const
Definition: descriptor.c:781