MythTV  master
eithelper.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 // Std C++ headers
4 #include <algorithm>
5 using namespace std;
6 
7 // MythTV includes
8 #include "eithelper.h"
9 #include "eitfixup.h"
10 #include "eitcache.h"
11 #include "mythdb.h"
12 #include "atsctables.h"
13 #include "dvbtables.h"
14 #include "premieretables.h"
15 #include "dishdescriptors.h"
16 #include "premieredescriptors.h"
17 #include "channelutil.h" // for ChannelUtil
18 #include "mythdate.h"
19 #include "programdata.h"
20 #include "programinfo.h" // for subtitle types and audio and video properties
21 #include "scheduledrecording.h" // for ScheduledRecording
22 #include "compat.h" // for gmtime_r on windows.
23 
24 const uint EITHelper::kChunkSize = 20;
26 
27 static uint get_chan_id_from_db_atsc(uint sourceid,
28  uint atsc_major, uint atsc_minor);
29 static uint get_chan_id_from_db_dvb(uint sourceid, uint serviceid,
30  uint networkid, uint transportid);
31 static uint get_chan_id_from_db_dtv(uint sourceid,
32  uint serviceid, uint tunedchanid);
33 static void init_fixup(FixupMap &fix);
34 
35 #define LOC QString("EITHelper: ")
36 
38  eitfixup(new EITFixUp()),
39  gps_offset(-1 * GPS_LEAP_SECONDS),
40  sourceid(0), channelid(0),
41  maxStarttime(QDateTime()), seenEITother(false)
42 {
44 }
45 
47 {
48  QMutexLocker locker(&eitList_lock);
49  while (!db_events.empty())
50  delete db_events.dequeue();
51 
52  delete eitfixup;
53 }
54 
56 {
57  QMutexLocker locker(&eitList_lock);
58  return db_events.size();
59 }
60 
67 {
68  QMutexLocker locker(&eitList_lock);
69  uint insertCount = 0;
70 
71  if (db_events.empty())
72  return 0;
73 
75  for (uint i = 0; (i < kChunkSize) && (!db_events.empty()); i++)
76  {
77  DBEventEIT *event = db_events.dequeue();
78  eitList_lock.unlock();
79 
80  eitfixup->Fix(*event);
81 
82  insertCount += event->UpdateDB(query, 1000);
83  maxStarttime = max (maxStarttime, event->m_starttime);
84 
85  delete event;
86  eitList_lock.lock();
87  }
88 
89  if (!insertCount)
90  return 0;
91 
92  if (!incomplete_events.empty() || !unmatched_etts.empty())
93  {
94  LOG(VB_EIT, LOG_INFO,
95  LOC + QString("Added %1 events -- complete(%2) "
96  "incomplete(%3) unmatched(%4)")
97  .arg(insertCount).arg(db_events.size())
98  .arg(incomplete_events.size()).arg(unmatched_etts.size()));
99  }
100  else
101  {
102  LOG(VB_EIT, LOG_INFO,
103  LOC + QString("Added %1 events").arg(insertCount));
104  }
105 
106  return insertCount;
107 }
108 
109 void EITHelper::SetFixup(uint atsc_major, uint atsc_minor, FixupValue drheitfixup)
110 {
111  QMutexLocker locker(&eitList_lock);
112  FixupKey atsc_key = (atsc_major << 16) | atsc_minor;
113  fixup[atsc_key] = drheitfixup;
114 }
115 
116 void EITHelper::SetLanguagePreferences(const QStringList &langPref)
117 {
118  QMutexLocker locker(&eitList_lock);
119 
120  uint priority = 1;
121  QStringList::const_iterator it;
122  for (it = langPref.begin(); it != langPref.end(); ++it)
123  {
124  if (!(*it).isEmpty())
125  {
126  uint language_key = iso639_str3_to_key(*it);
127  uint canonoical_key = iso639_key_to_canonical_key(language_key);
128  languagePreferences[canonoical_key] = priority++;
129  }
130  }
131 }
132 
134 {
135  QMutexLocker locker(&eitList_lock);
136  sourceid = _sourceid;
137 }
138 
140 {
141  QMutexLocker locker(&eitList_lock);
142  channelid = _channelid;
143 }
144 
145 void EITHelper::AddEIT(uint atsc_major, uint atsc_minor,
146  const EventInformationTable *eit)
147 {
148  uint atsc_key = (atsc_major << 16) | atsc_minor;
149  EventIDToATSCEvent &events = incomplete_events[atsc_key];
150  EventIDToETT &etts = unmatched_etts[atsc_key];
151 
152  for (uint i = 0; i < eit->EventCount(); i++)
153  {
154  ATSCEvent ev(eit->StartTimeRaw(i), eit->LengthInSeconds(i),
155  eit->ETMLocation(i),
157  eit->Descriptors(i), eit->DescriptorsLength(i));
158 
159  // Look to see if there has been a recent ett message with the same event id.
160  EventIDToETT::iterator it = etts.find(eit->EventID(i));
161  QString ett_text;
162  bool found_matching_ett = false;
163  if (it != etts.end())
164  {
165  // Don't use an ett description if it was scanned long in the past.
166  if (!it->IsStale()) {
167  ett_text = it->m_ett_text;
168  found_matching_ett = true;
169  }
170  etts.erase(it);
171  }
172 
173  // Create an event immediately if a matching ett description was found,
174  // or if item is false, indicating that no ett description should be
175  // expected.
176  if (found_matching_ett || !ev.m_etm)
177  {
178  CompleteEvent(atsc_major, atsc_minor, ev, ett_text);
179  }
180  else
181  {
182  unsigned char *tmp = new unsigned char[ev.m_desc_length];
183  memcpy(tmp, eit->Descriptors(i), ev.m_desc_length);
184  ev.m_desc = tmp;
185  events.insert(eit->EventID(i), ev);
186  }
187  }
188 }
189 
190 void EITHelper::AddETT(uint atsc_major, uint atsc_minor,
191  const ExtendedTextTable *ett)
192 {
193  uint atsc_key = (atsc_major << 16) | atsc_minor;
194  // Try to match up the ett with an eit event.
195  ATSCSRCToEvents::iterator eits_it = incomplete_events.find(atsc_key);
196  if (eits_it != incomplete_events.end())
197  {
198  EventIDToATSCEvent::iterator it = (*eits_it).find(ett->EventID());
199  if (it != (*eits_it).end())
200  {
201  bool completed_event = false;
202  // Only consider eit events from the recent past.
203  if (!it->IsStale()) {
204  completed_event = true;
206  atsc_major, atsc_minor, *it,
208  }
209 
210  delete [] (*it).m_desc;
211 
212  (*eits_it).erase(it);
213 
214  if (completed_event) return;
215  }
216  }
217 
218  // Report if an unmatched ett was previously noted and overwrite it.
219  // See also https://code.mythtv.org/trac/ticket/11739
220  EventIDToETT &elist = unmatched_etts[atsc_key];
221  EventIDToETT::iterator existing_unmatched_ett_it =
222  elist.find(ett->EventID());
223  const QString next_ett_text = ett->ExtendedTextMessage()
225  if (existing_unmatched_ett_it != elist.end() &&
226  existing_unmatched_ett_it->m_ett_text != next_ett_text)
227  {
228  LOG(VB_EIT, LOG_DEBUG, LOC +
229  QString("Overwriting previously unmatched ett. stale: %1 major: %2 "
230  "minor: %3 old ett: %4 new ett: %5")
231  .arg(existing_unmatched_ett_it->IsStale())
232  .arg(atsc_major)
233  .arg(atsc_minor)
234  .arg(existing_unmatched_ett_it->m_ett_text)
235  .arg(next_ett_text));
236  }
237  elist.insert(ett->EventID(), ATSCEtt(next_ett_text));
238 }
239 
241  QMap<uint,uint> languagePreferences,
242  QString &title, QString &subtitle,
243  QString &description, QMap<QString,QString> &items)
244 {
245  const unsigned char *bestShortEvent =
247  list, DescriptorID::short_event, languagePreferences);
248 
249  // from EN 300 468, Appendix A.2 - Selection of character table
250  unsigned char enc_1[3] = { 0x10, 0x00, 0x01 };
251  unsigned char enc_2[3] = { 0x10, 0x00, 0x02 };
252  unsigned char enc_7[3] = { 0x10, 0x00, 0x07 }; // Latin/Greek Alphabet
253  unsigned char enc_9[3] = { 0x10, 0x00, 0x09 }; // could use { 0x05 } instead
254  unsigned char enc_15[3] = { 0x10, 0x00, 0x0f }; // could use { 0x0B } instead
255  int enc_len = 0;
256  const unsigned char *enc = nullptr;
257 
258  // Is this BellExpressVU EIT (Canada) ?
259  // Use an encoding override of ISO 8859-1 (Latin1)
261  {
262  enc = enc_1;
263  enc_len = sizeof(enc_1);
264  }
265 
266  // Is this broken DVB provider in Central Europe?
267  // Use an encoding override of ISO 8859-2 (Latin2)
269  {
270  enc = enc_2;
271  enc_len = sizeof(enc_2);
272  }
273 
274  // Is this broken DVB provider in Western Europe?
275  // Use an encoding override of ISO 8859-9 (Latin5)
277  {
278  enc = enc_9;
279  enc_len = sizeof(enc_9);
280  }
281 
282  // Is this broken DVB provider in Western Europe?
283  // Use an encoding override of ISO 8859-15 (Latin9)
285  {
286  enc = enc_15;
287  enc_len = sizeof(enc_15);
288  }
289 
290  // Is this broken DVB provider in Greece?
291  // Use an encoding override of ISO 8859-7 (Latin/Greek)
293  {
294  enc = enc_7;
295  enc_len = sizeof(enc_7);
296  }
297 
298  if (bestShortEvent)
299  {
300  ShortEventDescriptor sed(bestShortEvent);
301  if (sed.IsValid())
302  {
303  if (enc)
304  {
305  title = sed.EventName(enc, enc_len);
306  subtitle = sed.Text(enc, enc_len);
307  }
308  else
309  {
310  title = sed.EventName();
311  subtitle = sed.Text();
312  }
313  }
314  }
315 
316  vector<const unsigned char*> bestExtendedEvents =
318  list, DescriptorID::extended_event, languagePreferences);
319 
320  description = "";
321  for (size_t j = 0; j < bestExtendedEvents.size(); j++)
322  {
323  if (!bestExtendedEvents[j])
324  {
325  description = "";
326  break;
327  }
328 
329  ExtendedEventDescriptor eed(bestExtendedEvents[j]);
330  if (eed.IsValid())
331  {
332  if (enc)
333  description += eed.Text(enc, enc_len);
334  else
335  description += eed.Text();
336  }
337  // add items from the decscriptor to the items
338  items.unite (eed.Items());
339  }
340 }
341 
342 static inline void parse_dvb_component_descriptors(const desc_list_t& list,
343  unsigned char &subtitle_type,
344  unsigned char &audio_properties,
345  unsigned char &video_properties)
346 {
347  desc_list_t components =
349  for (size_t j = 0; j < components.size(); j++)
350  {
351  ComponentDescriptor component(components[j]);
352  if (!component.IsValid())
353  continue;
354  video_properties |= component.VideoProperties();
355  audio_properties |= component.AudioProperties();
356  subtitle_type |= component.SubtitleType();
357  }
358 }
359 
361 {
362  uint chanid = 0;
363  if ((eit->TableID() == TableID::PF_EIT) ||
364  ((eit->TableID() >= TableID::SC_EITbeg) && (eit->TableID() <= TableID::SC_EITend)))
365  {
366  // EITa(ctive)
367  chanid = GetChanID(eit->ServiceID());
368  }
369  else
370  {
371  // EITo(ther)
372  chanid = GetChanID(eit->ServiceID(), eit->OriginalNetworkID(), eit->TSID());
373  // do not reschedule if its only present+following
374  if (eit->TableID() != TableID::PF_EITo)
375  {
376  seenEITother = true;
377  }
378  }
379  if (!chanid)
380  return;
381 
382  uint descCompression = (eit->TableID() > 0x80) ? 2 : 1;
383  FixupValue fix = fixup.value((FixupKey)eit->OriginalNetworkID() << 16);
384  fix |= fixup.value((((FixupKey)eit->TSID()) << 32) |
385  ((FixupKey)eit->OriginalNetworkID() << 16));
386  fix |= fixup.value(((FixupKey)eit->OriginalNetworkID() << 16) |
387  (FixupKey)eit->ServiceID());
388  fix |= fixup.value((((FixupKey)eit->TSID()) << 32) |
389  ((FixupKey)eit->OriginalNetworkID() << 16) |
390  (FixupKey)eit->ServiceID());
392 
393  uint tableid = eit->TableID();
394  uint version = eit->Version();
395  for (uint i = 0; i < eit->EventCount(); i++)
396  {
397  // Skip event if we have already processed it before...
398  if (!s_eitcache->IsNewEIT(chanid, tableid, version, eit->EventID(i),
399  eit->EndTimeUnixUTC(i)))
400  {
401  continue;
402  }
403 
404  QString title = QString("");
405  QString subtitle = QString("");
406  QString description = QString("");
407  QString category = QString("");
409  unsigned char subtitle_type=0, audio_props=0, video_props=0;
410  uint season = 0, episode = 0, totalepisodes = 0;
411  QMap<QString,QString> items;
412 
413  // Parse descriptors
415  eit->Descriptors(i), eit->DescriptorsLength(i));
416 
417  const unsigned char *dish_event_name = nullptr;
418  if (EITFixUp::kFixDish & fix)
419  {
420  dish_event_name = MPEGDescriptor::Find(
422  }
423 
424  if (dish_event_name)
425  {
426  DishEventNameDescriptor dend(dish_event_name);
427  if (dend.IsValid() && dend.HasName())
428  title = dend.Name(descCompression);
429 
430  const unsigned char *dish_event_description =
433  if (dish_event_description)
434  {
435  DishEventDescriptionDescriptor dedd(dish_event_description);
436  if (dedd.HasDescription())
437  description = dedd.Description(descCompression);
438  }
439  }
440  else
441  {
443  title, subtitle, description, items);
444  }
445 
446  parse_dvb_component_descriptors(list, subtitle_type, audio_props,
447  video_props);
448 
449  QString programId = QString("");
450  QString seriesId = QString("");
451  QString rating = QString("");
452  QString rating_system = QString("");
453  QString advisory = QString("");
454  float stars = 0.0;
455  QDate originalairdate;
456 
457  if (EITFixUp::kFixDish & fix)
458  {
459  const unsigned char *mpaa_data = MPEGDescriptor::Find(
461  if (mpaa_data)
462  {
463  DishEventMPAADescriptor mpaa(mpaa_data);
464  stars = mpaa.stars();
465 
466  if (stars) // Only movies for now
467  {
468  rating = mpaa.rating();
469  rating_system = "MPAA";
470  advisory = mpaa.advisory();
471  }
472  }
473 
474  if (!stars) // Not MPAA rated, check VCHIP
475  {
476  const unsigned char *vchip_data = MPEGDescriptor::Find(
478  if (vchip_data)
479  {
480  DishEventVCHIPDescriptor vchip(vchip_data);
481  rating = vchip.rating();
482  rating_system = "VCHIP";
483  advisory = vchip.advisory();
484  }
485  }
486 
487  if (!advisory.isEmpty() && !rating.isEmpty())
488  rating += ", " + advisory;
489  else if (!advisory.isEmpty())
490  {
491  rating = advisory;
492  rating_system = "advisory";
493  }
494 
495  const unsigned char *tags_data = MPEGDescriptor::Find(
497  if (tags_data)
498  {
499  DishEventTagsDescriptor tags(tags_data);
500  seriesId = tags.seriesid();
501  programId = tags.programid();
502  originalairdate = tags.originalairdate(); // future use
503 
504  if (programId.startsWith("MV") || programId.startsWith("SP"))
505  seriesId = "";
506  }
507 
508  const unsigned char *properties_data = MPEGDescriptor::Find(
510  if (properties_data)
511  {
512  DishEventPropertiesDescriptor properties(properties_data);
513  subtitle_type |= properties.SubtitleProperties(descCompression);
514  audio_props |= properties.AudioProperties(descCompression);
515  }
516  }
517 
518  const unsigned char *content_data =
520  if (content_data)
521  {
522  if ((EITFixUp::kFixDish & fix) || (EITFixUp::kFixBell & fix))
523  {
524  DishContentDescriptor content(content_data);
525  switch (content.GetTheme())
526  {
527  case kThemeMovie :
528  category_type = ProgramInfo::kCategoryMovie;
529  break;
530  case kThemeSeries :
531  category_type = ProgramInfo::kCategorySeries;
532  break;
533  case kThemeSports :
534  category_type = ProgramInfo::kCategorySports;
535  break;
536  default :
537  category_type = ProgramInfo::kCategoryNone;
538  }
539  if (EITFixUp::kFixDish & fix)
540  category = content.GetCategory();
541  }
542  else if (EITFixUp::kFixAUDescription & fix)//AU Freeview assigned genres
543  {
544  static const char *AUGenres[] =
545  {/* 0*/"Unknown", "Movie", "News", "Entertainment",
546  /* 4*/"Sport", "Children", "Music", "Arts/Culture",
547  /* 8*/"Current Affairs", "Education", "Infotainment",
548  /*11*/"Special", "Comedy", "Drama", "Documentary",
549  /*15*/"Unknown"};
550  ContentDescriptor content(content_data);
551  if (content.IsValid())
552  {
553  category = AUGenres[content.Nibble1(0)];
554  category_type = content.GetMythCategory(0);
555  }
556  }
557  else if (EITFixUp::kFixGreekEIT & fix)//Greek
558  {
559  static const char *GrGenres[] =
560  {/* 0*/"Unknown", "Ταινία", "Ενημερωτικό", "Unknown",
561  /* 4*/"Αθλητικό", "Παιδικό", "Unknown", "Unknown",
562  /* 8*/"Unknown", "Ντοκιμαντέρ", "Unknown", "Unknown",
563  /*12*/"Unknown", "Unknown", "Unknown", "Unknown"};
564  ContentDescriptor content(content_data);
565  if (content.IsValid())
566  {
567  category = GrGenres[content.Nibble2(0)];
568  category_type = content.GetMythCategory(2);
569  }
570  }
571  else
572  {
573  ContentDescriptor content(content_data);
574  if (content.IsValid())
575  {
576  category = content.GetDescription(0);
577 #if 0 /* there is no category_type in DVB EIT */
578  category_type = content.GetMythCategory(0);
579 #endif
580  }
581  }
582  }
583 
584  desc_list_t contentIds =
586  for (size_t j = 0; j < contentIds.size(); j++)
587  {
588  DVBContentIdentifierDescriptor desc(contentIds[j]);
589  if (!desc.IsValid())
590  continue;
591  for (size_t k = 0; k < desc.CRIDCount(); k++)
592  {
593  if (desc.ContentEncoding(k) == 0)
594  {
595  // The CRID is a URI. It could contain UTF8 sequences encoded
596  // as %XX but there's no advantage in decoding them.
597  // The BBC currently uses private types 0x31 and 0x32.
598  // IDs from the authority eventis.nl are not fit for our scheduler
599  if (desc.ContentType(k) == 0x01 || desc.ContentType(k) == 0x31)
600  {
601  if (!desc.ContentId(k).startsWith ("eventis.nl/"))
602  {
603  programId = desc.ContentId(k);
604  }
605  }
606  else if (desc.ContentType(k) == 0x02 || desc.ContentType(k) == 0x32)
607  {
608  if (!desc.ContentId(k).startsWith ("eventis.nl/"))
609  {
610  seriesId = desc.ContentId(k);
611  }
612  category_type = ProgramInfo::kCategorySeries;
613  }
614  }
615  }
616  }
617 
618  /* if we don't have a subtitle, try to parse one from private descriptors */
619  if (subtitle.isEmpty()) {
620  bool isUPC = false;
621  /* is this event carrying UPC private data? */
623  for (size_t j = 0; j < private_data_specifiers.size(); j++) {
624  PrivateDataSpecifierDescriptor desc(private_data_specifiers[j]);
625  if (!desc.IsValid())
626  continue;
628  isUPC = true;
629  }
630  }
631 
632  if (isUPC) {
634  for (size_t j = 0; j < subtitles.size(); j++) {
636  if (!desc.IsValid())
637  continue;
638  subtitle = desc.Text();
639  }
640  }
641  }
642 
643 
644  QDateTime starttime = eit->StartTimeUTC(i);
645  // fix starttime only if the duration is a multiple of a minute
646  if (!(eit->DurationInSeconds(i) % 60))
647  EITFixUp::TimeFix(starttime);
648  QDateTime endtime = starttime.addSecs(eit->DurationInSeconds(i));
649 
650  DBEventEIT *event = new DBEventEIT(
651  chanid,
652  title, subtitle, description,
653  category, category_type,
654  starttime, endtime, fix,
655  subtitle_type,
656  audio_props,
657  video_props, stars,
658  seriesId, programId,
659  season, episode, totalepisodes);
660  event->m_items = items;
661 
662  db_events.enqueue(event);
663  }
664 }
665 
666 // This function gets special EIT data from the German provider Premiere
667 // for the option channels Premiere Sport and Premiere Direkt
669 {
670  // set fixup for Premiere
671  FixupValue fix = fixup.value(133 << 16);
673 
674  QString title = QString("");
675  QString subtitle = QString("");
676  QString description = QString("");
677  QString category = QString("");
679  unsigned char subtitle_type=0, audio_props=0, video_props=0;
680  uint season = 0, episode = 0, totalepisodes = 0;
681  QMap<QString,QString> items;
682 
683  // Parse descriptors
685  cit->Descriptors(), cit->DescriptorsLength());
686 
688  title, subtitle, description, items);
689 
690  parse_dvb_component_descriptors(list, subtitle_type, audio_props,
691  video_props);
692 
693  const unsigned char *content_data =
695  if (content_data)
696  {
697  ContentDescriptor content(content_data);
698  // fix events without real content data
699  if (content.IsValid() && (content.Nibble(0)==0x00))
700  {
701  if(content.UserNibble(0)==0x1)
702  {
703  category_type = ProgramInfo::kCategoryMovie;
704  }
705  else if(content.UserNibble(0)==0x0)
706  {
707  category_type = ProgramInfo::kCategorySports;
708  category = QObject::tr("Sports");
709  }
710  }
711  else
712  {
713  category_type = content.GetMythCategory(0);
714  category = content.GetDescription(0);
715  }
716  }
717 
718  uint tableid = cit->TableID();
719  uint version = cit->Version();
720  uint contentid = cit->ContentID();
721  // fake endtime
722 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
723  uint endtime = MythDate::current().addDays(1).toTime_t();
724 #else
725  uint endtime = MythDate::current().addDays(1).toSecsSinceEpoch();
726 #endif
727 
728  // Find Transmissions
729  desc_list_t transmissions =
732  for(size_t j=0; j< transmissions.size(); j++)
733  {
734  PremiereContentTransmissionDescriptor transmission(transmissions[j]);
735  if (!transmission.IsValid())
736  continue;
737  uint networkid = transmission.OriginalNetworkID();
738  uint tsid = transmission.TSID();
739  uint serviceid = transmission.ServiceID();
740 
741  uint chanid = GetChanID(serviceid, networkid, tsid);
742 
743  if (!chanid)
744  {
745  LOG(VB_EIT, LOG_INFO, LOC +
746  QString("Premiere EIT for NIT %1, TID %2, SID %3, "
747  "count %4, title: %5. Channel not found!")
748  .arg(networkid).arg(tsid).arg(serviceid)
749  .arg(transmission.TransmissionCount()).arg(title));
750  continue;
751  }
752 
753  // Skip event if we have already processed it before...
754  if (!s_eitcache->IsNewEIT(chanid, tableid, version, contentid, endtime))
755  {
756  continue;
757  }
758 
759  for (uint k=0; k<transmission.TransmissionCount(); ++k)
760  {
761  QDateTime txstart = transmission.StartTimeUTC(k);
762  // fix txstart only if the duration is a multiple of a minute
763  if (!(cit->DurationInSeconds() % 60))
764  EITFixUp::TimeFix(txstart);
765  QDateTime txend = txstart.addSecs(cit->DurationInSeconds());
766 
767  DBEventEIT *event = new DBEventEIT(
768  chanid,
769  title, subtitle, description,
770  category, category_type,
771  txstart, txend, fix,
772  subtitle_type,
773  audio_props,
774  video_props, 0.0,
775  "", "",
776  season, episode, totalepisodes);
777  event->m_items = items;
778 
779  db_events.enqueue(event);
780  }
781  }
782 }
783 
784 
786 {
787  s_eitcache->PruneOldEntries(timestamp);
788 }
789 
791 {
793 }
794 
796 // private methods and functions below this line //
798 
799 void EITHelper::CompleteEvent(uint atsc_major, uint atsc_minor,
800  const ATSCEvent &event,
801  const QString &ett)
802 {
803  uint chanid = GetChanID(atsc_major, atsc_minor);
804  if (!chanid)
805  return;
806 
807 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
808  QDateTime starttime = MythDate::fromTime_t(
809  event.m_start_time + GPS_EPOCH + gps_offset);
810 #else
811  QDateTime starttime = MythDate::fromSecsSinceEpoch(
812  event.m_start_time + GPS_EPOCH + gps_offset);
813 #endif
814 
815  // fix starttime only if the duration is a multiple of a minute
816  if (!(event.m_length % 60))
817  EITFixUp::TimeFix(starttime);
818  QDateTime endtime = starttime.addSecs(event.m_length);
819 
821  unsigned char subtitle_type =
824  unsigned char audio_properties = AUD_UNKNOWN;
825  unsigned char video_properties = VID_UNKNOWN;
826 
827  uint atsc_key = (atsc_major << 16) | atsc_minor;
828 
829  QMutexLocker locker(&eitList_lock);
830  QString title = event.m_title;
831  const QString& subtitle = ett;
832  db_events.enqueue(new DBEventEIT(chanid, title, subtitle,
833  starttime, endtime,
834  fixup.value(atsc_key), subtitle_type,
835  audio_properties, video_properties));
836 }
837 
838 uint EITHelper::GetChanID(uint atsc_major, uint atsc_minor)
839 {
840  uint64_t key;
841  key = ((uint64_t) sourceid);
842  key |= ((uint64_t) atsc_minor) << 16;
843  key |= ((uint64_t) atsc_major) << 32;
844 
845  ServiceToChanID::const_iterator it = srv_to_chanid.find(key);
846  if (it != srv_to_chanid.end())
847  return *it;
848 
849  uint chanid = get_chan_id_from_db_atsc(sourceid, atsc_major, atsc_minor);
850  srv_to_chanid[key] = chanid;
851 
852  return chanid;
853 }
854 
855 uint EITHelper::GetChanID(uint serviceid, uint networkid, uint tsid)
856 {
857  uint64_t key;
858  key = ((uint64_t) sourceid);
859  key |= ((uint64_t) serviceid) << 16;
860  key |= ((uint64_t) networkid) << 32;
861  key |= ((uint64_t) tsid) << 48;
862 
863  ServiceToChanID::const_iterator it = srv_to_chanid.find(key);
864  if (it != srv_to_chanid.end())
865  return *it;
866 
867  uint chanid = get_chan_id_from_db_dvb(sourceid, serviceid, networkid, tsid);
868  srv_to_chanid[key] = chanid;
869 
870  return chanid;
871 }
872 
874 {
875  uint64_t key;
876  key = ((uint64_t) sourceid);
877  key |= ((uint64_t) program_number) << 16;
878  key |= ((uint64_t) channelid) << 32;
879 
880  ServiceToChanID::const_iterator it = srv_to_chanid.find(key);
881  if (it != srv_to_chanid.end())
882  return *it;
883 
884  uint chanid = get_chan_id_from_db_dtv(sourceid, program_number, channelid);
885  srv_to_chanid[key] = chanid;
886 
887  return chanid;
888 }
889 
891  uint atsc_major, uint atsc_minor)
892 {
893  MSqlQuery query(MSqlQuery::InitCon());
894  query.prepare(
895  "SELECT chanid, useonairguide "
896  "FROM channel "
897  "WHERE atsc_major_chan = :MAJORCHAN AND "
898  " atsc_minor_chan = :MINORCHAN AND "
899  " sourceid = :SOURCEID");
900  query.bindValue(":MAJORCHAN", atsc_major);
901  query.bindValue(":MINORCHAN", atsc_minor);
902  query.bindValue(":SOURCEID", sourceid);
903 
904  if (!query.exec() || !query.isActive())
905  MythDB::DBError("Looking up chanid 1", query);
906  else if (query.next())
907  {
908  bool useOnAirGuide = query.value(1).toBool();
909  return (useOnAirGuide) ? query.value(0).toUInt() : 0;
910  }
911 
912  return 0;
913 }
914 
915 // Figure out the chanid for this channel
916 static uint get_chan_id_from_db_dvb(uint sourceid, uint serviceid,
917  uint networkid, uint transportid)
918 {
919  uint chanid = 0;
920  bool useOnAirGuide = false;
921  MSqlQuery query(MSqlQuery::InitCon());
922 
923  // DVB Link to chanid
924  QString qstr =
925  "SELECT chanid, useonairguide, channel.sourceid "
926  "FROM channel, dtv_multiplex "
927  "WHERE serviceid = :SERVICEID AND "
928  " networkid = :NETWORKID AND "
929  " transportid = :TRANSPORTID AND "
930  " channel.mplexid = dtv_multiplex.mplexid";
931 
932  query.prepare(qstr);
933  query.bindValue(":SERVICEID", serviceid);
934  query.bindValue(":NETWORKID", networkid);
935  query.bindValue(":TRANSPORTID", transportid);
936 
937  if (!query.exec() || !query.isActive())
938  MythDB::DBError("Looking up chanID", query);
939 
940  if (query.size() == 0) {
941  // Attempt fuzzy matching, by skipping the tsid
942  // DVB Link to chanid
943  qstr =
944  "SELECT chanid, useonairguide, channel.sourceid "
945  "FROM channel, dtv_multiplex "
946  "WHERE serviceid = :SERVICEID AND "
947  " networkid = :NETWORKID AND "
948  " channel.mplexid = dtv_multiplex.mplexid";
949 
950  query.prepare(qstr);
951  query.bindValue(":SERVICEID", serviceid);
952  query.bindValue(":NETWORKID", networkid);
953  if (!query.exec() || !query.isActive())
954  MythDB::DBError("Looking up chanID in fuzzy mode", query);
955  }
956 
957  while (query.next())
958  {
959  // Check to see if we are interested in this channel
960  chanid = query.value(0).toUInt();
961  useOnAirGuide = query.value(1).toBool();
962  if (sourceid == query.value(2).toUInt())
963  return useOnAirGuide ? chanid : 0;
964  }
965 
966  if (query.size() > 1)
967  {
968  LOG(VB_EIT, LOG_INFO,
969  LOC + QString("found %1 channels for networdid %2, "
970  "transportid %3, serviceid %4 but none "
971  "for current sourceid %5.")
972  .arg(query.size()).arg(networkid).arg(transportid)
973  .arg(serviceid).arg(sourceid));
974  }
975 
976  return useOnAirGuide ? chanid : 0;
977 }
978 
979 /* Figure out the chanid for this channel from the sourceid,
980  * program_number/service_id and the chanid of the channel we are tuned to
981  *
982  * TODO for SPTS (e.g. HLS / IPTV) it would be useful to match without an entry
983  * in dtv_multiplex
984  */
985 static uint get_chan_id_from_db_dtv(uint sourceid, uint serviceid,
986  uint tunedchanid)
987 {
988  uint chanid = 0;
989  bool useOnAirGuide = false;
990  MSqlQuery query(MSqlQuery::InitCon());
991 
992  // DVB Link to chanid
993  QString qstr =
994  "SELECT c1.chanid, c1.useonairguide, c1.sourceid "
995  "FROM channel c1, dtv_multiplex m, channel c2 "
996  "WHERE c1.serviceid = :SERVICEID AND "
997  " c1.mplexid = m.mplexid AND "
998  " m.mplexid = c2.mplexid AND "
999  " c2.chanid = :CHANID";
1000 
1001  query.prepare(qstr);
1002  query.bindValue(":SERVICEID", serviceid);
1003  query.bindValue(":CHANID", tunedchanid);
1004 
1005  if (!query.exec() || !query.isActive())
1006  MythDB::DBError("Looking up chanID", query);
1007 
1008  while (query.next())
1009  {
1010  // Check to see if we are interested in this channel
1011  chanid = query.value(0).toUInt();
1012  useOnAirGuide = query.value(1).toBool();
1013  if (sourceid == query.value(2).toUInt())
1014  return useOnAirGuide ? chanid : 0;
1015  }
1016 
1017  if (query.size() > 1)
1018  {
1019  LOG(VB_EIT, LOG_INFO,
1020  LOC + QString("found %1 channels for multiplex of chanid %2, "
1021  "serviceid %3 but none "
1022  "for current sourceid %4.")
1023  .arg(query.size()).arg(tunedchanid)
1024  .arg(serviceid).arg(sourceid));
1025  }
1026 
1027  return useOnAirGuide ? chanid : 0;
1028 }
1029 
1030 static void init_fixup(FixupMap &fix)
1031 {
1033  // Fixups to make EIT provided listings more useful
1034  // transport_id<<32 | original_network_id<<16 | service_id
1035 
1036  // Bell Express VU Canada
1037  fix[ 256U << 16] = EITFixUp::kFixBell;
1038  fix[ 257U << 16] = EITFixUp::kFixBell;
1039  fix[ 4100U << 16] = EITFixUp::kFixBell;
1040  fix[ 4101U << 16] = EITFixUp::kFixBell;
1041  fix[ 4102U << 16] = EITFixUp::kFixBell;
1042  fix[ 4103U << 16] = EITFixUp::kFixBell;
1043  fix[ 4104U << 16] = EITFixUp::kFixBell;
1044  fix[ 4105U << 16] = EITFixUp::kFixBell;
1045  fix[ 4106U << 16] = EITFixUp::kFixBell;
1046  fix[ 4107U << 16] = EITFixUp::kFixBell;
1047  fix[ 4097U << 16] = EITFixUp::kFixBell;
1048  fix[ 4098U << 16] = EITFixUp::kFixBell;
1049 
1050  // United Kingdom - DVB-T/T2
1051  fix[ 9018U << 16] = EITFixUp::kFixUK;
1052 
1053  // UK - Astra 28.2
1054  for (int i = 2001; i <= 2035; ++i)
1055  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1056 
1057  fix[ 2036LL << 32 | 2U << 16] = EITFixUp::kFixUK | EITFixUp::kFixHTML;
1058 
1059  for (int i = 2037; i <= 2057; ++i)
1060  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1061  fix[ 2059LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1062  fix[ 2061LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1063  for (int i = 2063; i <= 2069; ++i)
1064  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1065  fix[ 2071LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1066  fix[ 2076LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1067  fix[ 2081LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1068  for (int i = 2089; i <= 2092; ++i)
1069  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1070  for (int i = 2094; i <= 2099; ++i)
1071  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1072  for (int i = 2102; i <= 2110; ++i)
1073  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1074  fix[ 2112LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1075  fix[ 2116LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1076  fix[ 2301LL << 32 | 2U << 16] = EITFixUp::kFixUK | EITFixUp::kFixHTML;
1077  fix[ 2302LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1078  fix[ 2303LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1079  fix[ 2304LL << 32 | 2U << 16] = EITFixUp::kFixUK | EITFixUp::kFixHTML;
1080  fix[ 2305LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1081  fix[ 2306LL << 32 | 2U << 16] = EITFixUp::kFixUK | EITFixUp::kFixHTML;
1082  fix[ 2311LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1083  fix[ 2312LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1084  fix[ 2313LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1085  fix[ 2314LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1086  fix[ 2315LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1087  fix[ 2316LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1088  for (int i = 2401; i <= 2413; ++i)
1089  fix[ (long long)i << 32 | 2U << 16] = EITFixUp::kFixUK;
1090  fix[ 2601LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1091  fix[ 2602LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1092  fix[ 2603LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1093  fix[ 2604LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1094  fix[ 2612LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1095  fix[ 2614LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1096  fix[ 2611LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1097  fix[ 2612LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1098  fix[ 2613LL << 32 | 2U << 16] = EITFixUp::kFixUK;
1099 
1100  // R.caroline
1101  fix[ 2315LL << 32 | 59U << 16] = EITFixUp::kFixUK;
1102 
1103  // ComHem Sweden
1104  fix[40999U << 16 ] = EITFixUp::kFixComHem;
1105  fix[40999U << 16 | 1070] = EITFixUp::kFixSubtitle;
1106  fix[40999U << 16 | 1308] = EITFixUp::kFixSubtitle;
1107  fix[40999U << 16 | 1041] = EITFixUp::kFixSubtitle;
1108  fix[40999U << 16 | 1306] = EITFixUp::kFixSubtitle;
1109  fix[40999U << 16 | 1307] = EITFixUp::kFixSubtitle;
1110  fix[40999U << 16 | 1030] = EITFixUp::kFixSubtitle;
1111  fix[40999U << 16 | 1016] = EITFixUp::kFixSubtitle;
1112  fix[40999U << 16 | 1131] = EITFixUp::kFixSubtitle;
1113  fix[40999U << 16 | 1068] = EITFixUp::kFixSubtitle;
1114  fix[40999U << 16 | 1069] = EITFixUp::kFixSubtitle;
1115 
1116  // Australia
1117  fix[ 4096U << 16] = EITFixUp::kFixAUStar;
1118  fix[ 4096U << 16] = EITFixUp::kFixAUStar;
1119  fix[ 4112U << 16] = EITFixUp::kFixAUDescription | EITFixUp::kFixAUFreeview; // ABC Brisbane
1120  fix[ 4114U << 16] = EITFixUp::kFixAUDescription | EITFixUp::kFixAUFreeview | EITFixUp::kFixAUNine;; // Nine Brisbane
1121  fix[ 4115U << 16] = EITFixUp::kFixAUDescription | EITFixUp::kFixAUSeven; //Seven
1122  fix[ 4116U << 16] = EITFixUp::kFixAUDescription; //Ten
1123  fix[ 12801U << 16] = EITFixUp::kFixAUFreeview | EITFixUp::kFixAUDescription; //ABC
1124  fix[ 12802U << 16] = EITFixUp::kFixAUDescription; //SBS
1126  fix[ 12842U << 16] = EITFixUp::kFixAUDescription; // 31 Brisbane
1127  fix[ 12862U << 16] = EITFixUp::kFixAUDescription; //WestTV
1128 
1129  // MultiChoice Africa
1130  fix[ 6144U << 16] = EITFixUp::kFixMCA;
1131 
1132  // RTL Subtitle parsing
1133  fix[ 1089LL << 32 | 1 << 16] = // DVB-S
1134  fix[ 1041LL << 32 | 1 << 16] = // DVB-S RTL Group HD Austria Transponder
1135  fix[ 1057LL << 32 | 1 << 16] = // DVB-S RTL Group HD Transponder
1136  fix[ 773LL << 32 | 8468U << 16] = // DVB-T Berlin/Brandenburg
1137  fix[ 2819LL << 32 | 8468U << 16] = // DVB-T Niedersachsen + Bremen
1138  fix[ 8706LL << 32 | 8468U << 16] = // DVB-T NRW
1139  fix[ 12801LL << 32 | 8468U << 16] = // DVB-T Bayern
1141 
1142  // Mark HD+ channels as HDTV
1143  fix[ 1041LL << 32 | 1 << 16] = EITFixUp::kFixHDTV;
1144  fix[ 1055LL << 32 | 1 << 16] = EITFixUp::kFixHDTV;
1145  fix[ 1057LL << 32 | 1 << 16] = EITFixUp::kFixHDTV;
1146  fix[ 1109LL << 32 | 1 << 16] = EITFixUp::kFixHDTV;
1147 
1148  // PRO7/SAT.1
1149  fix[ 1017LL << 32 | 1 << 16] = EITFixUp::kFixHDTV | EITFixUp::kFixP7S1;
1150  fix[ 1031LL << 32 | 1 << 16 | 5300] = EITFixUp::kFixHDTV | EITFixUp::kFixP7S1;
1151  fix[ 1031LL << 32 | 1 << 16 | 5301] = EITFixUp::kFixHDTV | EITFixUp::kFixP7S1;
1152  fix[ 1031LL << 32 | 1 << 16 | 5302] = EITFixUp::kFixHDTV | EITFixUp::kFixP7S1;
1153  fix[ 1031LL << 32 | 1 << 16 | 5303] = EITFixUp::kFixHDTV | EITFixUp::kFixP7S1;
1154  fix[ 1031LL << 32 | 1 << 16 | 5310] = EITFixUp::kFixP7S1;
1155  fix[ 1031LL << 32 | 1 << 16 | 5311] = EITFixUp::kFixP7S1;
1156  fix[ 1107LL << 32 | 1 << 16] = EITFixUp::kFixP7S1;
1157  fix[ 1082LL << 32 | 1 << 16] = EITFixUp::kFixP7S1;
1158  fix[ 5LL << 32 | 133 << 16 | 776] = EITFixUp::kFixP7S1;
1159  fix[ 8468 << 16 | 16426] = EITFixUp::kFixP7S1; // ProSieben MAXX - DVB-T Rhein/Main
1160  fix[ 8707LL << 32 | 8468 << 16] = EITFixUp::kFixP7S1; // ProSieben Sat.1 Mux - DVB-T Rhein/Main
1161 
1162  // ATV / ATV2
1163  fix[ 1117LL << 32 | 1 << 16 | 13012 ] = EITFixUp::kFixATV; // ATV
1164  fix[ 1003LL << 32 | 1 << 16 | 13223 ] = EITFixUp::kFixATV; // ATV2
1165  fix[ 1003LL << 32 | 1 << 16 | 13228 ] = EITFixUp::kFixHDTV | EITFixUp::kFixATV; // ATV HD
1166 
1167  // Disney Channel Germany
1168  fix[ 1055LL << 32 | 1 << 16 | 5500 ] = EITFixUp::kFixHDTV | EITFixUp::kFixDisneyChannel; // Disney Channel HD
1169  fix[ 1055LL << 32 | 1 << 16 | 5510 ] = EITFixUp::kFixHDTV | EITFixUp::kFixDisneyChannel; // Disney Channel HD Austria
1170  fix[ 5LL << 32 | 133 << 16 | 1793 ] = EITFixUp::kFixDisneyChannel; // Disney Channel HD Austria
1171  fix[ 1109LL << 32 | 1 << 16 | 5401 ] = EITFixUp::kFixHDTV | EITFixUp::kFixDisneyChannel; // Tele 5 HD
1172  fix[ 1109LL << 32 | 1 << 16 | 5421 ] = EITFixUp::kFixHDTV | EITFixUp::kFixDisneyChannel; // Tele 5 HD Austria
1173  fix[ 33LL << 32 | 133 << 16 | 51 ] = EITFixUp::kFixDisneyChannel; // Tele 5
1174 
1175  // Premiere EIT processing
1176  fix[ 1LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1177  fix[ 2LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1178  fix[ 3LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1179  fix[ 4LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1180  fix[ 6LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1181  fix[ 8LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1182  fix[ 9LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1183  fix[ 10LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1184  fix[ 11LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1185  fix[ 12LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1186  fix[ 13LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1187  fix[ 14LL << 32 | 133 << 16] = EITFixUp::kFixPremiere | EITFixUp::kFixHDTV;
1188  fix[ 15LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1189  fix[ 17LL << 32 | 133 << 16] = EITFixUp::kFixPremiere;
1190  // Mark Premiere HD, AXN HD and Discovery HD as HDTV
1191  fix[ 6LL << 32 | 133 << 16 | 129] = EITFixUp::kFixHDTV;
1192  fix[ 6LL << 32 | 133 << 16 | 130] = EITFixUp::kFixHDTV;
1193  fix[ 10LL << 32 | 133 << 16 | 125] = EITFixUp::kFixHDTV;
1194 
1195  // Netherlands DVB-C
1196  fix[ 1000U << 16] = EITFixUp::kFixNL;
1197  // Canal Digitaal DVB-S 19.2 Dutch/Belgian ONID 53 covers all CanalDigitaal TiD
1198  fix[ 53U << 16] = EITFixUp::kFixNL;
1199  // Canal Digitaal DVB-S 23.5 Dutch/Belgian
1200  fix[ 3202LL << 32 | 3U << 16] = EITFixUp::kFixNL;
1201  fix[ 3208LL << 32 | 3U << 16] = EITFixUp::kFixNL;
1202  fix[ 3211LL << 32 | 3U << 16] = EITFixUp::kFixNL;
1203  fix[ 3222LL << 32 | 3U << 16] = EITFixUp::kFixNL;
1204  fix[ 3225LL << 32 | 3U << 16] = EITFixUp::kFixNL;
1205 
1206  // Finland
1207  fix[ 8438U << 16] = // DVB-T Espoo
1208  fix[ 42249U << 16] = // DVB-C Welho
1209  fix[ 15U << 16] = // DVB-C Welho
1211 
1212  // DVB-C YouSee (Denmark)
1213  fix[65024U << 16] = EITFixUp::kFixDK;
1214 
1215  // DVB-S(2) Thor 0.8W Norwegian
1216  fix[70U << 16] = EITFixUp::kFixNO;
1217 
1218  // DVB-T NTV/NRK (Norway)
1219  fix[910LL << 32 | 8770U << 16 | 0x006f] = EITFixUp::kFixNRK_DVBT; //NRK Folkemusikk
1220  fix[910LL << 32 | 8770U << 16 | 0x0070] = EITFixUp::kFixNRK_DVBT; //NRK Stortinget
1221  fix[910LL << 32 | 8770U << 16 | 0x0071] = EITFixUp::kFixNRK_DVBT; //NRK Super
1222  fix[910LL << 32 | 8770U << 16 | 0x0072] = EITFixUp::kFixNRK_DVBT; //NRK Sport
1223  fix[910LL << 32 | 8770U << 16 | 0x0073] = EITFixUp::kFixNRK_DVBT; //NRK Gull
1224  fix[910LL << 32 | 8770U << 16 | 0x0074] = EITFixUp::kFixNRK_DVBT; //NRK Jazz
1225  fix[910LL << 32 | 8770U << 16 | 0x0067] = EITFixUp::kFixNRK_DVBT; //NRK Super / NRK3
1226  fix[910LL << 32 | 8770U << 16 | 0x0068] = EITFixUp::kFixNRK_DVBT; //NRK Tegnspr�
1227  fix[910LL << 32 | 8770U << 16 | 0x0069] = EITFixUp::kFixNRK_DVBT; //NRK P2
1228  fix[910LL << 32 | 8770U << 16 | 0x006a] = EITFixUp::kFixNRK_DVBT; //NRK P3
1229  fix[910LL << 32 | 8770U << 16 | 0x006b] = EITFixUp::kFixNRK_DVBT; //NRK Alltid Nyheter
1230  fix[910LL << 32 | 8770U << 16 | 0x006c] = EITFixUp::kFixNRK_DVBT; //NRK mP3
1231  fix[910LL << 32 | 8770U << 16 | 0x006d] = EITFixUp::kFixNRK_DVBT; //NRK Klassisk
1232  fix[910LL << 32 | 8770U << 16 | 0x006e] = EITFixUp::kFixNRK_DVBT; //NRK S�i Radio
1233  fix[910LL << 32 | 8770U << 16 | 0x0066] = EITFixUp::kFixNRK_DVBT; //NRK2
1234  fix[910LL << 32 | 8770U << 16 | 0x03f0] = EITFixUp::kFixNRK_DVBT; //NRK1 M�e og Romsdal
1235  fix[910LL << 32 | 8770U << 16 | 0x0455] = EITFixUp::kFixNRK_DVBT; //NRK P1 Tr�delag
1236  fix[910LL << 32 | 8770U << 16 | 0x03f1] = EITFixUp::kFixNRK_DVBT; //NRK1 Midtnytt
1237 
1239  // Special Early fixups for providers that break DVB EIT spec.
1240  // transport_id<<32 | network_id<<16 | service_id
1241 
1242  // Bell Express VU Canada
1243  fix[ 256U << 16] |= EITFixUp::kEFixForceISO8859_1;
1244  fix[ 257U << 16] |= EITFixUp::kEFixForceISO8859_1;
1245  fix[4100U << 16] |= EITFixUp::kEFixForceISO8859_1;
1246  fix[4101U << 16] |= EITFixUp::kEFixForceISO8859_1;
1247  fix[4102U << 16] |= EITFixUp::kEFixForceISO8859_1;
1248  fix[4103U << 16] |= EITFixUp::kEFixForceISO8859_1;
1249  fix[4104U << 16] |= EITFixUp::kEFixForceISO8859_1;
1250  fix[4105U << 16] |= EITFixUp::kEFixForceISO8859_1;
1251  fix[4106U << 16] |= EITFixUp::kEFixForceISO8859_1;
1252  fix[4107U << 16] |= EITFixUp::kEFixForceISO8859_1;
1253  fix[4097U << 16] |= EITFixUp::kEFixForceISO8859_1;
1254  fix[4098U << 16] |= EITFixUp::kEFixForceISO8859_1;
1255 
1256  //DVB-T Germany Berlin HSE/MonA TV
1257  fix[ 772LL << 32 | 8468 << 16 | 16387] = EITFixUp::kEFixForceISO8859_15;
1258  //DVB-T Germany Ruhrgebiet Tele 5
1259  //fix[ 8707LL << 32 | 8468 << 16 | 16413] = EITFixUp::kEFixForceISO8859_15; // they are sending the ISO 8859-9 signalling now
1260  // ANIXE
1261  fix[ 8707LL << 32 | 8468U << 16 | 16426 ] = // DVB-T Rhein-Main
1263 
1264  // DVB-C Kabel Deutschland encoding fixes Germany
1265  fix[ 112LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1266  fix[ 10000LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1267  fix[ 10001LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1268  fix[ 10002LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1269  fix[ 10003LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1270  fix[ 10006LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1271  fix[ 10009LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1272  fix[ 10010LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
1273  // Mark program on the HD transponders as HDTV
1274  fix[ 10012LL << 32 | 61441U << 16] = EITFixUp::kFixHDTV;
1275  fix[ 10013LL << 32 | 61441U << 16] = EITFixUp::kFixHDTV;
1276  // On transport 10004 only DMAX needs no fixing:
1277  fix[10004LL<<32 | 61441U << 16 | 50403] = // BBC World Service
1278  fix[10004LL<<32 | 61441U << 16 | 53101] = // BBC Prime (engl)
1279  fix[10004LL<<32 | 61441U << 16 | 53108] = // Toon Disney (engl)
1280  fix[10004LL<<32 | 61441U << 16 | 53109] = // Sky News (engl)
1281  fix[10004LL<<32 | 61441U << 16 | 53406] = // BBC Prime
1282  fix[10004LL<<32 | 61441U << 16 | 53407] = // Boomerang (engl)
1283  fix[10004LL<<32 | 61441U << 16 | 53404] = // Boomerang
1284  fix[10004LL<<32 | 61441U << 16 | 53408] = // TCM Classic Movies (engl)
1285  fix[10004LL<<32 | 61441U << 16 | 53409] = // Extreme Sports
1286  fix[10004LL<<32 | 61441U << 16 | 53410] = // CNBC Europe (engl)
1287  fix[10004LL<<32 | 61441U << 16 | 53503] = // Detski Mir
1288  fix[10004LL<<32 | 61441U << 16 | 53411] = // Sat.1 Comedy
1289  fix[10004LL<<32 | 61441U << 16 | 53412] = // kabel eins classics
1290  fix[10004LL<<32 | 61441U << 16 | 53112] = // Extreme Sports (engl)
1291  fix[10004LL<<32 | 61441U << 16 | 53513] = // Playhouse Disney (engl)
1292  fix[10004LL<<32 | 61441U << 16 | 53618] = // K1010
1293  fix[10004LL<<32 | 61441U << 16 | 53619] = // GemsTV
1295  // On transport 10005 QVC and Giga Digital needs no fixing:
1296  fix[10005LL<<32 | 61441U << 16 | 50104] = // E! Entertainment
1297  fix[10005LL<<32 | 61441U << 16 | 50107] = // 13th Street (KD)
1298  fix[10005LL<<32 | 61441U << 16 | 50301] = // ESPN Classic
1299  fix[10005LL<<32 | 61441U << 16 | 50302] = // VH1 Classic
1300  fix[10005LL<<32 | 61441U << 16 | 50303] = // Wein TV
1301  fix[10005LL<<32 | 61441U << 16 | 50304] = // AXN
1302  fix[10005LL<<32 | 61441U << 16 | 50305] = // Silverline
1303  fix[10005LL<<32 | 61441U << 16 | 50306] = // NASN
1304  fix[10005LL<<32 | 61441U << 16 | 50307] = // Disney Toon
1305  fix[10005LL<<32 | 61441U << 16 | 53105] = // NASN (engl)
1306  fix[10005LL<<32 | 61441U << 16 | 53115] = // VH1 Classic (engl)
1307  fix[10005LL<<32 | 61441U << 16 | 53405] = // ESPN Classic (engl)
1308  fix[10005LL<<32 | 61441U << 16 | 53402] = // AXN (engl)
1309  fix[10005LL<<32 | 61441U << 16 | 53613] = // CNN (engl)
1310  fix[10005LL<<32 | 61441U << 16 | 53516] = // Voyages Television
1311  fix[10005LL<<32 | 61441U << 16 | 53611] = // Der Schmuckkanal
1312  fix[10005LL<<32 | 61441U << 16 | 53104] = // Jukebox
1314  // On transport 10007 only following channels need fixing:
1315  fix[10007LL<<32| 61441U << 16 | 53607] = // Eurosport
1316  fix[10007LL<<32| 61441U << 16 | 53608] = // Das Vierte
1317  fix[10007LL<<32| 61441U << 16 | 53609] = // Viva
1318  fix[10007LL<<32| 61441U << 16 | 53628] = // COMEDY CENTRAL
1320  // RTL Subtitle parsing
1321  fix[10007LL<<32| 61441U << 16 | 53601] = // RTL
1322  fix[10007LL<<32| 61441U << 16 | 53602] = // Super RTL
1323  fix[10007LL<<32| 61441U << 16 | 53604] = // VOX
1324  fix[10007LL<<32| 61441U << 16 | 53606] = // n-tv
1326  // On transport 10008 only following channels need fixing:
1327  fix[ 10008LL<<32 | 61441U << 16 | 53002] = // Tele 5
1329 
1330  // DVB-C Unitymedia Germany
1331  fix[ 9999 << 16 | 161LL << 32 | 12101 ] = // RTL Television
1332  fix[ 9999 << 16 | 161LL << 32 | 12104 ] = // VOX
1333  fix[ 9999 << 16 | 161LL << 32 | 12107 ] = // Super RTL
1334  fix[ 9999 << 16 | 161LL << 32 | 12109 ] = // n-tv
1335  fix[ 9999 << 16 | 301LL << 32 | 30114 ] = // RTL NITRO
1337  fix[ 9999 << 16 | 191LL << 32 | 11102 ] = // DAS VIERTE
1339  // on this transport are only HD services, two TBD, arte and ServusTV, I think arte properly signals HD!
1340  fix[ 9999 << 16 | 401LL << 32 | 29109 ] = // ServusTV HD
1342  // generic Unitymedia / Liberty Global / Eventis.nl?
1343  fix[ 9999 << 16 | 121LL << 32 | 12107 ] = // Super RTL
1344  fix[ 9999 << 16 | 151LL << 32 | 15110 ] = // Bibel TV
1345  fix[ 9999 << 16 | 161LL << 32 | 12107 ] = // Super RTL
1346  fix[ 9999 << 16 | 161LL << 32 | 12109 ] = // n-tv
1347  fix[ 9999 << 16 | 171LL << 32 | 17119 ] = // RiC
1348  fix[ 9999 << 16 | 171LL << 32 | 27102 ] = // DELUXE MUSIC
1349  fix[ 9999 << 16 | 181LL << 32 | 24108 ] = // DMAX
1350  fix[ 9999 << 16 | 181LL << 32 | 25102 ] = // TV5MONDE Europe
1351  fix[ 9999 << 16 | 191LL << 32 | 11102 ] = // Disney SD
1352  fix[ 9999 << 16 | 191LL << 32 | 12110 ] = // N24
1353  fix[ 9999 << 16 | 191LL << 32 | 12111 ] = // Tele 5
1354  fix[ 9999 << 16 | 201LL << 32 | 27103 ] = // TLC
1355  fix[ 9999 << 16 | 211LL << 32 | 29108 ] = // Astro TV
1356  fix[ 9999 << 16 | 231LL << 32 | 23117 ] = // Deutsches Musik Fernsehen
1357  fix[ 9999 << 16 | 231LL << 32 | 23115 ] = // Family TV
1358  fix[ 9999 << 16 | 271LL << 32 | 27101 ] = // DIE NEUE ZEIT TV
1359  fix[ 9999 << 16 | 541LL << 32 | 54101 ] = // HR HD
1361 
1362  // DVB-S Astra 19.2E DMAX Germany
1363  fix[ 1113LL << 32 | 1 << 16 | 12602] = EITFixUp::kEFixForceISO8859_15;
1364 
1365  // Premiere
1366  fix[133 << 16] = EITFixUp::kEFixForceISO8859_15;
1367 
1368  // DVB-S Astra 19.2E French channels
1369  fix[ 1022LL << 32 | 1 << 16 | 6901 ] = // DIRECT 8
1370  fix[ 1022LL << 32 | 1 << 16 | 6905 ] = // France 24 (en Francais)
1371  fix[ 1022LL << 32 | 1 << 16 | 6911 ] = // DIRECT 8
1372  fix[ 1072LL << 32 | 1 << 16 | 8201 ] = // CANAL+
1373  fix[ 1070LL << 32 | 1 << 16 | 8004 ] = // EURONEWS
1374  fix[ 1091LL << 32 | 1 << 16 | 31220 ] = // EuroNews
1375  fix[ 1094LL << 32 | 1 << 16 | 17027 ] = // LCP
1376  fix[ 1094LL << 32 | 1 << 16 | 17028 ] = // NT1
1377  fix[ 1100LL << 32 | 1 << 16 | 8710 ] = // NRJ 12
1379 
1380  // DVB-C T-Kábel Hungary
1381  // FIXME this should be more specific. Is the encoding really wrong for all services?
1382  fix[ 100 << 16] = EITFixUp::kEFixForceISO8859_2;
1383 
1384  // DVB-T Greece
1385  // Pelion Transmitter
1386  // transport_id<<32 | netword_id<<16 | service_id
1387  fix[ 100LL << 32 | 8492LL << 16 ] = // Ant1,Alpha,Art,10E
1388  fix[ 102LL << 32 | 8492LL << 16 ] = // Mega,Star,SKAI,M.tv
1389  fix[ 320LL << 32 | 8492LL << 16 ] = // Astra,Thessalia,TRT,TV10,ZEYS
1393  fix[ 2LL << 32 | 8492LL << 16 ] = // N1,Nplus,NHD,Vouli
1394  EITFixUp::kEFixForceISO8859_7 | // it is encoded in cp-1253
1395  EITFixUp::kFixGreekSubtitle | // Subtitle has too much info and is
1396  EITFixUp::kFixGreekEIT | // cut in db. Will move to descr.
1398 
1399  //DVB-S & S2 Greek Nova Provider
1400  // Hotbird 11823H DVB-S
1401  fix[ 5500LL << 32 | 318LL << 16 ] = EITFixUp::kEFixForceISO8859_7;
1402  // Hotbird 11938H DVB-S
1403  fix[ 6100LL << 32 | 318LL << 16 ] = EITFixUp::kEFixForceISO8859_7;
1404  // Hotbird 12130H DVB-S2
1405  fix[ 7100LL << 32 | 318LL << 16 ] = EITFixUp::kEFixForceISO8859_7;
1406  // Hotbird 12169H DVB-S2
1407  fix[ 7300LL << 32 | 318LL << 16 ] = EITFixUp::kEFixForceISO8859_7;
1408 
1409  // DVB-S Star One C2 70W (Brazil)
1410  // it has original_network_id = 1 like Astra on 19.2E, but transport_id does
1411  // not collide at the moment
1412  fix[ 1LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1413  fix[ 2LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1414  fix[ 3LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1415  fix[ 4LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1416  fix[ 50LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1417  fix[ 51LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1418  fix[ 52LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1419  fix[ 53LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1420  fix[ 54LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1421  fix[ 55LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1422  fix[ 56LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1423  fix[ 57LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1424  fix[ 58LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1425  fix[ 59LL << 32 | 1LL << 16 ] = EITFixUp::kEFixForceISO8859_1;
1426 }
1427 
1433 {
1436  maxStarttime, "EITScanner");
1437  seenEITother = false;
1438  maxStarttime = QDateTime();
1439 }
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:782
uint Version(void) const
Definition: mpegtables.h:503
ProgramInfo::CategoryType GetMythCategory(uint i) const
QMap< QString, QString > Items(void) const
uint TSID(void) const
Definition: dvbtables.h:308
DishThemeType GetTheme(void) const
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:863
uint GetChanID(uint atsc_major, uint atsc_minor)
Definition: eithelper.cpp:838
void CompleteEvent(uint atsc_major, uint atsc_minor, const ATSCEvent &event, const QString &ett)
Definition: eithelper.cpp:799
uint SubtitleProperties(uint compression_type) const
QString EventName(void) const
uint32_t m_length
Definition: eithelper.h:39
static void init_fixup(FixupMap &fix)
Definition: eithelper.cpp:1030
#define GPS_EPOCH
Seconds between start of GPS time and the start of UNIX time.
Definition: mpegtables.h:28
QMap< FixupKey, FixupValue > FixupMap
Definition: eithelper.h:80
QMap< uint, uint > languagePreferences
Definition: eithelper.h:161
#define LOC
Definition: eithelper.cpp:35
unsigned char SubtitleType(void) const
uint32_t m_desc_length
Definition: eithelper.h:41
uint32_t m_start_time
Definition: eithelper.h:38
ExtendedTextTable contain additional text not contained in EventInformationTables.
Definition: atsctables.h:625
const char * subtitles[4]
Definition: vbilut.cpp:202
uint UserNibble(uint i) const
#define GPS_LEAP_SECONDS
Leap seconds as of June 30th, 2012.
Definition: mpegtables.h:31
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
int size(void) const
Definition: mythdbcon.h:203
QString ContentId(size_t n=0) const
const unsigned char * Descriptors(uint i) const
Definition: dvbtables.h:357
bool HasName(void) const
unsigned char VideoProperties(void) const
unsigned int uint
Definition: compat.h:140
static int iso639_str3_to_key(const unsigned char *iso639_2)
Definition: iso639.h:63
static const unsigned char * FindBestMatch(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
vector< const unsigned char * > desc_list_t
int iso639_key_to_canonical_key(int iso639_2)
Definition: iso639.cpp:121
EITHelper(void)
Definition: eithelper.cpp:37
void SetLanguagePreferences(const QStringList &langPref)
Definition: eithelper.cpp:116
static void TimeFix(QDateTime &dt)
Corrects starttime to the multiple of a minute.
Definition: eitfixup.h:83
QMutex eitList_lock
EIT List lock.
Definition: eithelper.h:141
MythDeque< DBEventEIT * > db_events
Definition: eithelper.h:159
static void parse_dvb_event_descriptors(const desc_list_t &list, FixupValue fix, QMap< uint, uint > languagePreferences, QString &title, QString &subtitle, QString &description, QMap< QString, QString > &items)
Definition: eithelper.cpp:240
static guint32 * tmp
Definition: goom_core.c:35
static uint GetMplexID(uint sourceid, const QString &channum)
void enqueue(T d)
Adds item to the back of the list. O(1).
Definition: mythdeque.h:42
uint GetListSize(void) const
Definition: eithelper.cpp:55
void AddEIT(uint atsc_major, uint atsc_minor, const EventInformationTable *eit)
Definition: eithelper.cpp:145
uint EventCount() const
Definition: atsctables.h:553
QDateTime StartTimeUTC(uint i) const
Definition: dvbtables.h:331
QString Text(void) const
QString advisory(void) const
Overall structure.
QVariant value(int i) const
Definition: mythdbcon.h:198
uint64_t FixupKey
Definition: eithelper.h:78
void WriteEITCache(void)
Definition: eithelper.cpp:790
uint EventCount() const
Definition: dvbtables.h:322
uint channelid
id of the channel
Definition: eithelper.h:151
QString seriesid(void) const
const unsigned char * m_desc
Definition: eithelper.h:43
ATSCSRCToEvents incomplete_events
Definition: eithelper.h:156
def rating(profile, smoonURL, gate)
Definition: scan.py:25
MBASE_PUBLIC QDateTime fromSecsSinceEpoch(uint seconds)
This function takes the number of seconds since the start of the epoch and returns a QDateTime with t...
Definition: mythdate.cpp:88
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
uint ServiceID(void) const
Definition: dvbtables.h:305
uint ETMLocation(uint i) const
Definition: atsctables.h:579
static uint get_chan_id_from_db_dtv(uint sourceid, uint serviceid, uint tunedchanid)
Definition: eithelper.cpp:985
QMap< uint, ATSCEtt > EventIDToETT
Definition: eithelper.h:73
void WriteToDB(void)
Definition: eitcache.cpp:308
uint DescriptorsLength(uint i) const
Definition: dvbtables.h:353
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
T dequeue()
Removes item from front of list and returns a copy. O(1).
Definition: mythdeque.h:32
static uint get_chan_id_from_db_atsc(uint sourceid, uint atsc_major, uint atsc_minor)
Definition: eithelper.cpp:890
void AddETT(uint atsc_major, uint atsc_minor, const ExtendedTextTable *ett)
Definition: eithelper.cpp:190
bool isActive(void) const
Definition: mythdbcon.h:204
uint EventID(uint i) const
Definition: atsctables.h:558
QString Name(uint) const
uint OriginalNetworkID(void) const
Definition: dvbtables.h:312
int gps_offset
Definition: eithelper.h:147
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
static void parse_dvb_component_descriptors(const desc_list_t &list, unsigned char &subtitle_type, unsigned char &audio_properties, unsigned char &video_properties)
Definition: eithelper.cpp:342
EITFixUp * eitfixup
Definition: eithelper.h:144
EIT Fix Up Functions.
Definition: eitfixup.h:13
static void RescheduleMatch(uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
QString GetDescription(uint i) const
void SetSourceID(uint _sourceid)
Definition: eithelper.cpp:133
static const unsigned char * Find(const desc_list_t &parsed, uint desc_tag)
QDate originalairdate(void) const
EventInformationTables contain program titles, start times, and channel information.
Definition: atsctables.h:521
FixupMap fixup
Definition: eithelper.h:155
uint PruneOldEntries(uint utc_timestamp)
Prunes entries that describe events ending before timestamp time.
Definition: eitcache.cpp:414
ServiceToChanID srv_to_chanid
Definition: eithelper.h:142
uint Nibble2(uint i) const
bool seenEITother
if false we only reschedule the active mplex
Definition: eithelper.h:153
QString GetBestMatch(QMap< uint, uint > &langPrefs) const
QString Text(void) const
uint sourceid
id of the video source
Definition: eithelper.h:150
uint AudioProperties(uint compression_type) const
uint TableID(void) const
Definition: mpegtables.h:479
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:807
ATSCSRCToETTs unmatched_etts
Definition: eithelper.h:157
uint32_t PrivateDataSpecifier(void) const
uint StartTimeRaw(uint i) const
Definition: atsctables.h:563
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
bool IsNewEIT(uint chanid, uint tableid, uint version, uint eventid, uint endtime)
Definition: eitcache.cpp:337
const unsigned char * Descriptors(uint i) const
Definition: atsctables.h:607
uint LengthInSeconds(uint i) const
Definition: atsctables.h:584
virtual ~EITHelper(void)
Definition: eithelper.cpp:46
void PruneEITCache(uint timestamp)
Definition: eithelper.cpp:785
uint DurationInSeconds(uint i) const
Definition: dvbtables.h:342
time_t EndTimeUnixUTC(uint i) const
Definition: dvbtables.h:335
QString rating(void) const
QDateTime maxStarttime
latest starttime of changed events
Definition: eithelper.h:152
static const uint kChunkSize
Maximum number of DB inserts per ProcessEvents call.
Definition: eithelper.h:164
uint ContentType(size_t n=0) const
uint Nibble(uint i) const
uint EventID(uint i) const
Definition: dvbtables.h:326
uint EventID(void) const
Definition: atsctables.h:663
uint64_t FixupValue
Definition: eithelper.h:79
QString GetCategory(void) const
QString programid(void) const
const MultipleStringStructure ExtendedTextMessage() const
Definition: atsctables.h:667
static uint get_chan_id_from_db_dvb(uint sourceid, uint serviceid, uint networkid, uint transportid)
Definition: eithelper.cpp:916
void SetChannelID(uint _channelid)
Definition: eithelper.cpp:139
uint ContentEncoding(size_t n=0) const
uint DescriptorsLength(uint i) const
Definition: atsctables.h:599
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
bool IsValid(void) const
uint ProcessEvents(void)
Inserts events in EIT list.
Definition: eithelper.cpp:66
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:179
static desc_list_t FindBestMatches(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
static desc_list_t FindAll(const desc_list_t &parsed, uint desc_tag)
MultipleStringStructure title(int i) const
Definition: atsctables.h:593
static desc_list_t Parse(const unsigned char *data, uint len)
unsigned char AudioProperties(void) const
const unsigned char * Descriptors() const
void Fix(DBEventEIT &event) const
Definition: eitfixup.cpp:253
QMap< uint, ATSCEvent > EventIDToATSCEvent
Definition: eithelper.h:72
QString rating(void) const
void RescheduleRecordings(void)
Tells scheduler about programming changes.
Definition: eithelper.cpp:1432
static EITCache * s_eitcache
Definition: eithelper.h:145
uint Nibble1(uint i) const
void SetFixup(uint atsc_major, uint atsc_minor, FixupValue eitfixup)
Definition: eithelper.cpp:109
QString advisory(void) const