MythTV  master
mpegdescriptors.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // Copyright (c) 2005, Daniel Thor Kristjansson
3 
4 #include <climits>
5 
6 #include "sctedescriptors.h"
7 #include "atscdescriptors.h"
8 #include "dvbdescriptors.h"
9 #include "mythmiscutil.h" // for xml_indent
10 
13 QMap<QString,QString> RegistrationDescriptor::description_map;
14 
16  const unsigned char *data, uint len)
17 {
19  uint off = 0;
20  while (off < len)
21  {
22  tmp.push_back(data+off);
23  MPEGDescriptor desc(data+off, len-off);
24  if (!desc.IsValid())
25  {
26  tmp.pop_back();
27  break;
28  }
29  off += desc.size();
30  }
31  return tmp;
32 }
33 
35  const unsigned char *data, uint len, int excluded_descid)
36 {
38  uint off = 0;
39  while (off < len)
40  {
41  if ((data+off)[0] != excluded_descid)
42  tmp.push_back(data+off);
43  MPEGDescriptor desc(data+off, len-off);
44  if (!desc.IsValid())
45  {
46  if ((data+off)[0] != excluded_descid)
47  tmp.pop_back();
48  break;
49  }
50  off += desc.size();
51  }
52  return tmp;
53 }
54 
55 #include "mythlogging.h"
56 
58  const unsigned char *data, uint len, int excluded_descid)
59 {
61  uint off = 0;
62  while (off < len)
63  {
64  if ((data+off)[0] == excluded_descid)
65  tmp.push_back(data+off);
66  MPEGDescriptor desc(data+off, len-off);
67  if (!desc.IsValid())
68  {
69  if ((data+off)[0] == excluded_descid)
70  tmp.pop_back();
71  break;
72  }
73  off += desc.size();
74  }
75  return tmp;
76 }
77 
78 const unsigned char *MPEGDescriptor::Find(const desc_list_t &parsed,
79  uint desc_tag)
80 {
81  for (const auto *item : parsed)
82  {
83  if (item[0] == desc_tag)
84  return item;
85  }
86  return nullptr;
87 }
88 
89 const unsigned char *MPEGDescriptor::FindExtension(const desc_list_t &parsed,
90  uint desc_tag)
91 {
92  for (const auto *item : parsed)
93  {
94  if (item[0] == DescriptorID::extension &&
95  item[1] > 1 &&
96  item[2] == desc_tag)
97  return item;
98  }
99  return nullptr;
100 }
101 
103 {
105  for (const auto *item : parsed)
106  {
107  if (item[0] == desc_tag)
108  tmp.push_back(item);
109  }
110  return tmp;
111 }
112 
113 static uint maxPriority(const QMap<uint,uint> &langPrefs)
114 {
115  uint max_pri = 0;
116  for (uint pref : langPrefs)
117  max_pri = max(max_pri, pref);
118  return max_pri;
119 }
120 
121 const unsigned char *MPEGDescriptor::FindBestMatch(
122  const desc_list_t &parsed, uint desc_tag, QMap<uint,uint> &langPrefs)
123 {
124  uint match_idx = 0;
125  uint match_pri = UINT_MAX;
126  int unmatched_idx = -1;
127 
128  size_t i = (desc_tag == DescriptorID::short_event) ? 0 : parsed.size();
129  for (; i < parsed.size(); i++)
130  {
131  if (DescriptorID::short_event == parsed[i][0])
132  {
133  ShortEventDescriptor sed(parsed[i]);
134  if (!sed.IsValid())
135  continue;
136  QMap<uint,uint>::const_iterator it =
137  langPrefs.find(sed.CanonicalLanguageKey());
138 
139  if ((it != langPrefs.end()) && (*it < match_pri))
140  {
141  match_idx = i;
142  match_pri = *it;
143  }
144 
145  if (unmatched_idx < 0)
146  unmatched_idx = i;
147  }
148  }
149 
150  if (match_pri != UINT_MAX)
151  return parsed[match_idx];
152 
153  if ((desc_tag == DescriptorID::short_event) && (unmatched_idx >= 0))
154  {
155  ShortEventDescriptor sed(parsed[unmatched_idx]);
156  if (sed.IsValid())
157  {
158  langPrefs[sed.CanonicalLanguageKey()] = maxPriority(langPrefs) + 1;
159  return parsed[unmatched_idx];
160  }
161  }
162 
163  return nullptr;
164 }
165 
167  const desc_list_t &parsed, uint desc_tag, QMap<uint,uint> &langPrefs)
168 {
169  uint match_pri = UINT_MAX;
170  int match_key = 0;
171  int unmatched_idx = -1;
172 
173  size_t i = (desc_tag == DescriptorID::extended_event) ? 0 : parsed.size();
174  for (; i < parsed.size(); i++)
175  {
176  if (DescriptorID::extended_event == parsed[i][0])
177  {
178  ExtendedEventDescriptor eed(parsed[i]);
179  if (!eed.IsValid())
180  continue;
181  QMap<uint,uint>::const_iterator it =
182  langPrefs.find(eed.CanonicalLanguageKey());
183 
184  if ((it != langPrefs.end()) && (*it < match_pri))
185  {
186  match_key = eed.LanguageKey();
187  match_pri = *it;
188  }
189 
190  if (unmatched_idx < 0)
191  unmatched_idx = i;
192  }
193  }
194 
195  if ((desc_tag == DescriptorID::extended_event) &&
196  (match_key == 0) && (unmatched_idx >= 0))
197  {
198  ExtendedEventDescriptor eed(parsed[unmatched_idx]);
199  if (eed.IsValid())
200  {
201  langPrefs[eed.CanonicalLanguageKey()] = maxPriority(langPrefs) + 1;
202  match_key = eed.LanguageKey();
203  }
204  }
205 
207  if (match_pri == UINT_MAX)
208  return tmp;
209 
210  for (const auto *j : parsed)
211  {
212  if ((DescriptorID::extended_event == desc_tag) &&
214  {
216  if (eed.IsValid() && (eed.LanguageKey() == match_key))
217  tmp.push_back(j);
218  }
219  }
220 
221  return tmp;
222 }
223 
224 #define EMPTY_STR_16 "","","","", "","","","", "","","","", "","","","",
225 
226 const std::array<const std::string,256> descriptor_tag_strings
227 {
228  /* 0x00 */ "", /* 0x01 */ "",
229  /* 0x02 */ "Video", /* 0x03 */ "Audio",
230  /* 0x04 */ "Hierarchy", /* 0x05 */ "Registration",
231  /* 0x06 */ "Data Stream Alignment", /* 0x07 */ "Target Background Grid",
232  /* 0x08 */ "Video Window", /* 0x09 */ "Conditional Access",
233  /* 0x0A */ "ISO-639 Language", /* 0x0B */ "System Clock",
234  /* 0x0C */ "Multiplex Buffer Utilization", /* 0x0D */ "Copyright",
235  /* 0x0E */ "Maximum Bitrate", /* 0x0F */ "Private Data Indicator",
236 
237  /* 0x10 */ "Smoothing Buffer", /* 0x11 */ "STD",
238  /* 0x12 */ "IBP", /* 0x13 */ "DSM-CC Carousel Identifier",
239  /* 0x14 */ "DSM-CC Association Tag",
240  /* 0x15 */ "DSM-CC Deferred Association Tag",
241  /* 0x16 */ "Reserved(0x16)", /* 0x17 */ "DSM-CC NPT Reference",
242  /* 0x18 */ "DSM-CC NPT Endpoint", /* 0x19 */ "DSM-CC Stream Mode",
243  /* 0x1A */ "DSM-CC Stream Event", /* 0x1B */ "MPEG-4 Video",
244  /* 0x1C */ "MPEG-4 Audio", /* 0x1D */ "IOD",
245  /* 0x1E */ "SL", /* 0x1F */ "FMC",
246 
247  /* 0x20 */ "External ES ID", /* 0x21 */ "Multimpex Code",
248  /* 0x22 */ "FMX buffer Size", /* 0x23 */ "Multiplex Buffer",
249  /* 0x24 */ "Content Labeling", /* 0x25 */ "Metadata Pointer",
250  /* 0x26 */ "Metadata", /* 0x27 */ "Metadata Std",
251  /* 0x28 */ "AVC Video", /* 0x29 */ "IPMP DRM",
252  /* 0x2A */ "AVC Timing & HRD", /* 0x2B */ "AAC Audio",
253  /* 0x2C */ "Flex Mux Timing", /* 0x2D */ "",
254  /* 0x2E */ "", /* 0x2F */ "",
255 
256  /* 0x30-0x3F */ EMPTY_STR_16
257 
258  /* 0x40 */ "Network Name", /* 0x41 */ "Service List",
259  /* 0x42 */ "DVB Stuffing", /* 0x43 */ "Satellite Delivery System",
260  /* 0x44 */ "Cable Delivery System", /* 0x45 */ "VBI Data",
261  /* 0x46 */ "VBI Teletext", /* 0x47 */ "Bouquet Name",
262  /* 0x48 */ "Service", /* 0x49 */ "Country Availability",
263  /* 0x4A */ "Linkage", /* 0x4B */ "NVOD Reference",
264  /* 0x4C */ "DVB Time-shifted Service",/* 0x4D */ "Short Event",
265  /* 0x4E */ "Extended Event", /* 0x4F */ "Time-shifted Event",
266 
267  /* 0x50 */ "Component", /* 0x51 */ "Mosaic",
268  /* 0x52 */ "Stream Identifier",
269  /* 0x53 */ "Conditional Access Identifier",
270  /* 0x54 */ "Content", /* 0x55 */ "Parental Rating",
271  /* 0x56 */ "Teletext", /* 0x57 */ "Telephone",
272  /* 0x58 */ "Local Time Offset", /* 0x59 */ "Subtitling",
273  /* 0x5A */ "Terrestrial Delivery System",
274  /* 0x5B */ "Multilingual Network Name",
275  /* 0x5C */ "Multilingual Bouquet Name",
276  /* 0x5D */ "Multilingual Service Name",
277  /* 0x5E */ "Multilingual Component",
278  /* 0x5F */ "Private Data Specifier",
279 
280  /* 0x60 */ "Service Move", /* 0x61 */ "Short Smoothing Buffer",
281  /* 0x62 */ "Frequency List", /* 0x63 */ "Partial Transport Stream",
282  /* 0x64 */ "Data Broadcast", /* 0x65 */ "Scrambling",
283  /* 0x66 */ "Data Broadcast ID", /* 0x67 */ "Transport Stream",
284  /* 0x68 */ "DSNG", /* 0x69 */ "PDC",
285  /* 0x6A */ "AC-3", /* 0x6B */ "Ancillary Data",
286  /* 0x6C */ "Cell List", /* 0x6D */ "Cell Frequency Link",
287  /* 0x6E */ "Announcement Support", /* 0x6F */ "Application Signalling",
288 
289  /* 0x70 */ "Adaptation Field Data", /* 0x71 */ "Service Identifier",
290  /* 0x72 */ "Service Availability", /* 0x73 */ "Default Authority",
291  /* 0x74 */ "Related Content", /* 0x75 */ "TVA ID",
292  /* 0x76 */ "DVB Content Identifier",/* 0x77 */ "Time Slice FEC Identifier",
293  /* 0x78 */ "ECM Repetition Rate", /* 0x79 */ "DVB-S2 Delivery Identifier",
294  /* 0x7A */ "E-AC-3", /* 0x7B */ "DTS",
295  /* 0x7C */ "AAC", /* 0x7D */ "XAIT location",
296  /* 0x7E */ "FTA content management",/* 0x7F */ "Extension",
297 
298  /* 0x80 */ "ATSC Stuffing", /* 0x81 */ "AC-3 Audio",
299  /* 0x82 */ "SCTE Frame Rate", /* 0x83 */ "SCTE Extended Video",
300  /* 0x84 */ "SCTE Component Name", /* 0x85 */ "ATSC Program Identifier",
301  /* 0x86 */ "Caption Service", /* 0x87 */ "Content Advisory",
302  /* 0x88 */ "ATSC CA Descriptor", /* 0x89 */ "ATSC Descriptor Tag",
303  /* 0x8A */ "SCTE CUE Identifier", /* 0x8B */ "",
304  /* 0x8C */ "TimeStamp", /* 0x8D */ "",
305  /* 0x8E */ "", /* 0x8F */ "",
306 
307  /* 0x90 */ "SCTE Frequency Spec", /* 0x91 */ "SCTE Modulation Params",
308  /* 0x92 */ "SCTE TSID", /* 0x93 */ "SCTE Revision Detection",
309  /* 0x94 */ "SCTE Two part channel", /* 0x95 */ "SCTE Channel Properties",
310  /* 0x96 */ "SCTE Daylight Savings", /* 0x97 */ "SCTE AFD",
311  /* 0x98 */ "", /* 0x99 */ "",
312  /* 0x9A */ "", /* 0x9B */ "",
313  /* 0x9C */ "", /* 0x9D */ "",
314  /* 0x9E */ "", /* 0x9F */ "",
315 
316  /* 0xA0 */ "Extended Channel Name", /* 0xA1 */ "Service Location",
317  /* 0xA2 */ "ATSC Time-shifted Service",/*0xA3*/"Component Name",
318  /* 0xA4 */ "ATSC Data Service", /* 0xA5 */ "ATSC PID Count",
319  /* 0xA6 */ "ATSC Download",
320  /* 0xA7 */ "ATSC Multiprotocol Encapsulation",
321  /* 0xA8 */ "DCC Departing Request", /* 0xA9 */ "DCC Arriving Request",
322  /* 0xAA */ "ATSC Restrictions Control",/*0xAB*/"ATSC Genre",
323  /* 0xAC */ "SCTE MAC Address List", /* 0xAD */ "ATSC Private Information",
324  /* 0xAE */ "ATSC Compatibility Wrap",/* 0xAF */"ATSC Broadcaster Policy",
325 
326  /* 0xB0 */ "", /* 0xB1 */ "",
327  /* 0xB2 */ "", /* 0xB3 */ "",
328  /* 0xB4 */ "", /* 0xB5 */ "",
329  /* 0xB6 */ "ATSC Content ID", /* 0xB7 */ "",
330  /* 0xB8 */ "", /* 0xB9 */ "",
331  /* 0xBA */ "", /* 0xBB */ "",
332  /* 0xBC */ "", /* 0xBD */ "",
333  /* 0xBE */ "", /* 0xBF */ "",
334 
335  /* 0xC0-0xCF */ EMPTY_STR_16
336  /* 0xD0-0xDF */ EMPTY_STR_16
337  /* 0xE0-0xEF */ EMPTY_STR_16
338  /* 0xF0-0xFF */ EMPTY_STR_16
339 };
340 
341 static void comma_list_append(QString &str, const QString& extra)
342 {
343  if (str.isEmpty())
344  str = extra;
345  else
346  str = str + ", " + extra;
347 }
348 
350 {
351  QString str = QString::fromStdString(descriptor_tag_strings[DescriptorTag()]);
352 
353  switch (DescriptorTag())
354  {
356  comma_list_append(str, "Possibly DVB Logical Channel Descriptor");
357  break;
359  comma_list_append(str, "Possibly Dishnet Rights");
360  break;
362  comma_list_append(str, "Possibly Dishnet MPAA");
363  break;
365  comma_list_append(str, "Possibly Dishnet EIT Name");
366  break;
368  comma_list_append(str, "Possibly Dishnet EIT Description");
369  break;
371  comma_list_append(str, "Possibly Dishnet Properties");
372  break;
374  comma_list_append(str, "Possibly Dishnet V-Chip");
375  break;
376  case PrivateDescriptorID::dish_event_tags: /* 0x96 */
377  comma_list_append(str, "Possibly Dishnet Tag");
378  break;
380  comma_list_append(str, "Possibly DVB Sky/OpenTV Channel List");
381  break;
383  comma_list_append(str, "Possibly Premiere DE Content Order");
384  break;
386  comma_list_append(str, "Possibly Premiere DE Parental Information");
387  break;
389  comma_list_append(str, "Possibly Premiere DE Content Transmission");
390  break;
391  }
392 
393  if (str.isEmpty())
394  str = QString("Unknown(%1)").arg(DescriptorTag());
395 
396  return str;
397 }
398 
399 #define SET_STRING(DESC_NAME) do { \
400  if (IsValid()) { DESC_NAME d(m_data, DescriptorLength()+2); \
401  if (d.IsValid()) str = d.toString(); } } while (false)
402 
403 QString MPEGDescriptor::descrDump(const QString &name) const
404 {
405  QString str;
406  str = QString("%1 Descriptor (0x%2) length(%3).")
407  .arg(name)
408  .arg(DescriptorTag(),2,16,QChar('0'))
409  .arg(DescriptorLength());
410  if (DescriptorLength() > 0)
411  {
412  str.append(" Dumping\n");
413  str.append(hexdump());
414  }
415  return str;
416 }
417 
418 QString MPEGDescriptor::toString(void) const
419 {
420  return toStringPD(0);
421 }
422 
423 QString MPEGDescriptor::toStringPD(uint priv_dsid) const
424 {
425  QString str;
426 
427  if (!IsValid())
428  {
429  str = "Invalid Descriptor";
430  }
432  {
434  }
436  {
438  }
440  {
442  }
444  {
446  }
448  {
450  }
452  {
454  }
456  {
458  }
460  {
462  }
464  {
466  }
468  {
470  }
471  else if (DescriptorID::service == DescriptorTag())
472  {
474  }
476  {
478  }
479  //else if (DescriptorID::linkage == DescriptorTag())
480  //{
481  // SET_STRING(LinkageDescriptor);
482  //}
484  {
486  }
488  {
490  }
492  {
494  }
496  {
498  }
499  //else if (DescriptorID::ancillary_data == DescriptorTag())
500  //{
501  // SET_STRING(AncillaryDataDescriptor);
502  //}
504  {
506  }
508  {
510  }
511  //
512  // Extension descriptors for extension 0x7F
513  else if (DescriptorTag() == DescriptorID::extension &&
515  {
517  }
518  else if (DescriptorTag() == DescriptorID::extension &&
520  {
522  }
523  else if (DescriptorTag() == DescriptorID::extension &&
525  {
527  }
528  else if (DescriptorTag() == DescriptorID::extension &&
530  {
532  }
533  else if (DescriptorTag() == DescriptorID::extension &&
535  {
537  }
538  else if (DescriptorTag() == DescriptorID::extension &&
540  {
542  }
543  else if (DescriptorTag() == DescriptorID::extension &&
545  {
547  }
548  else if (DescriptorTag() == DescriptorID::extension &&
550  {
552  }
553  else if (DescriptorTag() == DescriptorID::extension &&
555  {
557  }
558  else if (DescriptorTag() == DescriptorID::extension &&
560  {
562  }
563  else if (DescriptorTag() == DescriptorID::extension &&
565  {
567  }
568  //
569  // User Defined DVB descriptors, range 0x80-0xFE
570  else if (priv_dsid == PrivateDataSpecifierID::SES &&
572  {
573  str = descrDump("NorDig Content Protection");
574  }
575  else if (priv_dsid == PrivateDataSpecifierID::OTV &&
576  0x80 <= DescriptorTag() && DescriptorTag() < 0xFF)
577  {
578  str = descrDump("OpenTV Private ");
579  }
580  else if (priv_dsid == PrivateDataSpecifierID::BSB1 &&
582  {
584  }
585  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
587  {
589  }
590  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
592  {
594  }
595  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
597  {
599  }
600  else if (priv_dsid == PrivateDataSpecifierID::CASEMA &&
602  {
603  str = descrDump("Video on Demand");
604  }
605  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
606  priv_dsid == PrivateDataSpecifierID::NORDIG ||
607  priv_dsid == PrivateDataSpecifierID::ITC ) &&
609  {
611  }
612  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
613  priv_dsid == PrivateDataSpecifierID::NORDIG ||
614  priv_dsid == PrivateDataSpecifierID::ITC ) &&
616  {
618  }
619  //
620  // POSSIBLY UNSAFE ! -- begin
621  // ATSC/SCTE descriptors, range 0x80-0xFE
623  {
625  }
627  {
629  }
631  {
633  }
635  {
637  }
639  {
641  }
642  else if (priv_dsid == 0 &&
644  {
646  }
647  // POSSIBLY UNSAFE ! -- end
648  else
649  {
651  }
652  return str;
653 }
654 
657 QString MPEGDescriptor::toStringXML(uint level) const
658 {
659  QString indent_0 = xml_indent(level);
660  QString indent_1 = xml_indent(level+1);
661  QString str;
662 
663  str += indent_0 + "<Descriptor>\n";
664  str += indent_1 + QString("<Tag>0x%1</Tag>\n")
665  .arg(DescriptorTag(),2,16,QChar('0'));
666  str += indent_1 + QString("<Description>%1</Description>\n")
667  .arg(DescriptorTagString(),0,16);
668 
669  str += indent_1 + "<Data>";
670  for (uint i = 0; i < DescriptorLength(); i++)
671  {
672  if (((i%8) == 0) && i)
673  str += "\n" + indent_1 + " ";
674  str += QString("0x%1 ").arg(m_data[i+2],2,16,QChar('0'));
675  }
676 
677  str += "\n" + indent_1 + "</Data>\n";
678  str += indent_1 + "<Decoded>" + toString().toHtmlEscaped() + "</Decoded>\n";
679  str += indent_0 + "</Descriptor>";
680 
681  return str;
682 }
683 
684 // Dump the descriptor in the same format as hexdump -C
685 QString MPEGDescriptor::hexdump(void) const
686 {
687  uint i = 0;
688  QString str;
689  QString hex;
690  QString prt;
691  for (i=0; i<DescriptorLength(); i++)
692  {
693  uint ch = m_data[i+2];
694  hex.append(QString(" %1").arg(ch, 2, 16, QChar('0')));
695  prt.append(QString("%1").arg(isprint(ch) ? QChar(ch) : '.'));
696  if (((i+1) % 8) == 0)
697  hex.append(" ");
698  if (((i+1) % 16) == 0)
699  {
700  str.append(QString(" %1 %2 |%3|")
701  .arg(i - (i % 16),3,16,QChar('0'))
702  .arg(hex).arg(prt));
703  hex.clear();
704  prt.clear();
705  if (i < (DescriptorLength() - 1))
706  {
707  str.append("\n");
708  }
709  }
710  }
711  if (!hex.isEmpty())
712  {
713  str.append(QString(" %1 %2 |%3|")
714  .arg(i - (i % 16),3,16,QChar('0'))
715  .arg(hex,-50,' ').arg(prt));
716  }
717  return str;
718 }
719 
721 {
722  QMutexLocker locker(&description_map_lock);
724  return;
725 
726  description_map["AC-3"] = "ATSC audio stream A/52";
727  description_map["AVSV"] = "China A/V Working Group";
728  description_map["BDC0"] = "Broadcast Data Corporation Software Data Service";
729  description_map["BSSD"] = "SMPTE 302M-1998 Audio data as specified in (AES3)";
730  description_map["CAPO"] = "SMPTE 315M-1999 Camera Positioning Information";
731  description_map["CUEI"] = "SCTE 35 2003, Cable Digital Program Insertion Cueing Message";
732  description_map["DDED"] = "LGEUS Digital Delivery with encryption and decryption";
733  description_map["DISH"] = "EchoStar MPEG streams";
734  description_map["DRA1"] = "Chinese EIS SJ/T11368-2006 DRA digital audio";
735  description_map["DTS1"] = "DTS Frame size of 512 bytes";
736  description_map["DTS2"] = "DTS Frame size of 1024 bytes";
737  description_map["DTS3"] = "DTS Frame size of 2048";
738  description_map["DVDF"] = "DVD compatible MPEG2-TS";
739  description_map["ETV1"] = "CableLabs ETV info is present";
740  description_map["GA94"] = "ATSC program ID A/53";
741  description_map["GWKS"] = "GuideWorks EPG info";
742  description_map["HDMV"] = "Blu-Ray A/V for read-only media (H.264 TS)";
743  description_map["HDMX"] = "Matsushita-TS";
744  description_map["KLVA"] = "SMPTE RP 217-2001 MXF KLV packets present";
745  description_map["LU-A"] = "SMPTE RDD-11 HDSDI HD serial/video data";
746  description_map["MTRM"] = "D-VHS compatible MPEG2-TS";
747  description_map["NMR1"] = "Nielsen content identifier";
748  description_map["PAUX"] = "Philips ES containing low-speed data";
749  description_map["PMSF"] = "MPEG-TS stream modified by STB";
750  description_map["PRMC"] = "Philips ES containing remote control data";
751  description_map["SCTE"] = "SCTE 54 2003 Digital Video Service Multiplex and TS for Cable";
752  description_map["SEN1"] = "ATSC Private Information identifies source of stream";
753  description_map["SESF"] = "Blu-Ray A/V for ReWritable media (H.264 TS)";
754  description_map["SPLC"] = "SMPTE Proposed 312M Splice Point compatible TS";
755  description_map["SVMD"] = "SMPTE Proposed Video Metatdata Dictionary for MPEG2-TS";
756  description_map["SZMI"] = "ATSC Private Info from Building B";
757  description_map["TRIV"] = "ATSC Private Info from Triveni Digital";
758  description_map["TSBV"] = "Toshiba self-encoded H.264 TS";
759  description_map["TSHV"] = "Sony self-encoded MPEG-TS and private data";
760  description_map["TSMV"] = "Sony self-encoded MPEG-TS and private data";
761  description_map["TVG1"] = "TV Guide EPG Data";
762  description_map["TVG2"] = "TV Guide EPG Data";
763  description_map["TVG3"] = "TV Guide EPG Data";
764  description_map["ULE1"] = "IETF RFC4326 compatible MPEG2-TS";
765  description_map["VC-1"] = "SMPTE Draft RP 227 VC-1 Bitstream Transport Encodings";
766 
767  for (uint i = 0; i <= 99; i++)
768  {
769  description_map[QString("US%1").arg(i, 2, QLatin1Char('0'))] =
770  "NIMA, Unspecified military application";
771  }
772 
774 }
775 
776 QString RegistrationDescriptor::GetDescription(const QString &fmt)
777 {
779 
780  QString ret;
781  {
782  QMutexLocker locker(&description_map_lock);
783  QMap<QString,QString>::const_iterator it = description_map.find(fmt);
784  if (it != description_map.end())
785  ret = *it;
786  }
787 
788  return ret;
789 }
790 
792 {
793  QString fmt = FormatIdentifierString();
794  QString msg = QString("Registration Descriptor: '%1' ").arg(fmt);
795 
796  QString msg2 = GetDescription(fmt);
797  if (msg2.isEmpty())
798  msg2 = "Unknown, see http://www.smpte-ra.org/mpegreg/mpegreg.html";
799 
800  return msg + msg2;
801 }
802 
804 {
805  return QString("Conditional Access: sid(0x%1) pid(0x%2) data_size(%3)")
806  .arg(SystemID(),0,16).arg(PID(),0,16).arg(DataSize());
807 }
808 
810 {
811  return QString("ISO-639 Language: code(%1) canonical(%2) eng(%3)")
814 }
815 
817 {
818  return QString("AVC Video: IDC prof(%1) IDC level(%2) sets(%3%4%5) "
819  "compat(%6) still(%7) 24hr(%8) FramePacking(%9)")
820  .arg(ProfileIDC()).arg(LevelIDC())
821  .arg(static_cast<int>(ConstaintSet0()))
822  .arg(static_cast<int>(ConstaintSet1()))
823  .arg(static_cast<int>(ConstaintSet2()))
824  .arg(AVCCompatible())
825  .arg(static_cast<int>(AVCStill()))
826  .arg(static_cast<int>(AVC24HourPicture()))
827  .arg(static_cast<int>(FramePackingSEINotPresentFlag()));
828 }
829 
831 {
832  return QString("HEVC Video: ");
833 }
ServiceRelocatedDescriptor
Definition: dvbdescriptors.h:1414
MPEGDescriptor::toString
virtual QString toString(void) const
Definition: mpegdescriptors.cpp:418
DescriptorID::hevc_video
@ hevc_video
Definition: mpegdescriptors.h:69
PrivateDataSpecifierID::CASEMA
@ CASEMA
Definition: mpegdescriptors.h:267
DescriptorID::s2x_satellite_delivery_system
@ s2x_satellite_delivery_system
Definition: mpegdescriptors.h:157
PrivateDataSpecifierID::BSB1
@ BSB1
Definition: mpegdescriptors.h:266
ISO639LanguageDescriptor::CanonicalLanguageString
QString CanonicalLanguageString(void) const
Definition: mpegdescriptors.h:417
AudioStreamDescriptor
Definition: atscdescriptors.h:210
MPEGDescriptor::DescriptorTag
uint DescriptorTag(void) const
Definition: mpegdescriptors.h:325
MPEGDescriptor::DescriptorLength
uint DescriptorLength(void) const
Definition: mpegdescriptors.h:326
DescriptorID::supplementary_audio
@ supplementary_audio
Definition: mpegdescriptors.h:146
CountryAvailabilityDescriptor
Definition: dvbdescriptors.h:623
MPEGDescriptor::descrDump
QString descrDump(const QString &name) const
Definition: mpegdescriptors.cpp:403
DescriptorID::network_change_notify
@ network_change_notify
Definition: mpegdescriptors.h:147
PrivateDescriptorID::premiere_parental_information
@ premiere_parental_information
Definition: mpegdescriptors.h:241
FrequencyListDescriptor
Definition: dvbdescriptors.h:1572
FreesatLCNDescriptor
Freesat Logical Channel Number descriptor.
Definition: dvbdescriptors.h:2591
AVCVideoDescriptor::ProfileIDC
uint ProfileIDC(void) const
Definition: mpegdescriptors.h:433
DescriptorID::extension
@ extension
Definition: mpegdescriptors.h:138
ExtendedEventDescriptor::CanonicalLanguageKey
int CanonicalLanguageKey(void) const
Definition: dvbdescriptors.h:1540
ExtendedChannelNameDescriptor
Provides the long channel name for the virtual channel containing this descriptor.
Definition: atscdescriptors.h:344
CaptionServiceDescriptor
Definition: atscdescriptors.h:78
PrivateDescriptorID::freesat_lcn_table
@ freesat_lcn_table
Definition: mpegdescriptors.h:231
DescriptorID::extended_event
@ extended_event
Definition: mpegdescriptors.h:86
PrivateDataSpecifierID::SES
@ SES
Definition: mpegdescriptors.h:265
MPEGDescriptor::hexdump
QString hexdump(void) const
Definition: mpegdescriptors.cpp:685
ISO639LanguageDescriptor
Definition: mpegdescriptors.h:403
ExtendedEventDescriptor::LanguageKey
int LanguageKey(void) const
Definition: dvbdescriptors.h:1536
AVCVideoDescriptor::FramePackingSEINotPresentFlag
bool FramePackingSEINotPresentFlag(void) const
Definition: mpegdescriptors.h:448
DescriptorID::conditional_access
@ conditional_access
Definition: mpegdescriptors.h:33
RegistrationDescriptor::toString
QString toString() const override
Definition: mpegdescriptors.cpp:791
DescriptorID::service
@ service
Definition: mpegdescriptors.h:80
desc_list_t
vector< const unsigned char * > desc_list_t
Definition: mpegdescriptors.h:18
CableDeliverySystemDescriptor
Definition: dvbdescriptors.h:717
SHDeliverySystemDescriptor
Definition: dvbdescriptors.h:1222
PrivateDescriptorID::casema_video_on_demand
@ casema_video_on_demand
Definition: mpegdescriptors.h:210
PrivateDataSpecifierID::OTV
@ OTV
Definition: mpegdescriptors.h:275
ISO639LanguageDescriptor::toString
QString toString() const override
Definition: mpegdescriptors.cpp:809
CueIdentifierDescriptor
This descriptor is used to identify streams with SpliceInformationTable data in them.
Definition: sctedescriptors.h:157
PrivateDescriptorID::dish_event_mpaa
@ dish_event_mpaa
Definition: mpegdescriptors.h:214
DescriptorID::scte_revision_detection
@ scte_revision_detection
Definition: mpegdescriptors.h:176
DVBLogicalChannelDescriptor
DVB Logical Channel Descriptor.
Definition: dvbdescriptors.h:2533
RegistrationDescriptor
Definition: mpegdescriptors.h:359
PrivateDataSpecifierID::ITC
@ ITC
Definition: mpegdescriptors.h:272
ShortEventDescriptor::CanonicalLanguageKey
int CanonicalLanguageKey(void) const
Definition: dvbdescriptors.h:2144
DescriptorID::ac3_audio_stream
@ ac3_audio_stream
Definition: mpegdescriptors.h:161
DescriptorID::service_list
@ service_list
Definition: mpegdescriptors.h:73
AVCVideoDescriptor::ConstaintSet1
bool ConstaintSet1(void) const
Definition: mpegdescriptors.h:437
DescriptorID::iso_639_language
@ iso_639_language
Definition: mpegdescriptors.h:34
DescriptorID::frequency_list
@ frequency_list
Definition: mpegdescriptors.h:108
ConditionalAccessDescriptor::DataSize
uint DataSize(void) const
Definition: mpegdescriptors.h:397
PrivateDescriptorID::opentv_channel_list
@ opentv_channel_list
Definition: mpegdescriptors.h:253
iso639_key_toName
QString iso639_key_toName(int iso639_2)
Converts a canonical key to language name in English.
Definition: iso639.cpp:111
descriptor_tag_strings
const std::array< const std::string, 256 > descriptor_tag_strings
Definition: mpegdescriptors.cpp:227
BouquetNameDescriptor
Definition: dvbdescriptors.h:270
RegistrationDescriptor::FormatIdentifierString
QString FormatIdentifierString(void) const
Definition: mpegdescriptors.h:372
TerrestrialDeliverySystemDescriptor
Definition: dvbdescriptors.h:905
atscdescriptors.h
MPEGDescriptor::ParseAndExclude
static desc_list_t ParseAndExclude(const unsigned char *data, uint len, int excluded_descid)
Definition: mpegdescriptors.cpp:34
tmp
static guint32 * tmp
Definition: goom_core.cpp:30
ShortEventDescriptor
Definition: dvbdescriptors.h:2131
DescriptorID::teletext
@ teletext
Definition: mpegdescriptors.h:95
MPEGDescriptor::FindExtension
static const unsigned char * FindExtension(const desc_list_t &parsed, uint desc_tag)
Definition: mpegdescriptors.cpp:89
MPEGDescriptor::IsValid
bool IsValid(void) const
Definition: mpegdescriptors.h:322
sctedescriptors.h
PrivateDataSpecifierID::EACEM
@ EACEM
Definition: mpegdescriptors.h:268
mythlogging.h
MPEGDescriptor::toStringXML
virtual QString toStringXML(uint indent_level) const
Returns XML representation of string the TS Reader XML format.
Definition: mpegdescriptors.cpp:657
maxPriority
static uint maxPriority(const QMap< uint, uint > &langPrefs)
Definition: mpegdescriptors.cpp:113
MPEGDescriptor::Parse
static desc_list_t Parse(const unsigned char *data, uint len)
Definition: mpegdescriptors.cpp:15
S2XSatelliteDeliverySystemDescriptor
Definition: dvbdescriptors.h:1486
DescriptorID::network_name
@ network_name
Definition: mpegdescriptors.h:72
ConditionalAccessDescriptor::SystemID
uint SystemID(void) const
Definition: mpegdescriptors.h:395
DescriptorID::avc_video
@ avc_video
Definition: mpegdescriptors.h:64
DescriptorID::image_icon
@ image_icon
Definition: mpegdescriptors.h:143
MPEGDescriptor
Definition: mpegdescriptors.h:296
PrivateDescriptorID::dvb_simulcast_channel_descriptor
@ dvb_simulcast_channel_descriptor
Definition: mpegdescriptors.h:207
TargetRegionDescriptor
Definition: dvbdescriptors.h:1341
MPEGDescriptor::m_data
const unsigned char * m_data
Definition: mpegdescriptors.h:350
DescriptorID::terrestrial_delivery_system
@ terrestrial_delivery_system
Definition: mpegdescriptors.h:99
ConditionalAccessDescriptor
Definition: mpegdescriptors.h:390
MessageDescriptor
Definition: dvbdescriptors.h:1307
DescriptorID::message
@ message
Definition: mpegdescriptors.h:148
MPEGDescriptor::ParseOnlyInclude
static desc_list_t ParseOnlyInclude(const unsigned char *data, uint len, int excluded_descid)
Definition: mpegdescriptors.cpp:57
ExtendedEventDescriptor
Definition: dvbdescriptors.h:1523
DescriptorID::country_availability
@ country_availability
Definition: mpegdescriptors.h:81
PrivateDescriptorID::premiere_content_transmission
@ premiere_content_transmission
Definition: mpegdescriptors.h:242
AVCVideoDescriptor::AVC24HourPicture
bool AVC24HourPicture(void) const
Definition: mpegdescriptors.h:447
DescriptorID::sh_delivery_system
@ sh_delivery_system
Definition: mpegdescriptors.h:145
T2DeliverySystemDescriptor
Definition: dvbdescriptors.h:1090
SkyLCNDescriptor
Sky Logical Channel Number descriptor.
Definition: dvbdescriptors.h:2749
DescriptorID::caption_service
@ caption_service
Definition: mpegdescriptors.h:163
SET_STRING
#define SET_STRING(DESC_NAME)
Definition: mpegdescriptors.cpp:399
DVBSimulcastChannelDescriptor
DVB HD Simulcast Logical Channel Descriptor.
Definition: dvbdescriptors.h:2561
MPEGDescriptor::DescriptorTagExtension
uint DescriptorTagExtension(void) const
Definition: mpegdescriptors.h:327
PrivateDescriptorID::dish_event_tags
@ dish_event_tags
Definition: mpegdescriptors.h:219
MPEGDescriptor::toStringPD
virtual QString toStringPD(uint priv_dsid) const
Definition: mpegdescriptors.cpp:423
SupplementaryAudioDescriptor
Definition: dvbdescriptors.h:1247
DescriptorID::short_event
@ short_event
Definition: mpegdescriptors.h:85
uint
unsigned int uint
Definition: compat.h:140
comma_list_append
static void comma_list_append(QString &str, const QString &extra)
Definition: mpegdescriptors.cpp:341
HEVCVideoDescriptor
ISO 13818-1:2013/FDAM 3 (E) page 7.
Definition: mpegdescriptors.h:485
MPEGDescriptor::FindAll
static desc_list_t FindAll(const desc_list_t &parsed, uint desc_tag)
Definition: mpegdescriptors.cpp:102
PrivateDescriptorID::dish_event_properties
@ dish_event_properties
Definition: mpegdescriptors.h:217
PrivateDescriptorID::dvb_logical_channel_descriptor
@ dvb_logical_channel_descriptor
Definition: mpegdescriptors.h:206
AVCVideoDescriptor::ConstaintSet0
bool ConstaintSet0(void) const
Definition: mpegdescriptors.h:435
FreesatCallsignDescriptor
Freesat Channel Callsign descriptor.
Definition: dvbdescriptors.h:2711
ISO639LanguageDescriptor::LanguageString
QString LanguageString(void) const
Definition: mpegdescriptors.h:413
AVCVideoDescriptor::AVCStill
bool AVCStill(void) const
Definition: mpegdescriptors.h:445
DescriptorID::default_authority
@ default_authority
Definition: mpegdescriptors.h:126
AVCVideoDescriptor::ConstaintSet2
bool ConstaintSet2(void) const
Definition: mpegdescriptors.h:439
MPEGDescriptor::size
uint size(void) const
Definition: mpegdescriptors.h:323
DescriptorID::service_relocated
@ service_relocated
Definition: mpegdescriptors.h:151
DescriptorID::stream_identifier
@ stream_identifier
Definition: mpegdescriptors.h:91
PrivateDescriptorID::dish_event_name
@ dish_event_name
Definition: mpegdescriptors.h:215
MPEGDescriptor::DescriptorTagString
QString DescriptorTagString(void) const
Definition: mpegdescriptors.cpp:349
mythmiscutil.h
ISO639LanguageDescriptor::CanonicalLanguageKey
int CanonicalLanguageKey(void) const
Definition: mpegdescriptors.h:415
PrivateDescriptorID::premiere_content_order
@ premiere_content_order
Definition: mpegdescriptors.h:240
RegistrationDescriptor::InitializeDescriptionMap
static void InitializeDescriptionMap(void)
Definition: mpegdescriptors.cpp:720
NetworkChangeNotifyDescriptor
Definition: dvbdescriptors.h:1286
MPEGDescriptor::FindBestMatch
static const unsigned char * FindBestMatch(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
Definition: mpegdescriptors.cpp:121
PrivateDescriptorID::sky_lcn_table
@ sky_lcn_table
Definition: mpegdescriptors.h:228
StreamIdentifierDescriptor
This is used to label streams so the can be treated differently, for instance each stream may get it'...
Definition: dvbdescriptors.h:2201
DescriptorID::target_region_name
@ target_region_name
Definition: mpegdescriptors.h:150
ImageIconDescriptor
Definition: dvbdescriptors.h:1047
ServiceDescriptor
Definition: dvbdescriptors.h:2010
PrivateDescriptorID::freesat_region_table
@ freesat_region_table
Definition: mpegdescriptors.h:232
RevisionDetectionDescriptor
Definition: sctedescriptors.h:258
PrivateDataSpecifierID::FSAT
@ FSAT
Definition: mpegdescriptors.h:274
MPEGDescriptor::FindBestMatches
static desc_list_t FindBestMatches(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
Definition: mpegdescriptors.cpp:166
xml_indent
QString xml_indent(uint level)
Definition: mythmiscutil.cpp:1006
HEVCVideoDescriptor::toString
QString toString() const override
Definition: mpegdescriptors.cpp:830
AVCVideoDescriptor
ISO 13818-1:2000/Amd.3:2004 page 11.
Definition: mpegdescriptors.h:425
PrivateDescriptorID::nordig_content_protection
@ nordig_content_protection
Definition: mpegdescriptors.h:222
SatelliteDeliverySystemDescriptor
Definition: dvbdescriptors.h:796
PrivateDataSpecifierID::NORDIG
@ NORDIG
Definition: mpegdescriptors.h:269
DescriptorID::satellite_delivery_system
@ satellite_delivery_system
Definition: mpegdescriptors.h:75
FreesatRegionDescriptor
Freesat Region descriptor.
Definition: dvbdescriptors.h:2656
AVCVideoDescriptor::AVCCompatible
uint AVCCompatible(void) const
Definition: mpegdescriptors.h:441
RegistrationDescriptor::description_map_initialized
static bool description_map_initialized
Definition: mpegdescriptors.h:385
RegistrationDescriptor::GetDescription
static QString GetDescription(const QString &fmt)
Definition: mpegdescriptors.cpp:776
PrivateDescriptorID::freesat_callsign
@ freesat_callsign
Definition: mpegdescriptors.h:237
DescriptorID::registration
@ registration
Definition: mpegdescriptors.h:29
TargetRegionNameDescriptor
Definition: dvbdescriptors.h:1374
DescriptorID::target_region
@ target_region
Definition: mpegdescriptors.h:149
DescriptorID::cable_delivery_system
@ cable_delivery_system
Definition: mpegdescriptors.h:76
ConditionalAccessDescriptor::toString
QString toString() const override
Definition: mpegdescriptors.cpp:803
DefaultAuthorityDescriptor
Definition: dvbdescriptors.h:2887
AdaptationFieldDataDescriptor
Definition: dvbdescriptors.h:207
DescriptorID::component_name
@ component_name
Definition: mpegdescriptors.h:182
RegistrationDescriptor::description_map_lock
static QMutex description_map_lock
Definition: mpegdescriptors.h:384
AVCVideoDescriptor::toString
QString toString() const override
Definition: mpegdescriptors.cpp:816
MPEGDescriptor::Find
static const unsigned char * Find(const desc_list_t &parsed, uint desc_tag)
Definition: mpegdescriptors.cpp:78
PrivateDescriptorID::dish_event_vchip
@ dish_event_vchip
Definition: mpegdescriptors.h:218
EMPTY_STR_16
#define EMPTY_STR_16
Definition: mpegdescriptors.cpp:224
DescriptorID::adaptation_field_data
@ adaptation_field_data
Definition: mpegdescriptors.h:123
DescriptorID::scte_cue_identifier
@ scte_cue_identifier
Definition: mpegdescriptors.h:172
ComponentNameDescriptor
Definition: atscdescriptors.h:190
DescriptorID::bouquet_name
@ bouquet_name
Definition: mpegdescriptors.h:79
ServiceListDescriptor
Definition: dvbdescriptors.h:2078
PrivateDescriptorID::dish_event_rights
@ dish_event_rights
Definition: mpegdescriptors.h:213
RegistrationDescriptor::description_map
static QMap< QString, QString > description_map
Definition: mpegdescriptors.h:386
TeletextDescriptor
Definition: dvbdescriptors.h:2305
DescriptorID::c2_delivery_system
@ c2_delivery_system
Definition: mpegdescriptors.h:153
C2DeliverySystemDescriptor
Definition: dvbdescriptors.h:1442
PrivateDescriptorID::dish_event_description
@ dish_event_description
Definition: mpegdescriptors.h:216
AVCVideoDescriptor::LevelIDC
uint LevelIDC(void) const
Definition: mpegdescriptors.h:443
ConditionalAccessDescriptor::PID
uint PID(void) const
Definition: mpegdescriptors.h:396
DescriptorID::extended_channel_name
@ extended_channel_name
Definition: mpegdescriptors.h:179
dvbdescriptors.h
NetworkNameDescriptor
Definition: dvbdescriptors.h:69
DescriptorID::t2_delivery_system
@ t2_delivery_system
Definition: mpegdescriptors.h:144