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