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 char *descriptor_tag_strings[256] =
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 = 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::BSB1 &&
572  {
574  }
575  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
577  {
579  }
580  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
582  {
584  }
585  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
587  {
589  }
590  else if (priv_dsid == PrivateDataSpecifierID::CASEMA &&
592  {
593  descrDump("Video on Demand");
594  }
595  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
596  priv_dsid == PrivateDataSpecifierID::NORDIG ||
597  priv_dsid == PrivateDataSpecifierID::ITC ) &&
599  {
601  }
602  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
603  priv_dsid == PrivateDataSpecifierID::NORDIG ||
604  priv_dsid == PrivateDataSpecifierID::ITC ) &&
606  {
608  }
609  //
610  // POSSIBLY UNSAFE ! -- begin
611  // ATSC/SCTE descriptors, range 0x80-0xFE
613  {
615  }
617  {
619  }
621  {
623  }
625  {
627  }
629  {
631  }
632  else if (priv_dsid == 0 &&
634  {
636  }
637  // POSSIBLY UNSAFE ! -- end
638  else
639  {
641  }
642  return str;
643 }
644 
647 QString MPEGDescriptor::toStringXML(uint level) const
648 {
649  QString indent_0 = xml_indent(level);
650  QString indent_1 = xml_indent(level+1);
651  QString str;
652 
653  str += indent_0 + "<Descriptor>\n";
654  str += indent_1 + QString("<Tag>0x%1</Tag>\n")
655  .arg(DescriptorTag(),2,16,QChar('0'));
656  str += indent_1 + QString("<Description>%1</Description>\n")
657  .arg(DescriptorTagString(),0,16);
658 
659  str += indent_1 + "<Data>";
660  for (uint i = 0; i < DescriptorLength(); i++)
661  {
662  if (((i%8) == 0) && i)
663  str += "\n" + indent_1 + " ";
664  str += QString("0x%1 ").arg(m_data[i+2],2,16,QChar('0'));
665  }
666 
667  str += "\n" + indent_1 + "</Data>\n";
668  str += indent_1 + "<Decoded>" + toString().toHtmlEscaped() + "</Decoded>\n";
669  str += indent_0 + "</Descriptor>";
670 
671  return str;
672 }
673 
674 // Dump the descriptor in the same format as hexdump -C
675 QString MPEGDescriptor::hexdump(void) const
676 {
677  uint i = 0;
678  QString str;
679  QString hex;
680  QString prt;
681  for (i=0; i<DescriptorLength(); i++)
682  {
683  uint ch = m_data[i+2];
684  hex.append(QString(" %1").arg(ch, 2, 16, QChar('0')));
685  prt.append(QString("%1").arg(isprint(ch) ? QChar(ch) : '.'));
686  if (((i+1) % 8) == 0)
687  hex.append(" ");
688  if (((i+1) % 16) == 0)
689  {
690  str.append(QString(" %1 %2 |%3|")
691  .arg(i - (i % 16),3,16,QChar('0'))
692  .arg(hex).arg(prt));
693  hex.clear();
694  prt.clear();
695  if (i < (DescriptorLength() - 1))
696  {
697  str.append("\n");
698  }
699  }
700  }
701  if (!hex.isEmpty())
702  {
703  str.append(QString(" %1 %2 |%3|")
704  .arg(i - (i % 16),3,16,QChar('0'))
705  .arg(hex,-50,' ').arg(prt));
706  }
707  return str;
708 }
709 
711 {
712  QMutexLocker locker(&description_map_lock);
714  return;
715 
716  description_map["AC-3"] = "ATSC audio stream A/52";
717  description_map["AVSV"] = "China A/V Working Group";
718  description_map["BDC0"] = "Broadcast Data Corporation Software Data Service";
719  description_map["BSSD"] = "SMPTE 302M-1998 Audio data as specified in (AES3)";
720  description_map["CAPO"] = "SMPTE 315M-1999 Camera Positioning Information";
721  description_map["CUEI"] = "SCTE 35 2003, Cable Digital Program Insertion Cueing Message";
722  description_map["DDED"] = "LGEUS Digital Delivery with encryption and decryption";
723  description_map["DISH"] = "EchoStar MPEG streams";
724  description_map["DRA1"] = "Chinese EIS SJ/T11368-2006 DRA digital audio";
725  description_map["DTS1"] = "DTS Frame size of 512 bytes";
726  description_map["DTS2"] = "DTS Frame size of 1024 bytes";
727  description_map["DTS3"] = "DTS Frame size of 2048";
728  description_map["DVDF"] = "DVD compatible MPEG2-TS";
729  description_map["ETV1"] = "CableLabs ETV info is present";
730  description_map["GA94"] = "ATSC program ID A/53";
731  description_map["GWKS"] = "GuideWorks EPG info";
732  description_map["HDMV"] = "Blu-Ray A/V for read-only media (H.264 TS)";
733  description_map["HDMX"] = "Matsushita-TS";
734  description_map["KLVA"] = "SMPTE RP 217-2001 MXF KLV packets present";
735  description_map["LU-A"] = "SMPTE RDD-11 HDSDI HD serial/video data";
736  description_map["MTRM"] = "D-VHS compatible MPEG2-TS";
737  description_map["NMR1"] = "Nielsen content identifier";
738  description_map["PAUX"] = "Philips ES containing low-speed data";
739  description_map["PMSF"] = "MPEG-TS stream modified by STB";
740  description_map["PRMC"] = "Philips ES containing remote control data";
741  description_map["SCTE"] = "SCTE 54 2003 Digital Video Service Multiplex and TS for Cable";
742  description_map["SEN1"] = "ATSC Private Information identifies source of stream";
743  description_map["SESF"] = "Blu-Ray A/V for ReWritable media (H.264 TS)";
744  description_map["SPLC"] = "SMPTE Proposed 312M Splice Point compatible TS";
745  description_map["SVMD"] = "SMPTE Proposed Video Metatdata Dictionary for MPEG2-TS";
746  description_map["SZMI"] = "ATSC Private Info from Building B";
747  description_map["TRIV"] = "ATSC Private Info from Triveni Digital";
748  description_map["TSBV"] = "Toshiba self-encoded H.264 TS";
749  description_map["TSHV"] = "Sony self-encoded MPEG-TS and private data";
750  description_map["TSMV"] = "Sony self-encoded MPEG-TS and private data";
751  description_map["TVG1"] = "TV Guide EPG Data";
752  description_map["TVG2"] = "TV Guide EPG Data";
753  description_map["TVG3"] = "TV Guide EPG Data";
754  description_map["ULE1"] = "IETF RFC4326 compatible MPEG2-TS";
755  description_map["VC-1"] = "SMPTE Draft RP 227 VC-1 Bitstream Transport Encodings";
756 
757  for (uint i = 0; i <= 99; i++)
758  {
759  description_map[QString("US%1").arg(i, 2, QLatin1Char('0'))] =
760  "NIMA, Unspecified military application";
761  }
762 
764 }
765 
766 QString RegistrationDescriptor::GetDescription(const QString &fmt)
767 {
769 
770  QString ret;
771  {
772  QMutexLocker locker(&description_map_lock);
773  QMap<QString,QString>::const_iterator it = description_map.find(fmt);
774  if (it != description_map.end())
775  ret = *it;
776  }
777 
778  return ret;
779 }
780 
782 {
783  QString fmt = FormatIdentifierString();
784  QString msg = QString("Registration Descriptor: '%1' ").arg(fmt);
785 
786  QString msg2 = GetDescription(fmt);
787  if (msg2.isEmpty())
788  msg2 = "Unknown, see http://www.smpte-ra.org/mpegreg/mpegreg.html";
789 
790  return msg + msg2;
791 }
792 
794 {
795  return QString("Conditional Access: sid(0x%1) pid(0x%2) data_size(%3)")
796  .arg(SystemID(),0,16).arg(PID(),0,16).arg(DataSize());
797 }
798 
800 {
801  return QString("ISO-639 Language: code(%1) canonical(%2) eng(%3)")
804 }
805 
807 {
808  return QString("AVC Video: IDC prof(%1) IDC level(%2) sets(%3%4%5) "
809  "compat(%6) still(%7) 24hr(%8) FramePacking(%9)")
810  .arg(ProfileIDC()).arg(LevelIDC())
811  .arg(static_cast<int>(ConstaintSet0()))
812  .arg(static_cast<int>(ConstaintSet1()))
813  .arg(static_cast<int>(ConstaintSet2()))
814  .arg(AVCCompatible())
815  .arg(static_cast<int>(AVCStill()))
816  .arg(static_cast<int>(AVC24HourPicture()))
817  .arg(static_cast<int>(FramePackingSEINotPresentFlag()));
818 }
819 
821 {
822  return QString("HEVC Video: ");
823 }
bool FramePackingSEINotPresentFlag(void) const
DVB HD Simulcast Logical Channel Descriptor.
bool ConstaintSet0(void) const
This descriptor is used to identify streams with SpliceInformationTable data in them.
QString toString() const override
Freesat Region descriptor.
int LanguageKey(void) const
QString CanonicalLanguageString(void) const
uint LevelIDC(void) const
int CanonicalLanguageKey(void) const
This is used to label streams so the can be treated differently, for instance each stream may get it'...
QString iso639_key_toName(int iso639_2)
Converts a canonical key to language name in English.
Definition: iso639.cpp:110
bool AVCStill(void) const
uint DescriptorTag(void) const
DVB Logical Channel Descriptor.
virtual QString toString(void) const
static void InitializeDescriptionMap(void)
static const unsigned char * FindBestMatch(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
static bool description_map_initialized
static QString GetDescription(const QString &fmt)
static guint32 * tmp
Definition: goom_core.cpp:30
QString DescriptorTagString(void) const
Freesat Channel Callsign descriptor.
uint size(void) const
vector< const unsigned char * > desc_list_t
static desc_list_t ParseAndExclude(const unsigned char *data, uint len, int excluded_descid)
static uint maxPriority(const QMap< uint, uint > &langPrefs)
uint AVCCompatible(void) const
const unsigned char * m_data
virtual QString toStringPD(uint priv_dsid) const
QString descrDump(const QString &name) const
ISO 13818-1:2000/Amd.3:2004 page 11.
Freesat Logical Channel Number descriptor.
static QMutex description_map_lock
static const unsigned char * FindExtension(const desc_list_t &parsed, uint desc_tag)
unsigned int uint
Definition: compat.h:140
static QMap< QString, QString > description_map
static void comma_list_append(QString &str, const QString &extra)
static const unsigned char * Find(const desc_list_t &parsed, uint desc_tag)
uint DescriptorLength(void) const
int CanonicalLanguageKey(void) const
ISO 13818-1:2013/FDAM 3 (E) page 7.
QString FormatIdentifierString(void) const
bool AVC24HourPicture(void) const
QString toString() const override
uint DescriptorTagExtension(void) const
Provides the long channel name for the virtual channel containing this descriptor.
bool ConstaintSet1(void) const
Sky Logical Channel Number descriptor.
QString toString() const override
QString toString() const override
bool IsValid(void) const
bool ConstaintSet2(void) const
QString hexdump(void) const
static desc_list_t FindBestMatches(const desc_list_t &parsed, uint desc_tag, QMap< uint, uint > &langPref)
QString LanguageString(void) const
virtual QString toStringXML(uint indent_level) const
Returns XML representation of string the TS Reader XML format.
const char * descriptor_tag_strings[256]
#define EMPTY_STR_16
static desc_list_t FindAll(const desc_list_t &parsed, uint desc_tag)
int CanonicalLanguageKey(void) const
QString toString() const override
#define SET_STRING(DESC_NAME)
static desc_list_t Parse(const unsigned char *data, uint len)
static desc_list_t ParseOnlyInclude(const unsigned char *data, uint len, int excluded_descid)
uint ProfileIDC(void) const
QString xml_indent(uint level)