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 (auto item : parsed)
82  {
83  if (item[0] == desc_tag)
84  return item;
85  }
86  return nullptr;
87 }
88 
90 {
92  for (auto item : parsed)
93  {
94  if (item[0] == desc_tag)
95  tmp.push_back(item);
96  }
97  return tmp;
98 }
99 
100 static uint maxPriority(const QMap<uint,uint> &langPrefs)
101 {
102  uint max_pri = 0;
103  for (uint pref : langPrefs)
104  max_pri = max(max_pri, pref);
105  return max_pri;
106 }
107 
108 const unsigned char *MPEGDescriptor::FindBestMatch(
109  const desc_list_t &parsed, uint desc_tag, QMap<uint,uint> &langPrefs)
110 {
111  uint match_idx = 0;
112  uint match_pri = UINT_MAX;
113  int unmatched_idx = -1;
114 
115  size_t i = (desc_tag == DescriptorID::short_event) ? 0 : parsed.size();
116  for (; i < parsed.size(); i++)
117  {
118  if (DescriptorID::short_event == parsed[i][0])
119  {
120  ShortEventDescriptor sed(parsed[i]);
121  if (!sed.IsValid())
122  continue;
123  QMap<uint,uint>::const_iterator it =
124  langPrefs.find(sed.CanonicalLanguageKey());
125 
126  if ((it != langPrefs.end()) && (*it < match_pri))
127  {
128  match_idx = i;
129  match_pri = *it;
130  }
131 
132  if (unmatched_idx < 0)
133  unmatched_idx = i;
134  }
135  }
136 
137  if (match_pri != UINT_MAX)
138  return parsed[match_idx];
139 
140  if ((desc_tag == DescriptorID::short_event) && (unmatched_idx >= 0))
141  {
142  ShortEventDescriptor sed(parsed[unmatched_idx]);
143  if (sed.IsValid())
144  {
145  langPrefs[sed.CanonicalLanguageKey()] = maxPriority(langPrefs) + 1;
146  return parsed[unmatched_idx];
147  }
148  }
149 
150  return nullptr;
151 }
152 
154  const desc_list_t &parsed, uint desc_tag, QMap<uint,uint> &langPrefs)
155 {
156  uint match_pri = UINT_MAX;
157  int match_key = 0;
158  int unmatched_idx = -1;
159 
160  size_t i = (desc_tag == DescriptorID::extended_event) ? 0 : parsed.size();
161  for (; i < parsed.size(); i++)
162  {
163  if (DescriptorID::extended_event == parsed[i][0])
164  {
165  ExtendedEventDescriptor eed(parsed[i]);
166  if (!eed.IsValid())
167  continue;
168  QMap<uint,uint>::const_iterator it =
169  langPrefs.find(eed.CanonicalLanguageKey());
170 
171  if ((it != langPrefs.end()) && (*it < match_pri))
172  {
173  match_key = eed.LanguageKey();
174  match_pri = *it;
175  }
176 
177  if (unmatched_idx < 0)
178  unmatched_idx = i;
179  }
180  }
181 
182  if ((desc_tag == DescriptorID::extended_event) &&
183  (match_key == 0) && (unmatched_idx >= 0))
184  {
185  ExtendedEventDescriptor eed(parsed[unmatched_idx]);
186  if (eed.IsValid())
187  {
188  langPrefs[eed.CanonicalLanguageKey()] = maxPriority(langPrefs) + 1;
189  match_key = eed.LanguageKey();
190  }
191  }
192 
194  if (match_pri == UINT_MAX)
195  return tmp;
196 
197  for (auto j : parsed)
198  {
199  if ((DescriptorID::extended_event == desc_tag) &&
201  {
203  if (eed.IsValid() && (eed.LanguageKey() == match_key))
204  tmp.push_back(j);
205  }
206  }
207 
208  return tmp;
209 }
210 
211 #define EMPTY_STR_16 "","","","", "","","","", "","","","", "","","","",
212 
213 const char *descriptor_tag_strings[256] =
214 {
215  /* 0x00 */ "", /* 0x01 */ "",
216  /* 0x02 */ "Video", /* 0x03 */ "Audio",
217  /* 0x04 */ "Hierarchy", /* 0x05 */ "Registration",
218  /* 0x06 */ "Data Stream Alignment", /* 0x07 */ "Target Background Grid",
219  /* 0x08 */ "Video Window", /* 0x09 */ "Conditional Access",
220  /* 0x0A */ "ISO-639 Language", /* 0x0B */ "System Clock",
221  /* 0x0C */ "Multiplex Buffer Utilization", /* 0x0D */ "Copyright",
222  /* 0x0E */ "Maximum Bitrate", /* 0x0F */ "Private Data Indicator",
223 
224  /* 0x10 */ "Smooting Buffer", /* 0x11 */ "STD",
225  /* 0x12 */ "IBP", /* 0x13 */ "DSM-CC Carousel Identifier",
226  /* 0x14 */ "DSM-CC Association Tag",
227  /* 0x15 */ "DSM-CC Deferred Association Tag",
228  /* 0x16 */ "Reserved(0x16)", /* 0x17 */ "DSM-CC NPT Reference",
229  /* 0x18 */ "DSM-CC NPT Endpoint", /* 0x19 */ "DSM-CC Stream Mode",
230  /* 0x1A */ "DSM-CC Stream Event", /* 0x1B */ "MPEG-4 Video",
231  /* 0x1C */ "MPEG-4 Audio", /* 0x1D */ "IOD",
232  /* 0x1E */ "SL", /* 0x1F */ "FMC",
233 
234  /* 0x20 */ "External ES ID", /* 0x21 */ "Multimpex Code",
235  /* 0x22 */ "FMX buffer Size", /* 0x23 */ "Multiplex Buffer",
236  /* 0x24 */ "Content Labeling", /* 0x25 */ "Metadata Pointer",
237  /* 0x26 */ "Metadata", /* 0x27 */ "Metadata Std",
238  /* 0x28 */ "AVC Video", /* 0x29 */ "IPMP DRM",
239  /* 0x2A */ "AVC Timing & HRD", /* 0x2B */ "AAC Audio",
240  /* 0x2C */ "Flex Mux Timing", /* 0x2D */ "",
241  /* 0x2E */ "", /* 0x2F */ "",
242 
243  /* 0x30-0x3F */ EMPTY_STR_16
244 
245  /* 0x40 */ "Network Name", /* 0x41 */ "Service List",
246  /* 0x42 */ "DVB Stuffing", /* 0x43 */ "Satellite Delivery System",
247  /* 0x44 */ "Cable Delivery System", /* 0x45 */ "VBI Data",
248  /* 0x46 */ "VBI Teletext", /* 0x47 */ "Bouquet Name",
249  /* 0x48 */ "Service", /* 0x49 */ "Country Availability",
250  /* 0x4A */ "Linkage", /* 0x4B */ "NVOD Reference",
251  /* 0x4C */ "DVB Time-shifted Service",/* 0x4D */ "Short Event",
252  /* 0x4E */ "Extended Event", /* 0x4F */ "Time-shifted Event",
253 
254  /* 0x50 */ "Component", /* 0x51 */ "Mosaic",
255  /* 0x52 */ "Stream Identifier",
256  /* 0x53 */ "Conditional Access Identifier",
257  /* 0x54 */ "Content", /* 0x55 */ "Parental Rating",
258  /* 0x56 */ "Teletext", /* 0x57 */ "Telephone",
259  /* 0x58 */ "Local Time Offset", /* 0x59 */ "Subtitling",
260  /* 0x5A */ "Terrestrial Delivery System",
261  /* 0x5B */ "Multilingual Network Name",
262  /* 0x5C */ "Multilingual Bouquet Name",
263  /* 0x5D */ "Multilingual Service Name",
264  /* 0x5E */ "Multilingual Component",
265  /* 0x5F */ "Private Data Specifier",
266 
267  /* 0x60 */ "Service Move", /* 0x61 */ "Short Smoothing Buffer",
268  /* 0x62 */ "Frequency List", /* 0x63 */ "Partial Transport Stream",
269  /* 0x64 */ "Data Broadcast", /* 0x65 */ "Scrambling",
270  /* 0x66 */ "Data Broadcast ID", /* 0x67 */ "Transport Stream",
271  /* 0x68 */ "DSNG", /* 0x69 */ "PDC",
272  /* 0x6A */ "AC-3", /* 0x6B */ "Ancillary Data",
273  /* 0x6C */ "Cell List", /* 0x6D */ "Cell Frequency Link",
274  /* 0x6E */ "Announcement Support", /* 0x6F */ "Application Signalling",
275 
276  /* 0x70 */ "Adaptation Field Data", /* 0x71 */ "Service Identifier",
277  /* 0x72 */ "Service Availability", /* 0x73 */ "Default Authority",
278  /* 0x74 */ "Related Content", /* 0x75 */ "TVA ID",
279  /* 0x76 */ "DVB Content Identifier",/* 0x77 */ "Time Slice FEC Identifier",
280  /* 0x78 */ "ECM Repetition Rate", /* 0x79 */ "DVB-S2 Delivery Identifier",
281  /* 0x7A */ "E-AC-3", /* 0x7B */ "DTS",
282  /* 0x7C */ "AAC", /* 0x7D */ "",
283  /* 0x7E */ "", /* 0x7F */ "",
284 
285  /* 0x80 */ "ATSC Stuffing", /* 0x81 */ "AC-3 Audio",
286  /* 0x82 */ "SCTE Frame Rate", /* 0x83 */ "SCTE Extended Video",
287  /* 0x84 */ "SCTE Component Name", /* 0x85 */ "ATSC Program Identifier",
288  /* 0x86 */ "Caption Service", /* 0x87 */ "Content Advisory",
289  /* 0x88 */ "ATSC CA Descriptor", /* 0x89 */ "ATSC Descriptor Tag",
290  /* 0x8A */ "SCTE CUE Identifier", /* 0x8B */ "",
291  /* 0x8C */ "TimeStamp", /* 0x8D */ "",
292  /* 0x8E */ "", /* 0x8F */ "",
293 
294  /* 0x90 */ "SCTE Frequency Spec", /* 0x91 */ "SCTE Modulation Params",
295  /* 0x92 */ "SCTE TSID", /* 0x93 */ "SCTE Revision Detection",
296  /* 0x94 */ "SCTE Two part channel", /* 0x95 */ "SCTE Channel Properties",
297  /* 0x96 */ "SCTE Daylight Savings", /* 0x97 */ "SCTE AFD",
298  /* 0x98 */ "", /* 0x99 */ "",
299  /* 0x9A */ "", /* 0x9B */ "",
300  /* 0x9C */ "", /* 0x9D */ "",
301  /* 0x9E */ "", /* 0x9F */ "",
302 
303  /* 0xA0 */ "Extended Channel Name", /* 0xA1 */ "Service Location",
304  /* 0xA2 */ "ATSC Time-shifted Service",/*0xA3*/"Component Name",
305  /* 0xA4 */ "ATSC Data Service", /* 0xA5 */ "ATSC PID Count",
306  /* 0xA6 */ "ATSC Download",
307  /* 0xA7 */ "ATSC Multiprotocol Encapsulation",
308  /* 0xA8 */ "DCC Departing Request", /* 0xA9 */ "DCC Arriving Request",
309  /* 0xAA */ "ATSC Restrictions Control",/*0xAB*/"ATSC Genre",
310  /* 0xAC */ "SCTE MAC Address List", /* 0xAD */ "ATSC Private Information",
311  /* 0xAE */ "ATSC Compatibility Wrap",/* 0xAF */"ATSC Broadcaster Policy",
312 
313  /* 0xB0 */ "", /* 0xB1 */ "",
314  /* 0xB2 */ "", /* 0xB3 */ "",
315  /* 0xB4 */ "", /* 0xB5 */ "",
316  /* 0xB6 */ "ATSC Content ID", /* 0xB7 */ "",
317  /* 0xB8 */ "", /* 0xB9 */ "",
318  /* 0xBA */ "", /* 0xBB */ "",
319  /* 0xBC */ "", /* 0xBD */ "",
320  /* 0xBE */ "", /* 0xBF */ "",
321 
322  /* 0xC0-0xCF */ EMPTY_STR_16
323  /* 0xD0-0xDF */ EMPTY_STR_16
324  /* 0xE0-0xEF */ EMPTY_STR_16
325  /* 0xF0-0xFF */ EMPTY_STR_16
326 };
327 
328 static void comma_list_append(QString &str, const QString& extra)
329 {
330  if (str.isEmpty())
331  str = extra;
332  else
333  str = str + ", " + extra;
334 }
335 
337 {
338  QString str = descriptor_tag_strings[DescriptorTag()];
339 
340  switch (DescriptorTag())
341  {
343  comma_list_append(str, "Possibly DVB Logical Channel Descriptor");
344  break;
346  comma_list_append(str, "Possibly Dishnet Rights");
347  break;
349  comma_list_append(str, "Possibly Dishnet MPAA");
350  break;
352  comma_list_append(str, "Possibly Dishnet EIT Name");
353  break;
355  comma_list_append(str, "Possibly Dishnet EIT Description");
356  break;
358  comma_list_append(str, "Possibly Dishnet Properties");
359  break;
361  comma_list_append(str, "Possibly Dishnet V-Chip");
362  break;
363  case PrivateDescriptorID::dish_event_tags: /* 0x96 */
364  comma_list_append(str, "Possibly Dishnet Tag");
365  break;
367  comma_list_append(str, "Possibly DVB Sky/OpenTV Channel List");
368  break;
370  comma_list_append(str, "Possibly Premiere DE Content Order");
371  break;
373  comma_list_append(str, "Possibly Premiere DE Parental Information");
374  break;
376  comma_list_append(str, "Possibly Premiere DE Content Transmission");
377  break;
378  }
379 
380  if (str.isEmpty())
381  str = QString("Unknown(%1)").arg(DescriptorTag());
382 
383  return str;
384 }
385 
386 #define SET_STRING(DESC_NAME) do { \
387  if (IsValid()) { DESC_NAME d(m_data, DescriptorLength()+2); \
388  if (d.IsValid()) str = d.toString(); } } while (false)
389 
390 QString MPEGDescriptor::descrDump(const QString &name) const
391 {
392  QString str;
393  str = QString("%1 Descriptor (0x%2) length(%3). Dumping\n")
394  .arg(name)
395  .arg(DescriptorTag(),2,16,QChar('0'))
396  .arg(DescriptorLength());
397  str.append(hexdump());
398  return str;
399 }
400 
401 QString MPEGDescriptor::toString(void) const
402 {
403  return toStringPD(0);
404 }
405 
406 QString MPEGDescriptor::toStringPD(uint priv_dsid) const
407 {
408  QString str;
409 
410  if (!IsValid())
411  {
412  str = "Invalid Descriptor";
413  }
415  {
417  }
419  {
421  }
423  {
425  }
427  {
429  }
431  {
433  }
435  {
437  }
439  {
441  }
443  {
445  }
447  {
449  }
451  {
453  }
454  else if (DescriptorID::service == DescriptorTag())
455  {
457  }
459  {
461  }
462  //else if (DescriptorID::linkage == DescriptorTag())
463  //{
464  // SET_STRING(LinkageDescriptor);
465  //}
467  {
469  }
471  {
473  }
475  {
477  }
479  {
481  }
482  //else if (DescriptorID::ancillary_data == DescriptorTag())
483  //{
484  // SET_STRING(AncillaryDataDescriptor);
485  //}
487  {
489  }
491  {
493  }
494  //
495  // User Defined DVB descriptors, range 0x80-0xFE
496  else if (priv_dsid == PrivateDataSpecifierID::BSB1 &&
498  {
500  }
501  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
503  {
505  }
506  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
508  {
510  }
511  else if (priv_dsid == PrivateDataSpecifierID::FSAT &&
513  {
515  }
516  else if (priv_dsid == PrivateDataSpecifierID::CASEMA &&
518  {
519  descrDump("Video on Demand");
520  }
521  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
522  priv_dsid == PrivateDataSpecifierID::NORDIG ||
523  priv_dsid == PrivateDataSpecifierID::ITC ) &&
525  {
527  }
528  else if ((priv_dsid == PrivateDataSpecifierID::EACEM ||
529  priv_dsid == PrivateDataSpecifierID::NORDIG ||
530  priv_dsid == PrivateDataSpecifierID::ITC ) &&
532  {
534  }
535  //
536  // POSSIBLY UNSAFE ! -- begin
537  // ATSC/SCTE descriptors, range 0x80-0xFE
539  {
541  }
543  {
545  }
547  {
549  }
551  {
553  }
555  {
557  }
558  else if (priv_dsid == 0 &&
560  {
562  }
563  // POSSIBLY UNSAFE ! -- end
564  else
565  {
566  str = QString("%1 Descriptor (0x%2) length(%3). Dumping\n")
567  .arg(DescriptorTagString())
568  .arg(DescriptorTag(),2,16,QChar('0'))
569  .arg(DescriptorLength());
570  //for (uint i=0; i<DescriptorLength(); i++)
571  // str.append(QString(" 0x%1").arg(int(_data[i+2]), 0, 16));
572  str.append(hexdump());
573  }
574  return str;
575 }
576 
579 QString MPEGDescriptor::toStringXML(uint level) const
580 {
581  QString indent_0 = xml_indent(level);
582  QString indent_1 = xml_indent(level+1);
583  QString str;
584 
585  str += indent_0 + "<Descriptor>\n";
586  str += indent_1 + QString("<Tag>0x%1</Tag>\n")
587  .arg(DescriptorTag(),2,16,QChar('0'));
588  str += indent_1 + QString("<Description>%1</Description>\n")
589  .arg(DescriptorTagString(),0,16);
590 
591  str += indent_1 + "<Data>";
592  for (uint i = 0; i < DescriptorLength(); i++)
593  {
594  if (((i%8) == 0) && i)
595  str += "\n" + indent_1 + " ";
596  str += QString("0x%1 ").arg(m_data[i+2],2,16,QChar('0'));
597  }
598 
599  str += "\n" + indent_1 + "</Data>\n";
600  str += indent_1 + "<Decoded>" + toString().toHtmlEscaped() + "</Decoded>\n";
601  str += indent_0 + "</Descriptor>";
602 
603  return str;
604 }
605 
606 // Dump the descriptor in the same format as hexdump -C
607 QString MPEGDescriptor::hexdump(void) const
608 {
609  uint i = 0;
610  QString str;
611  QString hex;
612  QString prt;
613  for (i=0; i<DescriptorLength(); i++)
614  {
615  uint ch = m_data[i+2];
616  hex.append(QString(" %1").arg(ch, 2, 16, QChar('0')));
617  prt.append(QString("%1").arg(isprint(ch) ? QChar(ch) : '.'));
618  if (((i+1) % 8) == 0)
619  hex.append(" ");
620  if (((i+1) % 16) == 0)
621  {
622  str.append(QString(" %1 %2 |%3|\n")
623  .arg(i - (i % 16),3,16,QChar('0'))
624  .arg(hex).arg(prt));
625  hex.clear();
626  prt.clear();
627  }
628  }
629  str.append(QString(" %1 %2 |%3|")
630  .arg(i - (i % 16),3,16,QChar('0'))
631  .arg(hex,-50,' ').arg(prt));
632  return str;
633 }
634 
636 {
637  QMutexLocker locker(&description_map_lock);
639  return;
640 
641  description_map["AC-3"] = "ATSC audio stream A/52";
642  description_map["AVSV"] = "China A/V Working Group";
643  description_map["BDC0"] = "Broadcast Data Corporation Software Data Service";
644  description_map["BSSD"] = "SMPTE 302M-1998 Audio data as specified in (AES3)";
645  description_map["CAPO"] = "SMPTE 315M-1999 Camera Positioning Information";
646  description_map["CUEI"] = "SCTE 35 2003, Cable Digital Program Insertion Cueing Message";
647  description_map["DDED"] = "LGEUS Digital Delivery with encryption and decryption";
648  description_map["DISH"] = "EchoStar MPEG streams";
649  description_map["DRA1"] = "Chinese EIS SJ/T11368-2006 DRA digital audio";
650  description_map["DTS1"] = "DTS Frame size of 512 bytes";
651  description_map["DTS2"] = "DTS Frame size of 1024 bytes";
652  description_map["DTS3"] = "DTS Frame size of 2048";
653  description_map["DVDF"] = "DVD compatible MPEG2-TS";
654  description_map["ETV1"] = "CableLabs ETV info is present";
655  description_map["GA94"] = "ATSC program ID A/53";
656  description_map["GWKS"] = "GuideWorks EPG info";
657  description_map["HDMV"] = "Blu-Ray A/V for read-only media (H.264 TS)";
658  description_map["HDMX"] = "Matsushita-TS";
659  description_map["KLVA"] = "SMPTE RP 217-2001 MXF KLV packets present";
660  description_map["LU-A"] = "SMPTE RDD-11 HDSDI HD serial/video data";
661  description_map["MTRM"] = "D-VHS compatible MPEG2-TS";
662  description_map["NMR1"] = "Nielsen content identifier";
663  description_map["PAUX"] = "Philips ES containing low-speed data";
664  description_map["PMSF"] = "MPEG-TS stream modified by STB";
665  description_map["PRMC"] = "Philips ES containing remote control data";
666  description_map["SCTE"] = "SCTE 54 2003 Digital Video Service Multiplex and TS for Cable";
667  description_map["SEN1"] = "ATSC Private Information identifies source of stream";
668  description_map["SESF"] = "Blu-Ray A/V for ReWritable media (H.264 TS)";
669  description_map["SPLC"] = "SMPTE Proposed 312M Splice Point compatible TS";
670  description_map["SVMD"] = "SMPTE Proposed Video Metatdata Dictionary for MPEG2-TS";
671  description_map["SZMI"] = "ATSC Private Info from Building B";
672  description_map["TRIV"] = "ATSC Private Info from Triveni Digital";
673  description_map["TSBV"] = "Toshiba self-encoded H.264 TS";
674  description_map["TSHV"] = "Sony self-encoded MPEG-TS and private data";
675  description_map["TSMV"] = "Sony self-encoded MPEG-TS and private data";
676  description_map["TVG1"] = "TV Guide EPG Data";
677  description_map["TVG2"] = "TV Guide EPG Data";
678  description_map["TVG3"] = "TV Guide EPG Data";
679  description_map["ULE1"] = "IETF RFC4326 compatible MPEG2-TS";
680  description_map["VC-1"] = "SMPTE Draft RP 227 VC-1 Bitstream Transport Encodings";
681 
682  for (uint i = 0; i <= 99; i++)
683  {
684  description_map[QString("US%1").arg(i, 2, QLatin1Char('0'))] =
685  "NIMA, Unspecified military application";
686  }
687 
689 }
690 
691 QString RegistrationDescriptor::GetDescription(const QString &fmt)
692 {
694 
695  QString ret;
696  {
697  QMutexLocker locker(&description_map_lock);
698  QMap<QString,QString>::const_iterator it = description_map.find(fmt);
699  if (it != description_map.end())
700  ret = *it;
701  }
702 
703  return ret;
704 }
705 
707 {
708  QString fmt = FormatIdentifierString();
709  QString msg = QString("Registration Descriptor: '%1' ").arg(fmt);
710 
711  QString msg2 = GetDescription(fmt);
712  if (msg2.isEmpty())
713  msg2 = "Unknown, see http://www.smpte-ra.org/mpegreg/mpegreg.html";
714 
715  return msg + msg2;
716 }
717 
719 {
720  return QString("Conditional Access: sid(0x%1) pid(0x%2) data_size(%3)")
721  .arg(SystemID(),0,16).arg(PID(),0,16).arg(DataSize());
722 }
723 
725 {
726  return QString("ISO-639 Language: code(%1) canonical(%2) eng(%3)")
729 }
730 
732 {
733  return QString("AVC Video: IDC prof(%1) IDC level(%2) sets(%3%4%5) "
734  "compat(%6) still(%7) 24hr(%8) FramePacking(%9)")
735  .arg(ProfileIDC()).arg(LevelIDC())
736  .arg(ConstaintSet0()).arg(ConstaintSet1()).arg(ConstaintSet2())
737  .arg(AVCCompatible()).arg(AVCStill()).arg(AVC24HourPicture())
739 }
740 
742 {
743  return QString("HEVC Video: ");
744 }
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)
QString DescriptorTagString(void) const
static guint32 * tmp
Definition: goom_core.c:35
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
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
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)