MythTV  master
dvbdescriptors.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // Copyright (c) 2003-2004, Daniel Thor Kristjansson
3 #ifndef DVB_DESCRIPTORS_H
4 #define DVB_DESCRIPTORS_H
5 
6 #include <cassert>
7 
8 #include <QMutex>
9 #include <QString>
10 
11 #include "mythtvexp.h" // MTV_PUBLIC - Symbol Visibility
12 #include "mpegdescriptors.h"
13 #include "programinfo.h" // for subtitle types and audio and video properties
14 
15 /*
16 // needed for scanning
17  conditional_access = 0x09, // maybe
18  satellite_delivery_system = 0x43,*
19  cable_delivery_system = 0x44,*
20  service = 0x48,*
21  terrestrial_delivery_system = 0x5A,*
22  frequency_list = 0x62,*
23 
24 // needed for captions
25  teletext = 0x56,
26  subtitling = 0x59,
27 
28 // needed for sound
29  registration = 0x05,
30  AC3 = 0x6A,
31 
32 // needed for eit
33  short_event = 0x4D,
34  extended_event = 0x4E,
35  content = 0x54,
36 */
37 
38 static QString coderate_inner(uint coderate);
39 
40 MTV_PUBLIC QString dvb_decode_text(const unsigned char *src, uint length,
41  const unsigned char *encoding_override,
42  uint encoding_override_length);
43 
44 inline QString dvb_decode_text(const unsigned char *src, uint length)
45 {
46  return dvb_decode_text(src, length, nullptr, 0);
47 }
48 
49 QString dvb_decode_short_name(const unsigned char *src, uint raw_length);
50 
51 #define byteBCDH2int(i) ((i) >> 4)
52 #define byteBCDL2int(i) ((i) & 0x0f)
53 #define byteBCD2int(i) (byteBCDH2int(i) * 10 + byteBCDL2int(i))
54 #define byte2BCD2int(i, j) \
55  (byteBCDH2int(i) * 1000 + byteBCDL2int(i) * 100 + \
56  byteBCDH2int(j) * 10 + byteBCDL2int(j))
57 #define byte3BCD2int(i, j, k) \
58  (byteBCDH2int(i) * 100000 + byteBCDL2int(i) * 10000 + \
59  byteBCDH2int(j) * 1000 + byteBCDL2int(j) * 100 + \
60  byteBCDH2int(k) * 10 + byteBCDL2int(k))
61 #define byte4BCD2int(i, j, k, l) \
62  (byteBCDH2int(i) * 10000000LL + byteBCDL2int(i) * 1000000 + \
63  byteBCDH2int(j) * 100000 + byteBCDL2int(j) * 10000 + \
64  byteBCDH2int(k) * 1000 + byteBCDL2int(k) * 100 + \
65  byteBCDH2int(l) * 10 + byteBCDL2int(l))
66 
67 // DVB Bluebook A038 (Sept 2011) p 77
69 {
70  public:
71  explicit NetworkNameDescriptor(const unsigned char *data, int len = 300) :
72  MPEGDescriptor(data, len, DescriptorID::network_name) { }
73  // Name bits loc expected value
74  // descriptor_tag 8 0.0 0x40
75  // descriptor_length 8 1.0
76  // for (i=0;i<N;i++){ char 8 uimsbf }
77  QString Name(void) const
78  { return dvb_decode_text(m_data+2, DescriptorLength()); }
79  QString ShortName(void) const
81  QString toString(void) const override // MPEGDescriptor
82  { return QString("NetworkNameDescriptor: ")+Name(); }
83 };
84 
85 // DVB Bluebook A038 (Sept 2011) p 63
87 {
88  public:
89  explicit LinkageDescriptor(const unsigned char *data, int len = 300) :
90  MPEGDescriptor(data, len, DescriptorID::linkage)
91  {
92  if (!m_data)
93  return;
94  if (DescriptorLength() < 7)
95  {
96  m_data = nullptr;
97  }
98  else if (kMobileHandOver == LinkageType())
99  {
100  uint end = 8;
101  if (DescriptorLength() < end)
102  {
103  m_data = nullptr;
104  return;
105  }
106  end += (HasMobileNetworkID()) ? 2 : 0;
107  end += (HasMobileInitialServiceID()) ? 2 : 0;
108  if (DescriptorLength() < end)
109  m_data = nullptr;
110  m_offset = end + 2;
111  }
112  else if (kEventLinkage == LinkageType())
113  {
114  if (DescriptorLength() < 10)
115  m_data = nullptr;
116  m_offset = 12;
117  }
118  }
119  // Name bits loc expected value
120  // descriptor_tag 8 0.0 0x4A
121  // descriptor_length 8 1.0
122  // transport_stream_id 16 2.0
123  uint TSID(void) const { return (m_data[2]<<8) | m_data[3]; }
124  // original_network_id 16 4.0
125  uint OriginalNetworkID() const { return (m_data[4]<<8) | m_data[5]; }
126  // service_id 16 6.0
127  uint ServiceID(void) const { return (m_data[6]<<8) | m_data[7]; }
128  // linkage_type 8 8.0
129  enum
130  {
132  kEPGService = 0x02,
137  kRCSMap = 0x07,
144  };
145  uint LinkageType(void) const { return m_data[8]; }
146  QString LinkageTypeString(void) const;
147 
148  // if (linkage_type == 0x08)
149  // {
150  // hand-over_type 4 9.0
151  enum
152  {
156  };
157  uint MobileHandOverType(void) const { return m_data[9]>>4; }
158  QString MobileHandOverTypeString(void) const;
159  // reserved_future_use 3 9.4
160  // origin_type 1 9.7
161  enum
162  {
163  kOriginNIT = 0x0,
164  kOriginSDT = 0x1,
165  };
166  uint MobileOriginType(void) const { return m_data[9]&0x1; }
167  QString MobileOriginTypeString(void) const;
168  // if (hand-over_type == 0x01 || hand-over_type == 0x02 ||
169  // hand-over_type == 0x03)
170  // { network_id 16 10.0 }
171  bool HasMobileNetworkID(void) const
172  { return bool(MobileHandOverType() & 0x3); }
173  uint MobileNetworkID(void) const { return (m_data[10]<<8) | m_data[11]; }
174  // if (origin_type ==0x00)
175  // { initial_service_id 16 HasNetworkID()?10.0:12.0 }
176  bool HasMobileInitialServiceID(void) const
177  { return kOriginNIT == MobileOriginType(); }
179  {
180  return HasMobileNetworkID() ?
181  ((m_data[12]<<8) | m_data[13]) : ((m_data[10]<<8) | m_data[11]);
182  }
183  // }
184  // if (linkage_type == 0x0D)
185  // {
186  // target_event_id 16 9.0
187  uint TargetEventID(void) const { return (m_data[9]<<8) | m_data[10]; }
188  // target_listed 1 11.0
189  bool IsTargetListed(void) const { return ( m_data[11]&0x80 ) != 0; }
190  // event_simulcast 1 11.1
191  bool IsEventSimulcast(void) const { return ( m_data[11]&0x40 ) != 0; }
192  // reserved 6 11.2
193  // }
194  // for (i=0;i<N;i++)
195  // { private_data_byte 8 bslbf }
196  const unsigned char *PrivateData(void) const
197  { return &m_data[m_offset]; }
199  { return DescriptorLength() + 2 - m_offset; }
200 
201  private:
203 };
204 
205 // DVB Bluebook A038 (Sept 2011) p 38
207 {
208  public:
209  explicit AdaptationFieldDataDescriptor(const unsigned char *data, int len = 300) :
210  MPEGDescriptor(data, len, DescriptorID::adaptation_field_data, 1) { }
211  // Name bits loc expected value
212  // descriptor_tag 8 0.0 0x70
213  // descriptor_length 8 1.0
214  // adapt_field_data_id 8 2.0
215  uint AdaptationFieldDataID(void) const { return m_data[2]; }
216  QString toString(void) const override // MPEGDescriptor
217  {
218  return QString("AdaptationFieldDataDescriptor "
219  "adaptation_field_data_identifier(%1)")
220  .arg(AdaptationFieldDataID());
221  }
222 };
223 
224 // DVB Bluebook A038 (Sept 2011) p 38
226 {
227  public:
228  explicit AncillaryDataDescriptor(const unsigned char *data, int len = 300) :
229  MPEGDescriptor(data, len, DescriptorID::ancillary_data, 1) { }
230  // Name bits loc expected value
231  // descriptor_tag 8 0.0 0x6b
232  // descriptor_length 8 1.0
233  // ancillary_data_id 8 2.0
234  uint AncillaryDataID(void) const { return m_data[2]; }
235  QString toString(void) const override // MPEGDescriptor
236  {
237  return QString("AncillaryDataDescriptor "
238  "ancillary_data_identifier(%1)")
239  .arg(AncillaryDataID());
240  }
241 };
242 
243 // DVB Bluebook A038 (Sept 2011) p 39
245 {
246  public:
247  explicit AnnouncementSupportDescriptor(const unsigned char *data, int len = 300) :
248  MPEGDescriptor(data, len, DescriptorID::announcement_support) { }
249  // Name bits loc expected value
250  // descriptor_tag 8 0.0 0x6e
251  // descriptor_length 8 1.0
252  // announcmnt_supprt_indic 16 2.0
253  // for (i=0; i<N; i++)
254  // {
255  // announcement_type 4 0.0+p
256  // reserved_future_use 1 0.4+p
257  // reference_type 3 0.5+p
258  // if (reference_type & 0x3)
259  // {
260  // original_network_id 16 0.0+p
261  // transport_stream_id 16 2.0+p
262  // service_id 16 4.0+p
263  // component_tag 8 6.0+p
264  // } 7.0
265  // }
266 };
267 
268 // DVB Bluebook A038 (Sept 2011) p 41
270 {
271  public:
272  explicit BouquetNameDescriptor(const unsigned char *data, int len = 300) :
273  MPEGDescriptor(data, len, DescriptorID::bouquet_name) { }
274  // Name bits loc expected value
275  // descriptor_tag 8 0.0 0x47
276  // descriptor_length 8 1.0
277  // for(i=0;i<N;i++) { char 8 }
278  QString BouquetName(void) const
279  { return dvb_decode_text(m_data+2, m_data[1]); }
280  QString BouquetShortName(void) const
281  { return dvb_decode_short_name(m_data+2, m_data[1]); }
282 
283  QString toString(void) const override // MPEGDescriptor
284  {
285  return QString("BouquetNameDescriptor: Bouquet Name(%1)")
286  .arg(BouquetName());
287  }
288 };
289 
290 // DVB Bluebook A038 (Sept 2011) p 41
292 {
293  public:
294  explicit CAIdentifierDescriptor(const unsigned char *data, int len = 300) :
295  MPEGDescriptor(data, len, DescriptorID::ca_identifier) { }
296  // Name bits loc expected value
297  // descriptor_tag 8 0.0 0x53
298  // descriptor_length 8 1.0
299  //
300  uint CASystemCount(void) const { return DescriptorLength() >> 1; }
301  // for (i=0; i<N; i++)
302  // { CA_system_id 16 }
303  int CASystemId(uint i) const
304  { return (m_data[2 + i*2] << 8) | m_data[3 + i*2]; }
305  QString toString(void) const override; // MPEGDescriptor
306 };
307 
308 // DVB Bluebook A038 (Sept 2011) p 42
310 {
311  public:
312  explicit CellFrequencyLinkDescriptor(const unsigned char *data, int len = 300) :
313  MPEGDescriptor(data, len, DescriptorID::cell_frequency_link) { }
314  // Name bits loc expected value
315  // descriptor_tag 8 0.0 0x6d
316  // descriptor_length 8 1.0
317  // for (i=0; i<N; i++)
318  // {
319  // cell_id 16 0.0+p
320  // frequency 32 2.0+p
321  // subcell_info_loop_len 8 6.0+p
322  // for (j=0;j<N;j++)
323  // {
324  // cell_id_extension 8 0.0+p2
325  // transposer_freq 32 1.0+p2
326  // } 5.0
327  // }
328 };
329 
330 // DVB Bluebook A038 (Sept 2011) p 42
332 {
333  public:
334  explicit CellListDescriptor(const unsigned char *data, int len = 300) :
335  MPEGDescriptor(data, len, DescriptorID::cell_list) { }
336  // Name bits loc expected value
337  // descriptor_tag 8 0.0 0x6c
338  // descriptor_length 8 1.0
339  // for (i=0; i<N; i++)
340  // {
341  // cell_id 16 0.0+p
342  // cell_latitude 16 2.0+p
343  // cell_longitude 16 4.0+p
344  // cell_extent_of_lat 12 6.0+p
345  // cell_extent_of_longit 12 7.4+p
346  // subcell_info_loop_len 8 9.0+p
347  // for (j=0;j<N;j++)
348  // {
349  // cell_id_extension 8 0.0+p2
350  // subcell_latitude 16 1.0+p2
351  // subcell_longitude 16 3.0+p2
352  // subcell_ext_of_lat 12 4.0+p2
353  // subcell_ext_of_long 12 5.4+p2
354  // } 7.0
355  // }
356 };
357 
358 // DVB Bluebook A038 (Sept 2011) p 44
360 {
361  public:
362  explicit ComponentDescriptor(const unsigned char *data, int len = 300) :
363  MPEGDescriptor(data, len, DescriptorID::component) { }
364  // Name bits loc expected value
365  // descriptor_tag 8 0.0 0x50
366  // descriptor_length 8 1.0
367  // reserved_future_use 4 2.0
368  // stream_content 4 2.4
369  uint StreamContent(void) const { return m_data[2] & 0xf; }
370  // component_type 8 3.0
371  uint ComponentType(void) const { return m_data[3]; }
372  // component_tag 8 4.0
373  uint ComponentTag(void) const { return m_data[4]; }
374  // ISO_639_language_code 24 5.0
375  int LanguageKey(void) const
376  { return iso639_str3_to_key(&m_data[5]); }
377  QString LanguageString(void) const
378  { return iso639_key_to_str3(LanguageKey()); }
379  int CanonicalLanguageKey(void) const
381  QString CanonicalLanguageString(void) const
383  //
384  // for (i=0; i<N; i++) { text_char 8 }
385 
386  bool IsVideo(void) const
387  {
388  return 0x1 == StreamContent() || // MPEG-2
389  0x5 == StreamContent() || // H.264
390  0x9 == StreamContent(); // HEVC
391  }
392  bool IsAudio(void) const
393  {
394  switch(StreamContent())
395  {
396  case 0x02:
397  case 0x04:
398  case 0x06:
399  case 0x07:
400  return true;
401  default:
402  return false;
403  }
404  }
405  bool IsSubtitle(void) const { return 0x3 == StreamContent(); }
406 
407  unsigned char VideoProperties(void) const
408  {
409  if (0x1 == StreamContent())
410  return MPEG2Properties();
411  if (0x5 == StreamContent())
412  return VID_AVC | AVCProperties();
413  if (0x9 == StreamContent())
414  return /* VID_HEVC | */ HEVCProperties();
415 
416  return VID_UNKNOWN;
417  }
418 
419  unsigned char MPEG2Properties(void) const
420  {
421  switch(ComponentType())
422  {
423  case 0x2: case 0x3: case 0x4:
424  case 0x6: case 0x7: case 0x8:
425  return VID_WIDESCREEN;
426  case 0x09:
427  case 0x0D:
428  return VID_HDTV;
429  case 0x0A: case 0x0B: case 0x0C:
430  case 0x0E: case 0x0F: case 0x10:
431  return VID_WIDESCREEN | VID_HDTV;
432  default:
433  return VID_UNKNOWN;
434  }
435  }
436 
437  unsigned char AVCProperties(void) const
438  {
439  switch(ComponentType())
440  {
441  case 0x3: case 0x4:
442  case 0x7: case 0x8:
443  return VID_WIDESCREEN;
444  case 0x0B: case 0x0C:
445  case 0x0F: case 0x10:
446  return VID_WIDESCREEN | VID_HDTV;
447  case 0x80: case 0x81:
448  case 0x82: case 0x83:
449  return VID_WIDESCREEN | VID_HDTV | VID_3DTV;
450  default:
451  return VID_UNKNOWN;
452  }
453  }
454 
455  unsigned char HEVCProperties(void) const
456  {
457  switch(ComponentType())
458  {
459  // NOLINTNEXTLINE(bugprone-branch-clone)
460  case 0x0: case 0x1:
461  case 0x2: case 0x3:
462  return VID_HDTV;
463  case 0x5:
464  return VID_HDTV; // | VID_UHDTV;
465  default:
466  return VID_UNKNOWN;
467  }
468  }
469 
470  unsigned char AudioProperties(void) const
471  {
472  switch (StreamContent())
473  {
474  case 0x2:
475  return MP2Properties();
476  case 0x04:
477  return AC3Properties();
478  case 0x06:
479  return HEAACProperties();
480  default:
481  return AUD_UNKNOWN;
482  }
483  }
484 
485  unsigned char MP2Properties(void) const
486  {
487  switch (ComponentType())
488  {
489  case 0x1:
490  return AUD_MONO;
491  case 0x3:
492  return AUD_STEREO;
493  case 0x5:
494  return AUD_SURROUND;
495  case 0x40:
496  return AUD_VISUALIMPAIR;
497  case 0x41:
498  return AUD_HARDHEAR;
499  default:
500  return AUD_UNKNOWN;
501  }
502  }
503 
504  unsigned char AC3Properties(void) const
505  {
506  unsigned char properties = AUD_UNKNOWN;
507 
508  switch (ComponentType() & 0x7)
509  {
510  case 0x0:
511  properties |= AUD_MONO;
512  break;
513  case 0x2:
514  properties |= AUD_STEREO;
515  break;
516  case 0x3:
517  properties |= AUD_DOLBY;
518  break;
519  case 0x4: case 0x5:
520  properties |= AUD_SURROUND;
521  break;
522  }
523 
524  if (((ComponentType() >> 3) & 0x7) == 0x2)
525  properties |= AUD_VISUALIMPAIR;
526 
527  if (((ComponentType() >> 3) & 0x7) == 0x3)
528  properties |= AUD_HARDHEAR;
529 
530  return properties;
531  }
532 
533  unsigned char HEAACProperties(void) const
534  {
535  switch (ComponentType())
536  {
537  case 0x1:
538  return AUD_MONO;
539  case 0x3:
540  case 0x43:
541  return AUD_STEREO;
542  case 0x5:
543  return AUD_SURROUND;
544  case 0x40:
545  case 0x44:
546  return AUD_VISUALIMPAIR;
547  case 0x41:
548  case 0x45:
549  return AUD_HARDHEAR;
550  default:
551  return AUD_UNKNOWN;
552  }
553  }
554 
555  unsigned char SubtitleType(void) const
556  {
557  if (!IsSubtitle())
558  return SUB_UNKNOWN;
559 
560  switch (ComponentType())
561  {
562  case 0x1:
563  case 0x3:
564  case 0x10: case 0x11: case 0x12: case 0x13:
565  return SUB_NORMAL;
566  case 0x20: case 0x21: case 0x22: case 0x23:
567  return SUB_HARDHEAR;
568  default:
569  return SUB_UNKNOWN;
570  }
571  }
572 
573  QString toString(void) const override // MPEGDescriptor
574  {
575  return QString("ComponentDescriptor(stream_content: 0x%1, "
576  "component_type: 0x%2)").arg(StreamContent(), 0, 16)
577  .arg(ComponentType(), 0, 16);
578  }
579 };
580 
581 // DVB Bluebook A038 (Sept 2011) p 46
583 {
584  public:
585  explicit ContentDescriptor(const unsigned char *data, int len = 300) :
586  MPEGDescriptor(data, len, DescriptorID::content) { }
587  // Name bits loc expected value
588  // descriptor_tag 8 0.0 0x54
589  // descriptor_length 8 1.0
590 
591  uint Count(void) const { return DescriptorLength() >> 1; }
592  // for (i=0;i<N;i++)
593  // {
594  // content_nibble_level_1 4 0.0+p
595  uint Nibble1(uint i) const { return m_data[2 + (i<<1)] >> 4; }
596  // content_nibble_level_2 4 0.4+p
597  uint Nibble2(uint i) const { return m_data[2 + (i<<1)] & 0xf; }
598 
599  uint Nibble(uint i) const { return m_data[2 + (i<<1)]; }
600 
601  // user_nibble 4 1.0+p
602  uint UserNibble1(uint i) const { return m_data[3 + (i<<1)] >> 4; }
603  // user_nibble 4 1.4+p
604  uint UserNibble2(uint i) const { return m_data[3 + (i<<1)] & 0xf; }
605  uint UserNibble(uint i) const { return m_data[3 + (i<<1)]; }
606  // } 2.0
607 
609  QString GetDescription(uint i) const;
610  QString toString(void) const override; // MPEGDescriptor
611 
612  protected:
613  static void Init(void);
614 
615  protected:
616  static QMutex s_categoryLock;
617  static QMap<uint,QString> s_categoryDesc;
618  static volatile bool s_categoryDescExists;
619 };
620 
621 // DVB Bluebook A038 (Sept 2011) p 49
623 {
624  public:
625  explicit CountryAvailabilityDescriptor(const unsigned char *data, int len = 300) :
626  MPEGDescriptor(data, len, DescriptorID::country_availability) { }
627  // Name bits loc expected value
628  // descriptor_tag 8 0.0 0x49
629  // descriptor_length 8 1.0
630 
631  uint CountryCount(void) const { return ((DescriptorLength() - 1) / 3); }
632 
633  // country_avail_flag 1 2.0
634  bool IsAvailable(void) const { return (m_data[2] & 0x1) != 0; }
635  // reserved_future_use 7 2.1
636  //
637  // for (i=0; i<N; i++)
638  // { country_code 24 }
639  QString CountryNames(void) const
640  {
641  QString countries="";
642  for (uint i=0; i<CountryCount(); i++)
643  {
644  if (i!=0) countries.append(" ");
645  countries.append(QString::fromLatin1(
646  (const char *)m_data+(3*(i+1)), 3));
647  };
648  return countries;
649  }
650 
651  QString toString(void) const override // MPEGDescriptor
652  {
653  return QString("CountryAvailabilityDescriptor: Available(%1) in (%2)")
654  .arg(static_cast<int>(IsAvailable())).arg(CountryNames());
655  }
656 };
657 
658 // DVB Bluebook A038 (Sept 2011) p 50
660 {
661  public:
662  explicit DataBroadcastDescriptor(const unsigned char *data, int len = 300) :
663  MPEGDescriptor(data, len, DescriptorID::data_broadcast) { }
664  // Name bits loc expected value
665  // descriptor_tag 8 0.0 0x64
666  // descriptor_length 8 1.0
667 
668  // data_broadcast_id 16 2.0
669  uint DataBroadcastId(void) const { return m_data[2] << 8 | m_data[3]; }
670  // component_tag 8 4.0
671  uint DataComponentTag(void) const { return m_data[4]; }
672  // selector_length 8 5.0
673  uint SelectorLength(void) const { return m_data[5]; }
674  // for (i=0; i<selector_length; i++)
675  // {
676  // selector_byte 8
677  const unsigned char *Selector(void) const { return &m_data[6]; }
678  // }
679  // ISO_639_language_code 24
680  int LanguageKey(void) const
681  { return iso639_str3_to_key(&m_data[6 + SelectorLength()]); }
682  QString LanguageString(void) const
683  { return iso639_key_to_str3(LanguageKey()); }
684  int CanonicalLanguageKey(void) const
686  QString CanonicalLanguageString(void) const
688  // text_length 8
689  uint TextLength(void) const { return m_data[6 + SelectorLength() + 3]; }
690  // for (i=0; i<text_length; i++) { text_char 8 }
691  QString Text(void) const
692  {
693  return dvb_decode_text(&m_data[6 + SelectorLength() + 4], TextLength());
694  }
695 
696  QString toString(void) const override; // MPEGDescriptor
697 };
698 
699 // DVB Bluebook A038 (Sept 2011) p 51
701 {
702  public:
703  explicit DataBroadcastIdDescriptor(const unsigned char *data, int len = 300) :
704  MPEGDescriptor(data, len, DescriptorID::data_broadcast_id) { }
705  // Name bits loc expected value
706  // descriptor_tag 8 0.0 0x66
707  // descriptor_length 8 1.0
708 
709  // data_broadcast_id 16 2.0
710  uint DataBroadCastId(void) const { return m_data[2] << 8 | m_data[3]; }
711  // for(i=0; i < N;i++ )
712  // { id_selector_byte 8 }
713 };
714 
715 // DVB Bluebook A038 (Sept 2011) p 51
717 {
718  public:
719  explicit CableDeliverySystemDescriptor(const unsigned char *data, int len = 300) :
720  MPEGDescriptor(data, len, DescriptorID::cable_delivery_system) { }
721  // Name bits loc expected value
722  // descriptor_tag 8 0.0 0x44
723  // descriptor_length 8 1.0
724 
725  // frequency 32 2.0
726  uint FrequencyRaw(void) const
727  {
728  return ((m_data[2]<<24) | (m_data[3]<<16) |
729  (m_data[4]<<8) | (m_data[5]));
730  }
731  unsigned long long FrequencyHz(void) const
732  {
733  if (m_data == nullptr)
734  return 0;
735  return byte4BCD2int(m_data[2], m_data[3], m_data[4], m_data[5]) * 100;
736  }
737  // reserved_future_use 12 6.0
738  // FEC_outer 4 7.4
739  enum
740  {
743  };
744  uint FECOuter(void) const { return m_data[7] & 0xf; }
745  QString FECOuterString(void) const
746  {
747  return (FECOuter() == kOuterFEC_None) ? "None" :
748  ((FECOuter() == kOuterFEC_RS204_RS188) ? "RS(204/188)" : "unknown");
749  }
750  // modulation 8 8.0
751  enum
752  {
758  };
759  uint Modulation(void) const { return m_data[8]; }
760  QString ModulationString(void) const
761  {
762  static QString ms[] =
763  { "auto", "qam_16", "qam_32", "qam_64", "qam_128", "qam_256" };
764  return (Modulation() <= kModulationQAM256) ?
765  ms[Modulation()] : QString("auto");
766  }
767  // symbol_rate 28 9.0
768  uint SymbolRateRaw(void) const
769  {
770  return ((m_data[9]<<20) | (m_data[10]<<12) |
771  (m_data[11]<<4) | (m_data[12]>>4));
772  }
773  uint SymbolRateHz(void) const
774  {
775  return ((byte3BCD2int(m_data[9], m_data[10], m_data[11]) * 1000) +
776  (byteBCDH2int(m_data[12]) * 100));
777  }
778  // FEC_inner 4 12.4
779  enum
780  {
788  };
789  uint FECInner(void) const { return m_data[12] & 0xf; }
790  QString FECInnerString(void) const { return coderate_inner(FECInner()); }
791  QString toString(void) const override; // MPEGDescriptor
792 };
793 
794 // DVB Bluebook A038 (Feb 2019) p 58
796 {
797  public:
799  const unsigned char *data, int len = 300) :
800  MPEGDescriptor(data, len, DescriptorID::satellite_delivery_system) { }
801  // Name bits loc expected value
802  // descriptor_tag 8 0.0 0x43
803  // descriptor_length 8 1.0
804 
806  uint FrequencyRaw(void) const
807  {
808  return ((m_data[2]<<24) | (m_data[3]<<16) |
809  (m_data[4]<<8) | (m_data[5]));
810  }
811  unsigned long long FrequencykHz(void) const
812  {
813  return byte4BCD2int(m_data[2], m_data[3], m_data[4], m_data[5]) * 10;
814  }
816  uint OrbitalPosition(void) const
817  { return byte2BCD2int(m_data[6], m_data[7]); }
818  QString OrbitalPositionString(void) const
819  {
820  uint num = OrbitalPosition();
821  return QString("%1.%2 %3").arg(num / 10).arg(num % 10)
822  .arg((IsEast()) ? "East" : "West");
823  }
824  double OrbitalPositionFloat() const
825  { return ((double) OrbitalPosition()) / 10.0; }
827  bool IsEast(void) const { return ( (m_data[8]&0x80) ) != 0; }
828  bool IsWest(void) const { return !IsEast(); }
829  // polarization 2 8.1
830  uint Polarization(void) const { return (m_data[8]>>5)&0x3; }
831  QString PolarizationString() const
832  {
833  static QString ps[] = { "h", "v", "l", "r" };
834  return ps[Polarization()];
835  }
836  bool IsCircularPolarization(void) const { return ((m_data[8]>>6)&0x1) != 0; }
837  bool IsLinearPolarization(void) const { return ((m_data[8]>>6)&0x1) == 0; }
838  bool IsHorizontalLeftPolarization(void) const { return ((m_data[8]>>5)&0x1) != 0; }
839  bool IsVerticalRightPolarization(void) const { return ((m_data[8]>>5)&0x1) == 0; }
840  // roll off 2 8.3
841  enum
842  {
847  };
848  uint RollOff(void) const { return (m_data[8]>>3)&0x3; }
849  QString RollOffString(void) const
850  {
851  static QString ro[] = { "0.35", "0.20", "0.25", "auto" };
852  return ro[RollOff()];
853  }
854  // modulation system 1 8.5
855  uint ModulationSystem(void) const { return (m_data[8]>>2)&0x1; }
856  QString ModulationSystemString(void) const
857  {
858  return ModulationSystem() ? "DVB-S2" : "DVB-S";
859  }
860  // modulation 2 8.6
861  enum
862  {
863  kModulationQPSK_NS = 0x0, // Non standard QPSK for Bell ExpressVu
864  // should be "auto" according to DVB SI standard
868  };
869  uint Modulation(void) const { return m_data[8]&0x03; }
870  QString ModulationString(void) const
871  {
872  static QString ms[] = { "qpsk", "qpsk", "8psk", "qam_16" };
873  return ms[Modulation()];
874  }
875  // symbol_rate 28 9.0
876  uint SymbolRate(void) const
877  {
878  return ((m_data[9]<<20) | (m_data[10]<<12) |
879  (m_data[11]<<4) | (m_data[12]>>4));
880  }
881  uint SymbolRateHz(void) const
882  {
883  return ((byte3BCD2int(m_data[9], m_data[10], m_data[11]) * 1000) +
884  (byteBCDH2int(m_data[12]) * 100));
885  }
886  // FEC_inner 4 12.4
887  enum
888  {
896  };
897  uint FECInner(void) const { return m_data[12] & 0xf; }
898  QString FECInnerString(void) const { return coderate_inner(FECInner()); }
899 
900  QString toString(void) const override; // MPEGDescriptor
901 };
902 
903 // DVB Bluebook A038 (Feb 2019) p 60
905 {
906  public:
908  const unsigned char *data, int len = 300) :
909  MPEGDescriptor(data, len, DescriptorID::terrestrial_delivery_system) { }
910  // Name bits loc expected value
911  // descriptor_tag 8 0.0 0x5a
912  // descriptor_length 8 1.0
913 
914  // centre_frequency 32 2.0
915  uint Frequency(void) const
916  {
917  return ((m_data[2]<<24) | (m_data[3]<<16) |
918  (m_data[4]<<8) | (m_data[5]));
919  }
920  uint64_t FrequencyHz(void) const { return uint64_t(Frequency()) * 10ULL; }
921 
922  // bandwidth 3 6.0
923  enum
924  {
929  };
930  uint Bandwidth(void) const { return m_data[6]>>5; }
931  uint BandwidthHz(void) const { return (8 - Bandwidth()) * 1000000; }
932  QString BandwidthString(void) const
933  {
934  static QString bs[] = { "8", "7", "6", "5" };
935  return (Bandwidth() <= kBandwidth5Mhz) ? bs[Bandwidth()] : "auto";
936  }
937  // priority 1 6.3
938  bool HighPriority(void) const { return ( m_data[6] & 0x10 ) != 0; }
939  // time_slicing_indicator 1 6.4
940  bool IsTimeSlicingIndicatorUsed(void) const { return (m_data[6] & 0x08) == 0; }
941  // MPE-FEC_indicator 1 6.5
942  bool IsMPE_FECUsed(void) const { return (m_data[6] & 0x04) == 0; }
943  // reserved_future_use 2 6.6
944  // constellation 2 7.0
945  enum
946  {
951  };
952  uint Constellation(void) const { return m_data[7]>>6; }
953  QString ConstellationString(void) const
954  {
955  static QString cs[] = { "qpsk", "qam_16", "qam_64", "qam_256" };
956  return (Constellation() <= kConstellationQAM256) ?
957  cs[Constellation()] : "auto";
958  }
959  // hierarchy_information 3 7.2
960  enum
961  {
970  };
971  uint Hierarchy(void) const { return (m_data[7]>>3) & 0x7; }
972 
974  QString HierarchyString(void) const
975  {
976  static QString hs[] = { "n", "1", "2", "4", "a", "a", "a", "a" };
977  return hs[Hierarchy()];
978  }
979  bool NativeInterleaver(void) const { return ( m_data[7] & 0x20 ) != 0; }
980  uint Alpha(void) const
981  {
982  uint i = (m_data[7]>>3) & 0x3;
983  return (0x2 == i) ? 4 : i;
984  }
985  // code_rate-HP_stream 3 7.5
986  enum
987  {
993  };
994  uint CodeRateHP(void) const { return m_data[7] & 0x7; }
995  QString CodeRateHPString(void) const
996  {
997  static QString cr[] = {
998  "1/2", "2/3", "3/4", "5/6", "7/8", "auto", "auto", "auto"
999  };
1000  return cr[CodeRateHP()];
1001  }
1002  // code_rate-LP_stream 3 8.0
1003  uint CodeRateLP(void) const { return (m_data[8]>>5) & 0x7; }
1004  QString CodeRateLPString(void) const
1005  {
1006  static QString cr[] = {
1007  "1/2", "2/3", "3/4", "5/6", "7/8", "auto", "auto", "auto"
1008  };
1009  return cr[CodeRateLP()];
1010  }
1011  // guard_interval 2 8.3
1012  enum
1013  {
1018  };
1019  uint GuardInterval(void) const { return (m_data[8]>>3) & 0x3; }
1020  QString GuardIntervalString(void) const
1021  {
1022  static QString gi[] = { "1/32", "1/16", "1/8", "1/4" };
1023  return gi[GuardInterval()];
1024  }
1025  // transmission_mode 2 8.5
1026  enum
1027  {
1031  };
1032  uint TransmissionMode(void) const { return (m_data[8]>>1) & 0x3; }
1033  QString TransmissionModeString(void) const
1034  {
1035  static QString tm[] = { "2", "8", "4", "auto" };
1036  return tm[TransmissionMode()];
1037  }
1038  // other_frequency_flag 1 8.7
1039  bool OtherFrequencyInUse(void) const { return (m_data[8] & 0x1) != 0; }
1040  // reserved_future_use 32 9.0
1041 
1042  QString toString(void) const override; // MPEGDescriptor
1043 };
1044 
1045 // DVB Bluebook A038 (Feb 2019) p 110
1047 {
1048  public:
1050  const unsigned char *data, int len = 300) :
1051  MPEGDescriptor(data, len, DescriptorID::extension)
1052  {
1054  {
1055  m_data = nullptr;
1056  }
1057  }
1058  // Name bits loc expected value
1059  // descriptor_tag 8 0.0 0x7f extension
1060  // descriptor_length 8 1.0
1061  // descriptor_tag_extension 8 2.0 0x00 image_icon
1062 
1063  // descriptor_number 4 3.0
1065  {
1066  return m_data[3] >> 4;
1067  }
1068 
1069  // last_descriptor_number 4 3.4
1071  {
1072  return m_data[3] & 0xF;
1073  }
1074 
1075  // icon_id 3 4.5
1076  uint IconID(void) const
1077  {
1078  return m_data[4] & 0x7;
1079  }
1080 
1081  //
1082  // TBD
1083  //
1084 
1085  QString toString(void) const override; // MPEGDescriptor
1086 };
1087 
1088 // DVB Bluebook A038 (Feb 2019) p 104 0x7f 0x04
1090 {
1091  public:
1093  const unsigned char *data, int len = 300) :
1094  MPEGDescriptor(data, len, DescriptorID::extension)
1095  {
1097  {
1098  m_data = nullptr;
1099  }
1100  Parse();
1101  }
1102  // Name bits loc expected value
1103  // descriptor_tag 8 0.0 0x7f extension
1104  // descriptor_length 8 1.0
1105  // descriptor_tag_extension 8 2.0 0x04 t2_delivery_system
1106 
1107  // plp_id 8 3.0
1108  uint PlpID(void) const
1109  {
1110  return m_data[3];
1111  }
1112 
1113  // T2_system_id 16 4.0
1114  uint T2SystemID(void) const
1115  {
1116  return ((m_data[4]<<8) | (m_data[5]));
1117  }
1118 
1119  // SISO/MISO 2 6.0
1120  uint SisoMiso(void) const { return (m_data[6] >> 6) & 0x3; }
1121  QString SisoMisoString(void) const
1122  {
1123  static QString sm[] = { "SISO", "MISO", "reserved", "reserved" };
1124  return sm[SisoMiso()];
1125  }
1126 
1127  // bandwidth 4 6.2
1128  enum
1129  {
1136  };
1137  uint Bandwidth(void) const { return (m_data[6] >> 2) & 0xF; }
1138  uint BandwidthHz(void) const
1139  {
1140  static uint bw[] = { 8000000, 7000000, 6000000, 5000000, 10000000, 1712000 };
1141  return (Bandwidth() <= kBandwidth1712kHz ? bw[Bandwidth()] : 0);
1142  }
1143  QString BandwidthString(void) const
1144  {
1145  static QString bs[] = { "8", "7", "6", "5", "10", "1.712" };
1146  return (Bandwidth() <= kBandwidth1712kHz) ? bs[Bandwidth()] : "0";
1147  }
1148 
1149  // guard_interval 3 7.0
1150  enum
1151  {
1159  };
1160  uint GuardInterval(void) const { return (m_data[7]>>5) & 0x7; }
1161  QString GuardIntervalString(void) const
1162  {
1163  static QString gi[] = { "1/32", "1/16", "1/8", "1/4", "1/128", "19/128", "19/256", "reserved" };
1164  return gi[GuardInterval()];
1165  }
1166 
1167  // transmission_mode 3 7.3
1168  enum
1169  {
1176  };
1177  uint TransmissionMode(void) const { return (m_data[7]>>2) & 0x7; }
1178  QString TransmissionModeString(void) const
1179  {
1180  static QString tm[] = { "2k", "8k", "4k", "1k", "16k", "32k", "reserved", "reserved" };
1181  return tm[TransmissionMode()];
1182  }
1183  uint OtherFrequencyFlag(void) const { return (m_data[7]>>1) & 0x1; }
1184  uint TFSFlag(void) const { return m_data[7] & 0x1; }
1185 
1186  public:
1187  uint NumCells(void) const { return m_cellPtrs.size(); }
1188  uint CellID(uint i) const { return (m_cellPtrs[i][0] << 8) | m_cellPtrs[i][1]; }
1189  uint FrequencyLoopLength(uint i) const { return m_cellPtrs[i][2]; }
1190 
1192  {
1193  return (m_cellPtrs[i][2] << 24) | (m_cellPtrs[i][3] << 16) | (m_cellPtrs[i][4] << 8) | m_cellPtrs[i][5];
1194  }
1195 
1196  uint CentreFrequency(int i, int j) const
1197  {
1198  return (m_cellPtrs[i][3+4*j] << 24) | (m_cellPtrs[i][4+4*j] << 16) | (m_cellPtrs[i][5+4*j] << 8) | m_cellPtrs[i][6+4*j];
1199  }
1200  uint SubcellInfoLoopLength(uint i) const { return m_subCellPtrs[i][0]; }
1201  uint CellIDExtension(uint i, uint j) const { return m_subCellPtrs[i][1+5*j]; }
1203  {
1204  return (m_subCellPtrs[i][1+5*j] << 24) | (m_subCellPtrs[i][2+5*j] << 16) | (m_subCellPtrs[i][3+5*j] << 8) | m_cellPtrs[i][4+5*j];
1205  }
1206 
1207  void Parse(void) const;
1208  QString toString(void) const override; // MPEGDescriptor
1209 
1210  private:
1211  mutable vector<const unsigned char*> m_cellPtrs; // used to parse
1212  mutable vector<const unsigned char*> m_subCellPtrs; // used to parse
1213 };
1214 
1215 // DVB Bluebook A038 (Feb 2019) p 100 0x7f 0x05
1217 {
1218  public:
1220  const unsigned char *data, int len = 300) :
1221  MPEGDescriptor(data, len, DescriptorID::extension)
1222  {
1224  {
1225  m_data = nullptr;
1226  }
1227  }
1228  // Name bits loc expected value
1229  // descriptor_tag 8 0.0 0x7f extension
1230  // descriptor_length 8 1.0
1231  // descriptor_tag_extension 8 2.0 0x05 sh_delivery_system
1232 
1233  //
1234  // TBD
1235  //
1236 
1237  QString toString(void) const override; // MPEGDescriptor
1238 };
1239 
1240 // DVB Bluebook A038 (Feb 2019) p 115 0x7F 0x06
1242 {
1243  public:
1245  const unsigned char *data, int len = 300) :
1246  MPEGDescriptor(data, len, DescriptorID::extension)
1247  {
1249  {
1250  m_data = nullptr;
1251  }
1252  }
1253  // Name bits loc expected value
1254  // descriptor_tag 8 0.0 0x7f extension
1255  // descriptor_length 8 1.0
1256  // descriptor_tag_extension 8 2.0 0x06 supplementary_audio_descriptor
1257 
1258  // mix_type 1 3.0
1259  uint MixType(void) const { return m_data[3] & 0x1; }
1260 
1261  // editorial_classification 5 3.1
1262  uint EditorialClassification(void) const { return (m_data[3] >> 1 ) & 0x1F; }
1263 
1264  // reserved_future_use 1 3.6
1265  uint ReservedFutureUse(void) const { return (m_data[3] >> 6 ) & 0x1; }
1266 
1267  // language_code_present 1 3.7
1268  uint LanguageCodePresent(void) const { return (m_data[3] >> 7 ) & 0x1; }
1269 
1270  // ISO_639_language_code 24 4.0
1271  int LanguageKey(void) const
1272  { return iso639_str3_to_key(&m_data[4]); }
1273  QString LanguageString(void) const
1274  { return iso639_key_to_str3(LanguageKey()); }
1275 
1276  QString toString(void) const override; // MPEGDescriptor
1277 };
1278 
1279 // DVB Bluebook A038 (Feb 2019) p 113 0x7F 0x07
1281 {
1282  public:
1284  const unsigned char *data, int len = 300) :
1285  MPEGDescriptor(data, len, DescriptorID::extension)
1286  {
1288  {
1289  m_data = nullptr;
1290  }
1291  }
1292  // Name bits loc expected value
1293  // descriptor_tag 8 0.0 0x7f extension
1294  // descriptor_length 8 1.0
1295  // descriptor_tag_extension 8 2.0 0x07 network_change_notify_descriptor
1296 
1297  QString toString(void) const override; // MPEGDescriptor
1298 };
1299 
1300 // DVB Bluebook A038 (Feb 2019) p 112 0x7F 0x08
1302 {
1303  public:
1305  const unsigned char *data, int len = 300) :
1306  MPEGDescriptor(data, len, DescriptorID::extension)
1307  {
1309  {
1310  m_data = nullptr;
1311  }
1312  }
1313  // Name bits loc expected value
1314  // descriptor_tag 8 0.0 0x7f extension
1315  // descriptor_length 8 1.0
1316  // descriptor_tag_extension 8 2.0 0x08 message_descriptor
1317 
1318  // message_id 8 3.0
1319  uint MessageID(void) const { return m_data[3]; }
1320 
1321  // ISO_639_language_code 24 4.0
1322  int LanguageKey(void) const
1323  { return iso639_str3_to_key(&m_data[4]); }
1324  QString LanguageString(void) const
1325  { return iso639_key_to_str3(LanguageKey()); }
1326 
1327  // text_char 8 7.0
1328  QString Message(void) const
1329  { return dvb_decode_text(m_data+7, DescriptorLength()-5); }
1330 
1331  QString toString(void) const override; // MPEGDescriptor
1332 };
1333 
1334 // DVB Bluebook A038 (Feb 2019) p 117
1336 {
1337  public:
1339  const unsigned char *data, int len = 300) :
1340  MPEGDescriptor(data, len, DescriptorID::extension)
1341  {
1343  {
1344  m_data = nullptr;
1345  }
1346  }
1347  // Name bits loc expected value
1348  // descriptor_tag 8 0.0 0x7f extension
1349  // descriptor_length 8 1.0 4 or more
1350  // descriptor_tag_extension 8 2.0 0x09 target_region
1351 
1352  // country_code 24 3.0 e.g. "GBR"
1353  uint CountryCode(void) const
1354  {
1355  return ((m_data[3] << 16) | (m_data[4] << 8) | m_data[5]);
1356  }
1357  QString CountryCodeString(void) const
1358  {
1359  return QString(m_data[3]) + QChar(m_data[4]) + QChar(m_data[5]);
1360  }
1361  //
1362  // TBD
1363  //
1364  QString toString(void) const override; // MPEGDescriptor
1365 };
1366 
1367 // DVB Bluebook A038 (Feb 2019) p 118
1369 {
1370  public:
1372  const unsigned char *data, int len = 300) :
1373  MPEGDescriptor(data, len, DescriptorID::extension)
1374  {
1376  {
1377  m_data = nullptr;
1378  }
1379  }
1380  // Name bits loc expected value
1381  // descriptor_tag 8 0.0 0x7f extension
1382  // descriptor_length 8 1.0 7 or more
1383  // descriptor_tag_extension 8 2.0 0x0A target_region_name
1384 
1385  // country_code 24 3.0 e.g. "GBR"
1386  uint CountryCode(void) const
1387  {
1388  return ((m_data[3] << 16) | (m_data[4] << 8) | m_data[5]);
1389  }
1390  QString CountryCodeString(void) const
1391  {
1392  return QString(m_data[3]) + QChar(m_data[4]) + QChar(m_data[5]);
1393  }
1394 
1395  // ISO_639_language_code 24 6.0
1396  int LanguageKey(void) const
1397  { return iso639_str3_to_key(&m_data[6]); }
1398  QString LanguageString(void) const
1399  { return iso639_key_to_str3(LanguageKey()); }
1400 
1401  //
1402  // TBD
1403  //
1404  QString toString(void) const override; // MPEGDescriptor
1405 };
1406 
1407 // DVB Bluebook A038 (Feb 2019) p 115 0x7F 0x0B
1409 {
1410  public:
1412  const unsigned char *data, int len = 300) :
1413  MPEGDescriptor(data, len, DescriptorID::extension)
1414  {
1416  {
1417  m_data = nullptr;
1418  }
1419  }
1420  // Name bits loc expected value
1421  // descriptor_tag 8 0.0 0x7f extension
1422  // descriptor_length 8 1.0 7
1423  // descriptor_tag_extension 8 2.0 0x0B service_relocated
1424 
1425  // old_original_network_id 16 3.0
1426  // old_transport_stream_id 16 5.0
1427  // old_service_id 16 7.0
1428  uint OldOriginalNetworkID(void) const { return (m_data[3] << 8) | m_data[4]; }
1429  uint OldTransportID(void) const { return (m_data[5] << 8) | m_data[6]; }
1430  uint OldServiceID(void) const { return (m_data[7] << 8) | m_data[8]; }
1431 
1432  QString toString(void) const override; // MPEGDescriptor
1433 };
1434 
1435 // DVB Bluebook A038 (Feb 2019) p 98
1437 {
1438  public:
1440  const unsigned char *data, int len = 300) :
1441  MPEGDescriptor(data, len, DescriptorID::extension)
1442  {
1444  {
1445  m_data = nullptr;
1446  }
1447  }
1448  // Name bits loc expected value
1449  // descriptor_tag 8 0.0 0x7f extension
1450  // descriptor_length 8 1.0 9
1451  // descriptor_tag_extension 8 2.0 0x0D c2_delivery_system
1452 
1453  // plp_id 8 3.0
1454  uint PlpID(void) const
1455  {
1456  return m_data[3];
1457  }
1458 
1459  // data_slice_id 8 4.0
1460  uint DataSliceID(void) const
1461  {
1462  return m_data[4];
1463  }
1464 
1465  // C2_System_tuning_frequency 32 5.0
1466  uint Frequency(void) const
1467  {
1468  return ((m_data[5]<<24) | (m_data[6]<<16) |
1469  (m_data[7]<<8) | (m_data[8]));
1470  }
1471 
1472  //
1473  // TBD
1474  //
1475 
1476  QString toString(void) const override; // MPEGDescriptor
1477 };
1478 
1479 // DVB Bluebook A038 (Feb 2019) p 108
1481 {
1482  public:
1484  const unsigned char *data, int len = 300) :
1485  MPEGDescriptor(data, len, DescriptorID::extension)
1486  {
1488  {
1489  m_data = nullptr;
1490  }
1491  }
1492  // Name bits loc expected value
1493  // descriptor_tag 8 0.0 0x7f extension
1494  // descriptor_length 8 1.0
1495  // descriptor_tag_extension 8 2.0 0x17 s2x_delivery_system
1496 
1497  //
1498  // TBD
1499  //
1500 
1501  QString toString(void) const override; // MPEGDescriptor
1502 };
1503 
1504 // DVB Bluebook A038 (Sept 2011) p 58
1506 {
1507  public:
1508  explicit DSNGDescriptor(const unsigned char *data, int len = 300) :
1509  MPEGDescriptor(data, len, DescriptorID::dsng) { }
1510  // Name bits loc expected value
1511  // descriptor_tag 8 0.0 0x68
1512  // descriptor_length 8 1.0
1513  // for (i=0;i<N;i++) { byte 8 }
1514 };
1515 
1516 // DVB Bluebook A038 (Sept 2011) p 58
1518 {
1519  public:
1520  explicit ExtendedEventDescriptor(const unsigned char *data, int len = 300) :
1521  MPEGDescriptor(data, len, DescriptorID::extended_event) { }
1522  // Name bits loc expected value
1523  // descriptor_tag 8 0.0 0x4e
1524  // descriptor_length 8 1.0
1525 
1526  // descriptor_number 4 2.0
1527  uint DescriptorNumber(void) const { return m_data[2] >> 4; }
1528  // last_number 4 2.4
1529  uint LastNumber(void) const { return m_data[2] & 0xf; }
1530  // ISO_639_language_code 24 3.0
1531  int LanguageKey(void) const
1532  { return iso639_str3_to_key(&m_data[3]); }
1533  QString LanguageString(void) const
1534  { return iso639_key_to_str3(LanguageKey()); }
1535  int CanonicalLanguageKey(void) const
1536  { return iso639_key_to_canonical_key(LanguageKey()); }
1537  QString CanonicalLanguageString(void) const
1538  { return iso639_key_to_str3(CanonicalLanguageKey()); }
1539  // length_of_items 8 6.0
1540  uint LengthOfItems(void) const { return m_data[6]; }
1541  // for ( i=0;i<N;i++)
1542  // {
1543  // item_description_len 8 0.0+p
1544  // for (j=0;j<N;j++) { item_desc_char 8 }
1545  // item_length 8 1.0+p2
1546  // for (j=0;j<N;j++) { item_char 8 }
1547  // }
1548  QMap<QString,QString> Items(void) const;
1549  // text_length 8
1550  uint TextLength(void) const { return m_data[7 + LengthOfItems()]; }
1551  // for (i=0; i<N; i++) { text_char 8 }
1552  QString Text(void) const
1553  { return dvb_decode_text(&m_data[8 + LengthOfItems()], TextLength()); }
1554 
1555  // HACK beg -- Pro7Sat is missing encoding
1556  QString Text(const unsigned char *encoding_override,
1557  uint encoding_length) const
1558  {
1559  return dvb_decode_text(&m_data[8 + LengthOfItems()], TextLength(),
1560  encoding_override, encoding_length);
1561  }
1562  // HACK end -- Pro7Sat is missing encoding
1563 };
1564 
1565 // DVB Bluebook A038 (Sept 2011) p 60
1567 {
1568  public:
1569  explicit FrequencyListDescriptor(const unsigned char *data, int len = 300) :
1570  MPEGDescriptor(data, len, DescriptorID::frequency_list) { }
1571  // Name bits loc expected value
1572  // descriptor_tag 8 0.0 0x62
1573  // descriptor_length 8 1.0
1574 
1575  // reserved_future_use 6 2.0
1576  // coding_type 2 2.6
1577  enum
1578  {
1583  };
1584  uint CodingType(void) const { return m_data[2] & 0x3; }
1585  // for (i=0;I<N;i++)
1586  // {
1587  // centre_frequency 32
1588  // }
1589  uint FrequencyCount() const { return DescriptorLength()>>2; }
1590  unsigned long long Frequency(uint i) const
1591  {
1593  {
1594  return (((unsigned long long)m_data[i*4+3]<<24) |
1595  (m_data[i*4+4]<<16) |
1596  (m_data[i*4+5]<<8) |
1597  (m_data[i*4+6]));
1598  }
1599  return byte4BCD2int(m_data[i*4+3], m_data[i*4+4],
1600  m_data[i*4+5], m_data[i*4+6]);
1601  }
1602  unsigned long long FrequencyHz(uint i) const
1603  {
1604  return Frequency(i) *
1605  ((kCodingTypeTerrestrial == CodingType()) ? 10 : 100);
1606  }
1607 
1608  QString toString(void) const override; // MPEGDescriptor
1609 };
1610 
1611 // DVB Bluebook A038 (Sept 2011) p 70
1612 // ETSI EN 300 468 p 58
1614 {
1615  public:
1616  explicit LocalTimeOffsetDescriptor(const unsigned char *data, int len = 300) :
1617  MPEGDescriptor(data, len, DescriptorID::local_time_offset) { }
1618  // Name bits loc expected value
1619  // descriptor_tag 8 0.0 0x58
1620  // descriptor_length 8 1.0
1621  uint Count(void) const { return DescriptorLength() / 13; }
1622  // for(i=0;i<N;i++)
1623  // {
1624  // country_code 24 0.0+p
1626  {
1627  int o = 2 + i*13;
1628  return ((m_data[o] << 16) | (m_data[o+1] << 8) | m_data[o+2]);
1629  }
1630  QString CountryCodeString(uint i) const
1631  {
1632  int o = 2 + i*13;
1633  return QString(m_data[o]) + QChar(m_data[o+1]) + QChar(m_data[o+2]);
1634  }
1635  // country_region_id 6 3.0+p
1636  uint CountryRegionId(uint i) const { return m_data[2 + i*13 + 3] >> 2; }
1637  // reserved 1 3.6+p
1638  // local_time_off_polarity 1 3.7+p
1641  { return (m_data[2 + i*13 + 3] & 0x01) != 0; }
1642  // local_time_offset 16 4.0+p
1644  { return (m_data[2 + i*13 + 4] << 8) | m_data[2 + i*13 + 5]; }
1646  { return (LocalTimeOffsetPolarity(i) ? -1 : +1) * LocalTimeOffset(i); }
1647  // time_of_change 40 6.0+p
1648  // TODO decode this
1649  // next_time_offset 16 11.0+p
1651  { return (m_data[2 + i*13 + 11]<<8) | m_data[2 + i*13 + 12]; }
1652  // } 13.0
1653  QString toString(void) const override; // MPEGDescriptor
1654 };
1655 
1656 // DVB Bluebook A038 (Sept 2011) p 71
1658 {
1659  public:
1660  explicit MosaicDescriptor(const unsigned char *data, int len = 300) :
1661  MPEGDescriptor(data, len, DescriptorID::mosaic) { }
1662  // Name bits loc expected value
1663  // descriptor_tag 8 0.0 0x51
1664  // descriptor_length 8 1.0
1665 
1666  // mosaic_entry_point 1 2.0
1667  // num_horiz_elem_cells 3 2.1
1668  // reserved_future_use 1 2.4
1669  // num_vert_elem_cells 3 2.5
1670  // for (i=0;i<N; i++)
1671  // {
1672  // logical_cell_id 6 0.0+p
1673  // reserved_future_use 7 0.6+p
1674  // logical_cell_pres_info 3 1.5+p
1675  // elem_cell_field_len 8 2.0+p
1676  // for (i=0; j<elementary_cell_field_length; j++)
1677  // {
1678  // reserved_future_use 2
1679  // elementary_cell_id 6
1680  // }
1681  // cell_linkage_info 8
1682  // if (cell_linkage_info == 0x01)
1683  // {
1684  // bouquet_id 16
1685  // }
1686  // if (cell_linkage_info == 0x02)
1687  // {
1688  // original_network_id 16
1689  // transport_stream_id 16
1690  // service_id 16
1691  // }
1692  // if (cell_linkage_info == 0x03)
1693  // {
1694  // original_network_id 16
1695  // transport_stream_id 16
1696  // service_id 16
1697  // }
1698  // if (cell_linkage_info == 0x04)
1699  // {
1700  // original_network_id 16
1701  // transport_stream_id 16
1702  // service_id 16
1703  // event_id 16
1704  // }
1705  // }
1706 };
1707 
1708 // DVB Bluebook A038 (Sept 2011) p 74
1710 {
1711  public:
1713  const unsigned char *data, int len = 300) :
1714  MPEGDescriptor(data, len, DescriptorID::multilingual_bouquet_name) { }
1715  // Name bits loc expected value
1716  // descriptor_tag 8 0.0 0x5c
1717  // descriptor_length 8 1.0
1718 
1719  // for (i=0;i<N;i++)
1720  // {
1721  // ISO_639_language_code 24
1722  // bouquet_name_length 8
1723  // for (j=0;j<N;j++) { char 8 }
1724  // }
1725 };
1726 
1727 // DVB Bluebook A038 (Sept 2011) p 75
1729 {
1730  public:
1732  const unsigned char *data, int len = 300) :
1733  MPEGDescriptor(data, len, DescriptorID::multilingual_network_name) { }
1734  // Name bits loc expected value
1735  // descriptor_tag 8 0.0 0x5b
1736  // descriptor_length 8 1.0
1737 
1738  // for (i=0;i<N;i++)
1739  // {
1740  // ISO_639_language_code 24
1741  // network_name_length 8
1742  // for (j=0;j<N;j++) { char 8 }
1743  // }
1744 };
1745 
1746 // DVB Bluebook A038 (Sept 2011) p 76
1748 {
1749  public:
1751  const unsigned char *data, int len = 300) :
1752  MPEGDescriptor(data, len, DescriptorID::multilingual_service_name) { }
1753  // Name bits loc expected value
1754  // descriptor_tag 8 0.0 0x5d
1755  // descriptor_length 8 1.0
1756 
1757  // for (i=0;i<N;i++)
1758  // {
1759  // ISO_639_language_code 24
1760  // service_provider_name_length 8
1761  // for (j=0;j<N;j++) { char 8 }
1762  // service_name_length 8
1763  // for (j=0;j<N;j++) { char 8 }
1764  // }
1765 };
1766 
1767 // DVB Bluebook A038 (Sept 2011) p 76
1769 {
1770  public:
1771  explicit NVODReferenceDescriptor(const unsigned char *data, int len = 300) :
1772  MPEGDescriptor(data, len, DescriptorID::nvod_reference) { }
1773  // Name bits loc expected value
1774  // descriptor_tag 8 0.0 0x4b
1775  // descriptor_length 8 1.0
1776  uint Count(void) const { return DescriptorLength() / 6; }
1777 
1778  // for (i=0;i<N;i++)
1779  // {
1780  // transport_stream_id 16
1782  { return (m_data[i * 6 + 2] << 8) | m_data[i * 6 + 3]; }
1783  // original_network_id 16
1785  { return (m_data[i * 6 + 4] << 8) | m_data[i * 6 + 5]; }
1786  // service_id 16
1788  { return (m_data[i * 6 + 6] << 8) | m_data[i * 6 + 7]; }
1789  // }
1790  QString toString(void) const override; // MPEGDescriptor
1791 };
1792 
1793 // DVB Bluebook A038 (Sept 2011) p 78
1794 // ETSI EN 300 468
1796 {
1797  public:
1798  explicit ParentalRatingDescriptor(const unsigned char *data, int len = 300) :
1799  MPEGDescriptor(data, len, DescriptorID::parental_rating) { }
1800  // Name bits loc expected value
1801  // descriptor_tag 8 0.0 0x55
1802  // descriptor_length 8 1.0
1803  uint Count(void) const { return DescriptorLength() / 4; }
1804 
1805  // for (i=0; i<N; i++)
1806  // {
1807  // country_code 24
1808  // rating 8
1809  // }
1810  QString CountryCodeString(uint i) const
1811  {
1812  int o = 2 + i*4;
1813  if (i < Count())
1814  return QString(m_data[o]) + QChar(m_data[o+1]) + QChar(m_data[o+2]);
1815  return QString("");
1816  }
1817  int Rating(uint i) const
1818  {
1819  if (i >= Count())
1820  {
1821  return -1;
1822  }
1823 
1824  unsigned char rawRating = m_data[2 + 3 + i*4];
1825  if (rawRating == 0)
1826  {
1827  // 0x00 - undefined
1828  return -1;
1829  }
1830  if ((rawRating >= 0x01) && (rawRating <= 0x0F))
1831  {
1832  // 0x01 to 0x0F - minumum age = rating + 3 years
1833  return rawRating + 3;
1834  }
1835 
1836  // 0x10 to 0xFF - defined by the broadcaster
1837  return -1;
1838  }
1839 };
1840 
1841 // DVB Bluebook A038 (Sept 2011) p 78 (see also ETSI EN 300 231 PDC)
1843 {
1844  public:
1845  explicit PDCDescriptor(const unsigned char *data, int len = 300) :
1846  MPEGDescriptor(data, len, DescriptorID::pdc, 3) { }
1847  // Name bits loc expected value
1848  // descriptor_tag 8 0.0 0x69
1849  // descriptor_length 8 1.0
1850 
1851  // reserved_future_use 4 2.0
1852  // program_id_label 20 2.4
1853  uint ProgramIdLabel(void) const
1854  { return (m_data[2] & 0x0F) << 16 | m_data[3] << 8 | m_data[4]; }
1855  QString toString(void) const override // MPEGDescriptor
1856  {
1857  return QString("PDCDescriptor program_id_label(%1)")
1858  .arg(ProgramIdLabel());
1859  }
1860 };
1861 
1862 // DVB Bluebook A038 (Sept 2011) p 79 (see also ETSI TS 101 162)
1864 {
1865  public:
1866  explicit PrivateDataSpecifierDescriptor(const unsigned char *data, int len = 300) :
1867  MPEGDescriptor(data, len, DescriptorID::private_data_specifier) { }
1868  // Name bits loc expected value
1869  // descriptor_tag 8 0.0 0x5f
1870  // descriptor_length 8 1.0
1871 
1872  // private_data_specifier 32 2.0
1873  uint32_t PrivateDataSpecifier (void) const
1874  {
1875  return (m_data[2] << 24 | m_data[3] << 16 | m_data[4] << 8 | m_data[5]);
1876  }
1877 };
1878 
1879 // DVB Bluebook A038 (Sept 2011) p 79
1881 {
1882  public:
1883  explicit ScramblingDescriptor(const unsigned char *data, int len = 300) :
1884  MPEGDescriptor(data, len, DescriptorID::scrambling, 1) { }
1885  // Name bits loc expected value
1886  // descriptor_tag 8 0.0 0x65
1887  // descriptor_length 8 1.0
1888 
1889  // scrambling_mode 8 2.0
1890  uint ScramblingMode(void) const { return m_data[2]; }
1891  QString toString(void) const override // MPEGDescriptor
1892  {
1893  return QString("ScramblingDescriptor scrambling_mode(%1)")
1894  .arg(ScramblingMode());
1895  }
1896 };
1897 
1898 // DVB Bluebook A038 (Feb 2019) p 83, Table 89: Service type coding
1900 {
1901  public:
1902  explicit ServiceDescriptorMapping(const uint service_type) { m_serviceType = service_type; }
1903  enum
1904  {
1913  // reserved for future use = 0x09,
1922  // reserved for future use = 0x12 to 0x15
1934  // reserved for future use = 0x21 to 0x7F
1935  // user defined = 0x80 to 0xFE
1936  // reserved for future use = 0xFF
1937  // User Defined descriptors for Dish network
1951 
1952  };
1953  uint ServiceType(void) const { return m_serviceType; }
1954  bool IsDTV(void) const
1955  {
1956  return ((ServiceType() == kServiceTypeDigitalTelevision) ||
1958  IsHDTV() ||
1959  IsUHDTV() ||
1973  }
1974  bool IsDigitalAudio(void) const
1975  {
1976  return
1979  }
1980  bool IsHDTV(void) const
1981  {
1982  return
1986  }
1987  bool IsUHDTV(void) const
1988  {
1989  return
1992  }
1993  bool IsTeletext(void) const
1994  {
1996  }
1997  QString toString(void) const;
1998 
1999  private:
2001 };
2002 
2003 // DVB Bluebook A038 (Feb 2019) p 82
2005 {
2006  public:
2007  explicit ServiceDescriptor(const unsigned char *data, int len = 300) :
2008  MPEGDescriptor(data, len, DescriptorID::service) { }
2009  // Name bits loc expected value
2010  // descriptor_tag 8 0.0 0x48
2011  // descriptor_length 8 1.0
2012 
2013  // service_type 8 2.0
2014  uint ServiceType(void) const { return m_data[2]; }
2015  // svc_provider_name_len 8 3.0
2016  uint ServiceProviderNameLength(void) const { return m_data[3]; }
2017  // for (i=0;i<N;I++) { char 8 }
2018  QString ServiceProviderName(void) const
2020  QString ServiceProviderShortName(void) const
2021  {
2023  }
2024  // service_name_length 8
2026  { return m_data[4 + ServiceProviderNameLength()]; }
2027  // for (i=0;i<N;I++) { char 8 }
2028  QString ServiceName(void) const
2029  {
2031  ServiceNameLength());
2032  }
2033  QString ServiceShortName(void) const
2034  {
2036  ServiceNameLength());
2037  }
2038  bool IsDTV(void) const
2039  { return ServiceDescriptorMapping(ServiceType()).IsDTV(); }
2040  bool IsDigitalAudio(void) const
2042  bool IsHDTV(void) const
2044  bool IsTeletext(void) const
2046 
2047  QString toString(void) const override // MPEGDescriptor
2048  {
2049  return QString("ServiceDescriptor: %1 %2(0x%3)")
2050  .arg(ServiceName())
2052  .arg(ServiceType(),2,16,QChar('0'));
2053  }
2054 };
2055 
2056 // DVB Bluebook A038 (Feb 2019) p 84
2058 {
2059  public:
2060  explicit ServiceAvailabilityDescriptor(const unsigned char *data, int len = 300) :
2061  MPEGDescriptor(data, len, DescriptorID::service_availability) { }
2062  // Name bits loc expected value
2063  // descriptor_tag 8 0.0 0x72
2064  // descriptor_length 8 1.0
2065 
2066  // availability_flag 1 2.0
2067  // reserved 7 2.1
2068  // for (i=0;i<N;i++) { cell_id 16 }
2069 };
2070 
2071 // DVB Bluebook A038 (Feb 2019) p 84
2073 {
2074  public:
2075  explicit ServiceListDescriptor(const unsigned char *data, int len = 300) :
2076  MPEGDescriptor(data, len, DescriptorID::service_list) { }
2077  // Name bits loc expected value
2078  // descriptor_tag 8 0.0 0x41
2079  // descriptor_length 8 1.0
2080 
2081  // for (i=0;i<N;I++)
2082  // {
2083  // service_id 16 0.0+p
2084  // service_type 8 2.0+p
2085  // }
2086  uint ServiceCount(void) const { return DescriptorLength() / 3; }
2087 
2089  { return (m_data[2+i*3] << 8) | m_data[3+i*3]; }
2090 
2091  uint ServiceType(uint i) const { return m_data[4+i*3]; }
2092 
2093  QString toString(void) const override // MPEGDescriptor
2094  {
2095  QString str = QString("ServiceListDescriptor: %1 Services\n")
2096  .arg(ServiceCount());
2097  for (uint i=0; i<ServiceCount(); i++)
2098  {
2099  if (i!=0) str.append("\n");
2100  str.append(QString(" Service (%1) Type%2 (0x%3)")
2101  .arg(ServiceID(i))
2103  .arg(ServiceType(i),2,16,QChar('0')));
2104  }
2105  return str;
2106  }
2107 };
2108 
2109 // DVB Bluebook A038 (Sept 2011) p 82
2111 {
2112  public:
2113  explicit ServiceMoveDescriptor(const unsigned char *data, int len = 300) :
2114  MPEGDescriptor(data, len, DescriptorID::service_move) { }
2115  // Name bits loc expected value
2116  // descriptor_tag 8 0.0 0x60
2117  // descriptor_length 8 1.0
2118 
2119  // new_original_network_id 16 2.0
2120  // new_transport_stream_id 16 4.0
2121  // new_service_id 16 6.0
2122 };
2123 
2124 // DVB Bluebook A038 (Sept 2011) p 83
2126 {
2127  public:
2128  explicit ShortEventDescriptor(const unsigned char *data, int len = 300) :
2129  MPEGDescriptor(data, len, DescriptorID::short_event) { }
2130  // Name bits loc expected value
2131  // descriptor_tag 8 0.0 0x4d
2132  // descriptor_length 8 1.0
2133 
2134  // ISO_639_language_code 24 2.0
2135  int LanguageKey(void) const
2136  { return iso639_str3_to_key(&m_data[2]); }
2137  QString LanguageString(void) const
2138  { return iso639_key_to_str3(LanguageKey()); }
2139  int CanonicalLanguageKey(void) const
2141  QString CanonicalLanguageString(void) const
2143  // event_name_length 8 5.0
2144  uint EventNameLength(void) const { return m_data[5]; }
2145  // for (i=0;i<event_name_length;i++) { event_name_char 8 }
2146  QString EventName(void) const
2147  { return dvb_decode_text(&m_data[6], m_data[5]); }
2148  QString EventShortName(void) const
2149  { return dvb_decode_short_name(&m_data[6], m_data[5]); }
2150  // text_length 8
2151  uint TextLength(void) const { return m_data[6 + m_data[5]]; }
2152  // for (i=0;i<text_length;i++) { text_char 8 }
2153  QString Text(void) const
2154  { return dvb_decode_text(&m_data[7 + m_data[5]], TextLength()); }
2155 
2156  // HACK beg -- Pro7Sat is missing encoding
2157  QString EventName(const unsigned char *encoding_override,
2158  uint encoding_length) const
2159  {
2160  return dvb_decode_text(&m_data[6], m_data[5],
2161  encoding_override, encoding_length);
2162  }
2163 
2164  QString Text(const unsigned char *encoding_override,
2165  uint encoding_length) const
2166  {
2167  return dvb_decode_text(&m_data[7 + m_data[5]], TextLength(),
2168  encoding_override, encoding_length);
2169  }
2170  // HACK end -- Pro7Sat is missing encoding
2171 
2172  QString toString(void) const override // MPEGDescriptor
2173  { return LanguageString() + " : " + EventName() + " : " + Text(); }
2174 };
2175 
2176 // DVB Bluebook A038 (Sept 2011) p 84
2178 {
2179  public:
2180  explicit ShortSmoothingBufferDescriptor(const unsigned char *data, int len = 300) :
2181  MPEGDescriptor(data, len, DescriptorID::short_smoothing_buffer) { }
2182  // Name bits loc expected value
2183  // descriptor_tag 8 0.0 0x61
2184  // descriptor_length 8 1.0
2185 
2186  // sb_size 2 2.0
2187  // sb_leak_rate 6 2.2
2188  // for (i=0; i<N; i++)
2189  // { DVB_reserved 8 }
2190 };
2191 
2192 // DVB Bluebook A038 (Sept 2011) p 85
2196 {
2197  public:
2198  explicit StreamIdentifierDescriptor(const unsigned char *data, int len = 300) :
2199  MPEGDescriptor(data, len, DescriptorID::stream_identifier, 1) { }
2200  // Name bits loc expected value
2201  // descriptor_tag 8 0.0 0x52
2202  // descriptor_length 8 1.0 0x01
2203 
2204  // component_tag 8 2.0
2205  uint ComponentTag(void) const { return m_data[2]; }
2206  QString toString(void) const override // MPEGDescriptor
2207  {
2208  return QString("Stream Identifier Descriptor (0x52): ComponentTag=0x%1")
2209  .arg(ComponentTag(),1,16);
2210  }
2211 };
2212 
2213 // DVB Bluebook A038 (Sept 2011) p 86
2215 {
2216  public:
2217  explicit StuffingDescriptor(const unsigned char *data, int len = 300) :
2218  MPEGDescriptor(data, len, DescriptorID::dvb_stuffing) { }
2219  // Name bits loc expected value
2220  // descriptor_tag 8 0.0 0x42
2221  // descriptor_length 8 1.0
2222  // stuffing_byte * 2.0
2223  QString toString(void) const override // MPEGDescriptor
2224  {
2225  return QString("Stuffing Descriptor (0x42) length(%1)")
2226  .arg(DescriptorLength());
2227  }
2228 };
2229 
2230 // DVB Bluebook A038 (Sept 2011) p 86
2232 {
2233  public:
2234  explicit SubtitlingDescriptor(const unsigned char *data, int len = 300) :
2235  MPEGDescriptor(data, len, DescriptorID::subtitling) { }
2236  // Name bits loc expected value
2237  // descriptor_tag 8 0.0 0x59
2238  // descriptor_length 8 1.0
2239 
2240  uint StreamCount(void) const { return DescriptorLength() >> 3; }
2241  // for (i= 0;i<N;I++)
2242  // {
2243  // ISO_639_language_code 24 0.0+(i*8)
2244  int LanguageKey(uint i) const
2245  { return iso639_str3_to_key(&m_data[2 + (i<<3)]); }
2246  QString LanguageString(uint i) const
2247  { return iso639_key_to_str3(LanguageKey(i)); }
2252 
2253  // subtitling_type 8 3.0+(i*8)
2255  { return m_data[5 + (i<<3)]; }
2256  // composition_page_id 16 4.0+(i*8)
2258  { return (m_data[6 + (i<<3)] << 8) | m_data[7 + (i<<3)]; }
2259  // ancillary_page_id 16 6.0+(i*8)
2261  { return (m_data[8 + (i<<3)] << 8) | m_data[9 + (i<<3)]; }
2262  // } 8.0
2263 };
2264 
2265 // DVB Bluebook A038 (Sept 2011) p 87
2267 {
2268  public:
2269  explicit TelephoneDescriptor(const unsigned char *data, int len = 300) :
2270  MPEGDescriptor(data, len, DescriptorID::telephone) { }
2271  // Name bits loc expected value
2272  // descriptor_tag 8 0.0 0x57
2273  // descriptor_length 8 1.0
2274 
2275  // reserved_future_use 2 2.0
2276  // foreign_availability 1 2.2
2277  // connection_type 5 2.3
2278  // reserved_future_use 1 3.0
2279  // country_prefix_length 2 3.1
2280  // i18n_area_code_len 3 3.4
2281  // operator_code_length 2 3.6
2282  // reserved_future_use 1 3.7
2283  // national_area_code_len 3 4.0
2284  // core_number_length 4 4.4
2285  //
2286  // for (i=0; i<N; i++)
2287  // { country_prefix_char 8 }
2288  // for (i=0; i<N; i++)
2289  // { international_area_code_char 8 }
2290  // for (i=0; i<N; i++)
2291  // { operator_code_char 8 }
2292  // for (i=0; i<N; i++)
2293  // { national_area_code_char 8 }
2294  // for (i=0; i<N; i++)
2295  // { core_number_char 8 }
2296 };
2297 
2298 // DVB Bluebook A038 (Sept 2011) p 88
2300 {
2301  public:
2302  explicit TeletextDescriptor(const unsigned char *data, int len = 300) :
2303  MPEGDescriptor(data, len, DescriptorID::teletext) { }
2304  // Name bits loc expected value
2305  // descriptor_tag 8 0.0 0x56
2306  // descriptor_length 8 1.0
2307 
2308  uint StreamCount(void) const { return DescriptorLength() / 5; }
2309 
2310  // for (i=0; i<N; i++)
2311  // {
2312  // ISO_639_language_code 24 0.0
2313  int LanguageKey(uint i) const
2314  { return iso639_str3_to_key(&m_data[2 + (i*5)]); }
2315  QString LanguageString(uint i) const
2316  { return iso639_key_to_str3(LanguageKey(i)); }
2321  // teletext_type 5 3.0
2323  { return m_data[5 + (i*5)] >> 3; }
2324  // teletext_magazine_num 3 3.5
2326  { return m_data[5 + (i*5)] & 0x7; }
2327  // teletext_page_num 8 4.0
2329  { return m_data[6 + (i*5)]; }
2330  // } 5.0
2331  QString toString(void) const override; // MPEGDescriptor
2332 };
2333 
2334 // DVB Bluebook A038 (Sept 2011) p 89
2336 {
2337  public:
2338  explicit TimeShiftedEventDescriptor(const unsigned char *data, int len = 300) :
2339  MPEGDescriptor(data, len, DescriptorID::time_shifted_event) { }
2340  // Name bits loc expected value
2341  // descriptor_tag 8 0.0 0x4f
2342  // descriptor_length 8 1.0
2343 
2344  // reference_service_id 16 2.0
2345  // reference_event_id 16 4.0
2346 };
2347 
2348 // DVB Bluebook A038 (Sept 2011) p 90
2350 {
2351  public:
2352  explicit TimeShiftedServiceDescriptor(const unsigned char *data, int len = 300) :
2353  MPEGDescriptor(data, len, DescriptorID::dvb_time_shifted_service) { }
2354  // Name bits loc expected value
2355  // descriptor_tag 8 0.0 0x4c
2356  // descriptor_length 8 1.0
2357 
2358  // reference_service_id 16 2.0
2359 };
2360 
2361 // DVB Bluebook A038 (Sept 2011) p 90
2363 {
2364  public:
2365  explicit TransportStreamDescriptor(const unsigned char *data, int len = 300) :
2366  MPEGDescriptor(data, len, DescriptorID::transport_stream) { }
2367  // Name bits loc expected value
2368  // descriptor_tag 8 0.0 0x67
2369  // descriptor_length 8 1.0
2370 
2371  // for (i=0; i<N; i++) { byte 8 }
2372  QString Data(void) const
2373  { return dvb_decode_text(&m_data[2], DescriptorLength()); }
2374  QString toString(void) const override // MPEGDescriptor
2375  { return QString("TransportStreamDescriptor data(%1)").arg(Data()); }
2376 };
2377 
2378 // DVB Bluebook A038 (Sept 2011) p 91
2380 {
2381  public:
2382  explicit VBIDataDescriptor(const unsigned char *data, int len = 300) :
2383  MPEGDescriptor(data, len, DescriptorID::vbi_data) { }
2384  // Name bits loc expected value
2385  // descriptor_tag 8 0.0 0x45
2386  // descriptor_length 8 1.0
2387 
2388  // for (i=0; i<N; i++)
2389  // {
2390  // data_service_id 8 0.0+p
2391  // data_service_length 8 1.0+p
2392  // if ((data_service_id&0x7) && data_service_id!=0x3))
2393  // {
2394  // for (i=0; i<N; i++)
2395  // {
2396  // reserved 2 2.0+p2
2397  // field_parity 1 2.2+p2
2398  // line_offset 5 2.3+p2
2399  // }
2400  // }
2401  // else
2402  // {
2403  // for (i=0; i<N; i++) { reserved 8 }
2404  // }
2405  // }
2406 };
2407 
2408 // DVB Bluebook A038 (Sept 2011) p 92
2410 {
2411  public:
2412  explicit VBITeletextDescriptor(const unsigned char *data, int len = 300) :
2413  MPEGDescriptor(data, len, DescriptorID::vbi_teletext) { }
2414  // Name bits loc expected value
2415  // descriptor_tag 8 0.0 0x46
2416  // descriptor_length 8 1.0
2417 
2418  // for (i=0;i<N;i++)
2419  // {
2420  // ISO_639_language_code 24 0.0+p
2421  // teletext_type 5 3.0+p
2422  // teletext_magazine_num 3 3.5+p
2423  // teletext_page_num 8 4.0+p
2424  // } 5.0
2425 };
2426 
2427 // DVB Bluebook A038 (Sept 2011) p 119
2429 {
2430  public:
2431  explicit PartialTransportStreamDescriptor(const unsigned char *data, int len = 300) :
2432  MPEGDescriptor(data, len, DescriptorID::partial_transport_stream) { }
2433  // Name bits loc expected value
2434  // descriptor_tag 8 0.0 0x63
2435  // descriptor_length 8 1.0
2436 
2437  // DVB_reserved_future_use 2 2.0
2438  // peak_rate 22 2.2
2439  uint PeakRate(void) const
2440  { return (m_data[2] & 0x3f) << 16 | m_data[3] | m_data[4]; }
2441  // DVB_reserved_future_use 2 5.0
2442  // min_overall_smooth_rate 22 5.2
2443  uint SmoothRate(void) const
2444  { return (m_data[5] & 0x3f) << 16 | m_data[6] | m_data[7]; }
2445  // DVB_reserved_future_use 2 8.0
2446  // max_overall_smooth_buf 14 8.2
2447  uint SmoothBuf(void) const { return ((m_data[8] & 0x3f) << 8) | m_data[9]; }
2448  QString toString(void) const override; // MPEGDescriptor
2449 };
2450 
2451 
2452 // a_52a.pdf p125 Table A7 (for DVB)
2454 {
2455  public:
2456  explicit AC3Descriptor(const unsigned char *data, int len = 300) :
2457  MPEGDescriptor(data, len, DescriptorID::ac3) { }
2458  // Name bits loc expected value
2459  // descriptor_tag 8 0.0 0x6A
2460  // descriptor_length 8 1.0
2461 
2462  // component_type_flag 1 2.0
2463  bool HasComponentType(void) const { return ( m_data[2] & 0x80 ) != 0; }
2464  // bsid_flag 1 2.1
2465  bool HasBSID(void) const { return ( m_data[2] & 0x40 ) != 0; }
2466  // mainid_flag 1 2.2
2467  bool HasMainID(void) const { return ( m_data[2] & 0x20 ) != 0; }
2468  // asvc_flag 1 2.3
2469  bool HasASVC(void) const { return ( m_data[2] & 0x10 ) != 0; }
2470  // reserved_flags 4 2.4
2471  // if (component_type_flag == 1)
2472  // { component_type 8 uimsbf }
2473  uint ComponentType(void) const { return m_data[3]; }
2474  // if (bsid_flag == 1)
2475  // { bsid 8 uimsbf }
2476  uint BSID(void) const
2477  { return (HasComponentType()) ? m_data[4] : m_data[3]; }
2478  // if (mainid_flag == 1)
2479  // { mainid 8 uimsbf }
2480  uint MainID(void) const
2481  {
2482  int offset = 3;
2483  offset += (HasComponentType()) ? 1 : 0;
2484  offset += (HasBSID()) ? 1 : 0;
2485  return m_data[offset];
2486  }
2487  // if (asvc_flag==1)
2488  // { asvc 8 uimsbf }
2489  uint ASVC(void) const
2490  {
2491  int offset = 3;
2492  offset += (HasComponentType()) ? 1 : 0;
2493  offset += (HasBSID()) ? 1 : 0;
2494  offset += (HasMainID()) ? 1 : 0;
2495  return m_data[offset];
2496  }
2497  // for (I=0;I<N;I++)
2498  // { additional_info[i] N*8 uimsbf }
2499  //};
2500  QString toString(void) const override; // MPEGDescriptor
2501 };
2502 
2503 static QString coderate_inner(uint coderate)
2504 {
2505  switch (coderate)
2506  {
2507  case 0x0: return "auto"; // not actually defined in spec
2508  case 0x1: return "1/2";
2509  case 0x2: return "2/3";
2510  case 0x3: return "3/4";
2511  case 0x4: return "5/6";
2512  case 0x5: return "7/8";
2513  case 0x8: return "8/9";
2514  case 0xf: return "none";
2515  default: return "auto"; // not actually defined in spec
2516  }
2517 }
2518 
2528 {
2529  public:
2530  explicit DVBLogicalChannelDescriptor(const unsigned char *data, int len = 300) :
2531  MPEGDescriptor(data, len, PrivateDescriptorID::dvb_logical_channel_descriptor) { }
2532  // Name bits loc expected value
2533  // descriptor_tag 8 0.0 0x83
2534  // descriptor_length 8 1.0
2535 
2536  uint ChannelCount(void) const { return DescriptorLength() >> 2; }
2537 
2539  { return (m_data[2 + (i<<2)] << 8) | m_data[3 + (i<<2)]; }
2540 
2542  { return ((m_data[4 + (i<<2)] << 8) | m_data[5 + (i<<2)]) & 0x3ff; }
2543 
2544  QString toString(void) const override; // MPEGDescriptor
2545 };
2546 
2556 {
2557  public:
2558  explicit DVBSimulcastChannelDescriptor(const unsigned char *data, int len = 300) :
2559  MPEGDescriptor(data, len, PrivateDescriptorID::dvb_simulcast_channel_descriptor) { }
2560  // Name bits loc expected value
2561  // descriptor_tag 8 0.0 0x88
2562  // descriptor_length 8 1.0
2563 
2564  uint ChannelCount(void) const { return DescriptorLength() >> 2; }
2565 
2567  { return (m_data[2 + (i<<2)] << 8) | m_data[3 + (i<<2)]; }
2568 
2570  { return ((m_data[4 + (i<<2)] << 8) | m_data[5 + (i<<2)]) & 0x3ff; }
2571 
2572  QString toString(void) const override; // MPEGDescriptor
2573 };
2574 
2586 {
2587  public:
2588  explicit FreesatLCNDescriptor(const unsigned char *data, int len = 300) :
2589  MPEGDescriptor(data, len, PrivateDescriptorID::freesat_lcn_table)
2590  {
2592 
2593  const unsigned char *payload = &data[2];
2594 
2595  uint offset = 0;
2596  while ((offset + 5 < DescriptorLength()) &&
2597  (offset + 5 + payload[offset+4] <= DescriptorLength()))
2598  {
2599  m_entries.push_back(&payload[offset]);
2600  offset += 5 + payload[offset+4];
2601  }
2602  }
2603  // Name bits loc expected value
2604  // descriptor_tag 8 0.0 0xd3
2605  // descriptor_length 8 1.0
2606  // for (i=0;i<N;i++) {
2607  // service_id 16 0.0+p
2608  // chan_id 15 2.1+p
2609  // length 8 4.0+p
2610  // for (j=0;j<N;j++) {
2611  // unknown 4 0.0+p2
2612  // logical_channel_number 12 0.4+p2
2613  // region_id 16 2.0+p2
2614  // }
2615  // }
2616 
2617  uint ServiceCount(void) const
2618  { return m_entries.size(); }
2619 
2620  uint ServiceID(int i) const
2621  { return *m_entries[i] << 8 | *(m_entries[i]+1); }
2622 
2623  uint ChanID(int i) const
2624  { return (*(m_entries[i] + 2) << 8 | *(m_entries[i] + 3)) & 0x7FFF; }
2625 
2626  uint LCNCount(int i) const
2627  { return *(m_entries[i] + 4) / 4; }
2628 
2629  uint LogicalChannelNumber(int i, int j) const
2630  { return (*(m_entries[i] + 5 + j*4) << 8 | *(m_entries[i] + 5 + j*4 + 1)) & 0xFFF; }
2631 
2632  uint RegionID(int i, int j) const
2633  { return *(m_entries[i] + 5 + j*4 + 2) << 8 | *(m_entries[i] + 5 + j*4 + 3); }
2634 
2635  QString toString(void) const override; // MPEGDescriptor
2636 
2637  private:
2639 };
2640 
2651 {
2652  public:
2653  explicit FreesatRegionDescriptor(const unsigned char *data, int len = 300) :
2654  MPEGDescriptor(data, len, PrivateDescriptorID::freesat_region_table)
2655  {
2657 
2658  const unsigned char *payload = &data[2];
2659 
2660  uint offset = 0;
2661  while ((offset + 6 < DescriptorLength()) &&
2662  (offset + 6 + payload[offset+5] <= DescriptorLength()))
2663  {
2664  m_entries.push_back(&payload[offset]);
2665  offset += 6 + payload[offset+5];
2666  }
2667  }
2668  // Name bits loc expected value
2669  // descriptor_tag 8 0.0 0xd4
2670  // descriptor_length 8 1.0
2671  // for (i=0;i<N;i++) {
2672  // region_id 16 0.0+p
2673  // language_code 24 2.0+p eng
2674  // text_length 8 5.0+p
2675  // for (j=0;j<N;j++) {
2676  // text_char 8
2677  // }
2678  // }
2679 
2680  uint RegionCount(void) const
2681  { return m_entries.size(); }
2682 
2683  int RegionID(uint i) const
2684  { return *m_entries[i] << 8 | *(m_entries[i]+1); }
2685 
2686  QString Language(uint i) const
2687  { return QString::fromLatin1((char *) m_entries[i] + 2, 3); }
2688 
2689  QString RegionName(uint i) const
2690  { return QString::fromLatin1((char *) m_entries[i] + 6, *(m_entries[i] + 5)); }
2691 
2692  QString toString(void) const override; // MPEGDescriptor
2693 
2694  private:
2696 };
2697 
2706 {
2707  public:
2708  explicit FreesatCallsignDescriptor(const unsigned char *data, int len = 300) :
2709  MPEGDescriptor(data, len, PrivateDescriptorID::freesat_callsign)
2710  {
2712  }
2713 
2714  // Name bits loc expected value
2715  // descriptor_tag 8 0.0 0xd8
2716  // descriptor_length 8 1.0
2717 
2718  // ISO_639_language_code 24 2.0
2719  // callsign_length 8 5.0
2720  // for (j=0;j<N;j++) {
2721  // callsign_char 8
2722 
2723  QString Language(void) const
2724  { return QString::fromLatin1((char *) m_data +2, 3); }
2725 
2726  QString Callsign(void) const
2727  { return dvb_decode_short_name(&m_data[6], m_data[5]); }
2728 
2729  QString toString(void) const override; // MPEGDescriptor
2730 };
2731 
2744 {
2745  public:
2746  explicit SkyLCNDescriptor(const unsigned char *data, int len = 300) :
2747  MPEGDescriptor(data, len, PrivateDescriptorID::sky_lcn_table)
2748  {
2750  }
2751  // Name bits loc expected value
2752  // descriptor_tag 8 0.0 0xd3
2753  // descriptor_length 8 1.0
2754  // region_id 16 2.0
2755  // for (i=0;i<N;i++) {
2756  // service_id 16 0.0+p
2757  // service_type 8 2.0+p
2758  // unknown 16 3.0+p
2759  // logical_channel_number 16 5.0+p2
2760  // unknown 16 7.0+p2
2761  // }
2762 
2763  uint RegionID(void) const
2764  { return (*(m_data + 3) != 0xFF) ? *(m_data + 3) : 0xFFFF;}
2765 
2766  uint RegionRaw(void) const
2767  { return *(m_data + 2) << 8 | *(m_data + 3);}
2768 
2769  uint ServiceCount(void) const
2770  { return (DescriptorLength() - 2) / 9; }
2771 
2772  uint ServiceID(int i) const
2773  { return *(m_data + 4 + i*9) << 8 | *(m_data + 5 + i*9); }
2774 
2775  uint ServiceType(int i) const
2776  { return *(m_data + 6 + i*9); }
2777 
2778  uint ChannelID(int i) const
2779  { return *(m_data + 7 + i*9) << 8 | *(m_data + 8 + i*9); }
2780 
2782  { return *(m_data + 9 + i*9) << 8 | *(m_data + 10 + i*9); }
2783 
2784  uint Flags(int i) const
2785  { return *(m_data + 11 + i*9) << 8 | *(m_data + 12 + i*9); }
2786 
2787  QString toString(void) const override; // MPEGDescriptor
2788 };
2789 
2790 // Descriptor layout similar to SkyLCNDescriptor
2792 {
2793  public:
2794  OpenTVChannelListDescriptor(const unsigned char *data, int len = 300) :
2795  MPEGDescriptor(data, len, PrivateDescriptorID::opentv_channel_list) { }
2796  // Name bits loc expected value
2797  // descriptor_tag 8 0.0 0xB1
2798  // descriptor_length 8 1.0
2799 
2800  uint ChannelCount(void) const { return (DescriptorLength() - 2)/9; }
2801 
2802  uint RegionID() const
2803  { return (m_data[2] << 8) | m_data[3]; }
2804 
2806  { return (m_data[4 + 0 + (i*9)] << 8) | m_data[4 + 1 + (i*9)]; }
2807 
2809  { return m_data[4 + 2 + (i*9)]; }
2810 
2812  { return ((m_data[4 + 3 + (i*9)] << 8) | m_data[4 + 4 + (i*9)]); }
2813 
2815  { return ((m_data[4 + 5 + (i*9)] << 8) | m_data[4 + 6 + (i*9)]); }
2816 
2817  uint Flags(uint i) const
2818  { return ((m_data[4 + 7 + (i*9)] << 8) | m_data[4 + 8 + (i*9)]) & 0xf; }
2819 
2820  QString toString(void) const override; // MPEGDescriptor
2821 };
2822 
2823 // ETSI TS 102 323 (TV Anytime)
2825 {
2826  public:
2827  explicit DVBContentIdentifierDescriptor(const unsigned char *data, int len = 300) :
2828  MPEGDescriptor(data, len, DescriptorID::dvb_content_identifier)
2829  {
2830  size_t count = 0;
2831 
2832  memset ((void *) m_crid, 0, sizeof(m_crid));
2833 
2834  if (IsValid())
2835  {
2836  uint8_t position = 2;
2837  while (m_data[1] >= position)
2838  {
2839  size_t length = m_data[position+1];
2840  m_crid[count] = &m_data[position];
2841  count++;
2842  position+=length+2;
2843  }
2844  }
2845  m_cridCount = count;
2846  }
2847  // Name bits loc expected value
2848  // descriptor_tag 8 0.0 0x76
2849  // descriptor_length 8 1.0
2850 
2851  uint ContentType(size_t n=0) const { return m_crid[n][0] >> 2; }
2852 
2853  uint ContentEncoding(size_t n=0) const { return m_crid[n][0] & 0x03; }
2854 
2855  // A content identifier is a URI. It may contain UTF-8 encoded using %XX.
2856  QString ContentId(size_t n=0) const
2857  {
2858  int length = m_crid[n][1];
2859  int positionOfHash = length-1;
2860  while (positionOfHash >= 0) {
2861  if (m_crid[n][2 + positionOfHash] == '#') {
2862  length = positionOfHash; /* remove the hash and the following IMI */
2863  break;
2864  }
2865  positionOfHash--;
2866  }
2867  return QString::fromLatin1((const char *)&m_crid[n][2], length);
2868  }
2869 
2870  size_t CRIDCount() const
2871  {
2872  return m_cridCount;
2873  }
2874 
2875  private:
2876  size_t m_cridCount;
2877  const uint8_t *m_crid[8] {};
2878 };
2879 
2880 // ETSI TS 102 323 (TV Anytime)
2882 {
2883  public:
2884  explicit DefaultAuthorityDescriptor(const unsigned char *data, int len = 300) :
2885  MPEGDescriptor(data, len, DescriptorID::default_authority) { }
2886  // Name bits loc expected value
2887  // descriptor_tag 8 0.0 0x73
2888  // descriptor_length 8 1.0
2889 
2890  QString DefaultAuthority(void) const
2891  {
2892  return QString::fromLatin1((const char *)m_data+2, m_data[1]);
2893  }
2894 
2895  QString toString(void) const override // MPEGDescriptor
2896  {
2897  return QString("DefaultAuthorityDescriptor: Authority(%1)")
2898  .arg(DefaultAuthority());
2899  }
2900 };
2901 
2902 /*
2903  * private UPC Cablecom (Austria) episode descriptor for Horizon middleware
2904  */
2906 {
2907  public:
2908  explicit PrivateUPCCablecomEpisodeTitleDescriptor(const unsigned char *data, int len = 300) :
2909  MPEGDescriptor(data, len, PrivateDescriptorID::upc_event_episode_title) { }
2910  // Name bits loc expected value
2911  // descriptor_tag 8 0.0 0xa7
2912  // descriptor_length 8 1.0
2913 
2914  // ISO_639_language_code 24 2.0
2915  int LanguageKey(void) const
2916  {
2917  return iso639_str3_to_key(&m_data[2]);
2918  }
2919  QString LanguageString(void) const
2920  {
2921  return iso639_key_to_str3(LanguageKey());
2922  }
2923  int CanonicalLanguageKey(void) const
2924  {
2926  }
2927  QString CanonicalLanguageString(void) const
2928  {
2930  }
2931 
2932  uint TextLength(void) const
2933  {
2934  return m_data[1] - 3;
2935  }
2936 
2937  QString Text(void) const
2938  {
2939  return dvb_decode_text(&m_data[5], TextLength());
2940  }
2941 };
2942 
2943 #endif // DVB_DESCRIPTORS_H
uint SubcellInfoLoopLength(uint i) const
uint TransposerFrequency(uint i, uint j) const
uint ChanID(int i) const
uint LastDescriptorNumber(void) const
QString toString(void) const override
int CanonicalLanguageKey(void) const
bool IsTargetListed(void) const
bool HasASVC(void) const
uint Count(void) const
CellFrequencyLinkDescriptor(const unsigned char *data, int len=300)
ProgramInfo::CategoryType GetMythCategory(uint i) const
QString BouquetName(void) const
QString RegionName(uint i) const
ServiceRelocatedDescriptor(const unsigned char *data, int len=300)
ContentDescriptor(const unsigned char *data, int len=300)
QString LanguageString(void) const
DVB HD Simulcast Logical Channel Descriptor.
uint AncillaryPageID(uint i) const
QString CountryCodeString(void) const
MultilingualServiceNameDescriptor(const unsigned char *data, int len=300)
PrivateDataSpecifierDescriptor(const unsigned char *data, int len=300)
DVBLogicalChannelDescriptor(const unsigned char *data, int len=300)
int Rating(uint i) const
PDCDescriptor(const unsigned char *data, int len=300)
QString LanguageString(uint i) const
CAIdentifierDescriptor(const unsigned char *data, int len=300)
QString toString(void) const override
NVODReferenceDescriptor(const unsigned char *data, int len=300)
MultilingualBouquetNameDescriptor(const unsigned char *data, int len=300)
uint ServiceNameLength(void) const
DVBSimulcastChannelDescriptor(const unsigned char *data, int len=300)
BouquetNameDescriptor(const unsigned char *data, int len=300)
QString toString(void) const override
QString EventName(void) const
SkyLCNDescriptor(const unsigned char *data, int len=300)
uint OldTransportID(void) const
QString LanguageString(void) const
ShortEventDescriptor(const unsigned char *data, int len=300)
bool IsDTV(void) const
bool HasMobileNetworkID(void) const
unsigned char AVCProperties(void) const
bool HasComponentType(void) const
unsigned long long FrequencyHz(uint i) const
QString TransmissionModeString(void) const
int LanguageKey(void) const
QString GuardIntervalString(void) const
QString ServiceProviderName(void) const
unsigned char SubtitleType(void) const
static QMutex s_categoryLock
QString LanguageString(void) const
Freesat Region descriptor.
ScramblingDescriptor(const unsigned char *data, int len=300)
QString BouquetShortName(void) const
int LanguageKey(void) const
QString toString(void) const override
QString toString(void) const override
uint ProgramIdLabel(void) const
unsigned long long Frequency(uint i) const
unsigned char AC3Properties(void) const
QString toString(void) const override
uint MessageID(void) const
uint ChannelID(int i) const
uint ServiceCount(void) const
uint OldServiceID(void) const
int CASystemId(uint i) const
uint SubtitleType(uint i) const
uint TransmissionMode(void) const
uint UserNibble(uint i) const
uint DataBroadCastId(void) const
QString MobileOriginTypeString(void) const
QString Text(const unsigned char *encoding_override, uint encoding_length) const
uint ComponentTag(void) const
int CanonicalLanguageKey(void) const
TargetRegionNameDescriptor(const unsigned char *data, int len=300)
CellListDescriptor(const unsigned char *data, int len=300)
uint ComponentType(void) const
TeletextDescriptor(const unsigned char *data, int len=300)
unsigned char MPEG2Properties(void) const
This is used to label streams so the can be treated differently, for instance each stream may get it'...
uint CentreFrequency(uint i) const
QString LanguageString(void) const
DefaultAuthorityDescriptor(const unsigned char *data, int len=300)
QString CountryNames(void) const
MessageDescriptor(const unsigned char *data, int len=300)
bool IsUHDTV(void) const
QString toString(void) const override
QString FECInnerString(void) const
uint DescriptorTag(void) const
DVB Logical Channel Descriptor.
QString ContentId(size_t n=0) const
uint OrbitalPosition(void) const
orbital_position 16 6.0
QString EventName(const unsigned char *encoding_override, uint encoding_length) const
uint ServiceId(uint i) const
bool
Definition: pxsup2dast.c:30
QString Name(void) const
DSNGDescriptor(const unsigned char *data, int len=300)
ComponentDescriptor(const unsigned char *data, int len=300)
uint RegionID(void) const
unsigned char VideoProperties(void) const
uint PrivateDataLength(void) const
ServiceDescriptor(const unsigned char *data, int len=300)
PartialTransportStreamDescriptor(const unsigned char *data, int len=300)
QString toString(void) const override
static int iso639_str3_to_key(const unsigned char *iso639_2)
Definition: iso639.h:63
bool IsVerticalRightPolarization(void) const
const unsigned char * PrivateData(void) const
unsigned char MP2Properties(void) const
uint ServiceID(uint i) const
uint CentreFrequency(int i, int j) const
uint ChannelType(uint i) const
QString toString(void) const override
uint ScramblingMode(void) const
int iso639_key_to_canonical_key(int iso639_2)
Definition: iso639.cpp:120
ServiceDescriptorMapping(const uint service_type)
AnnouncementSupportDescriptor(const unsigned char *data, int len=300)
uint DataSliceID(void) const
uint ServiceType(uint i) const
bool IsSubtitle(void) const
QString toString(void) const override
QString toString(void) const override
CountryAvailabilityDescriptor(const unsigned char *data, int len=300)
uint ServiceID(uint i) const
TimeShiftedServiceDescriptor(const unsigned char *data, int len=300)
uint MainID(void) const
Freesat Channel Callsign descriptor.
uint OtherFrequencyFlag(void) const
uint CountryRegionId(uint i) const
QString Data(void) const
int LanguageKey(void) const
ServiceMoveDescriptor(const unsigned char *data, int len=300)
uint ServiceID(void) const
C2DeliverySystemDescriptor(const unsigned char *data, int len=300)
#define byte4BCD2int(i, j, k, l)
vector< const unsigned char * > m_cellPtrs
vector< const unsigned char * > desc_list_t
uint ServiceCount(void) const
StuffingDescriptor(const unsigned char *data, int len=300)
QString Message(void) const
QString Text(void) const
uint StreamCount(void) const
uint TransportStreamId(uint i) const
VBIDataDescriptor(const unsigned char *data, int len=300)
uint ChannelNumber(uint i) const
uint LogicalChannelNumber(int i, int j) const
QString toString(void) const override
QString ServiceProviderShortName(void) const
QString toString(void) const override
uint ASVC(void) const
QString toString(void) const override
uint EditorialClassification(void) const
const unsigned char * m_data
uint DescriptorNumber(void) const
QString toString(void) const override
uint ChannelID(uint i) const
uint RegionCount(void) const
QString toString(void) const override
QString LanguageString(void) const
QString toString(void) const override
S2XSatelliteDeliverySystemDescriptor(const unsigned char *data, int len=300)
SubtitlingDescriptor(const unsigned char *data, int len=300)
TerrestrialDeliverySystemDescriptor(const unsigned char *data, int len=300)
FreesatRegionDescriptor(const unsigned char *data, int len=300)
uint StreamCount(void) const
int LanguageKey(void) const
LocalTimeOffsetDescriptor(const unsigned char *data, int len=300)
static void Init(void)
#define MTV_PUBLIC
Definition: mythtvexp.h:15
uint Count(void) const
QString toString(void) const override
static int x2
Definition: mythsocket.cpp:61
uint TeletextType(uint i) const
bool IsTeletext(void) const
#define byte3BCD2int(i, j, k)
QString toString(void) const override
QString toString(void) const override
uint RegionRaw(void) const
QString toString(void) const override
QString Text(void) const
DVBContentIdentifierDescriptor(const unsigned char *data, int len=300)
uint ChannelNumber(uint i) const
bool IsVideo(void) const
FreesatLCNDescriptor(const unsigned char *data, int len=300)
uint SelectorLength(void) const
uint TextLength(void) const
QString toString(void) const
uint LengthOfItems(void) const
QString toString(void) const override
uint Flags(int i) const
MosaicDescriptor(const unsigned char *data, int len=300)
uint BandwidthHz(void) const
uint MobileNetworkID(void) const
static QString coderate_inner(uint coderate)
PrivateUPCCablecomEpisodeTitleDescriptor(const unsigned char *data, int len=300)
FreesatCallsignDescriptor(const unsigned char *data, int len=300)
VBITeletextDescriptor(const unsigned char *data, int len=300)
QString toString(void) const override
QString toString(void) const override
QString ModulationString(void) const
Freesat Logical Channel Number descriptor.
uint NextTimeOffset(uint i) const
DataBroadcastDescriptor(const unsigned char *data, int len=300)
AC3Descriptor(const unsigned char *data, int len=300)
QString ConstellationString(void) const
QString toString(void) const override
uint ServiceType(int i) const
uint EventNameLength(void) const
uint TSID(void) const
ExtendedEventDescriptor(const unsigned char *data, int len=300)
bool IsDigitalAudio(void) const
unsigned int uint
Definition: compat.h:140
bool IsHorizontalLeftPolarization(void) const
uint TextLength(void) const
uint TeletextPageNum(uint i) const
int LocalTimeOffsetWithPolarity(uint i) const
uint MobileInitialServiceID(void) const
int LanguageKey(uint i) const
TargetRegionDescriptor(const unsigned char *data, int len=300)
FrequencyListDescriptor(const unsigned char *data, int len=300)
QString GetDescription(uint i) const
uint UserNibble1(uint i) const
bool HasBSID(void) const
MultilingualNetworkNameDescriptor(const unsigned char *data, int len=300)
QString Callsign(void) const
uint ComponentTag(void) const
uint CountryCode(void) const
uint DataBroadcastId(void) const
AncillaryDataDescriptor(const unsigned char *data, int len=300)
QString CanonicalLanguageString(uint i) const
uint ServiceType(void) const
QString Language(uint i) const
QString ServiceShortName(void) const
bool IsDigitalAudio(void) const
int LanguageKey(uint i) const
static volatile bool s_categoryDescExists
TimeShiftedEventDescriptor(const unsigned char *data, int len=300)
uint DescriptorLength(void) const
uint CountryCode(void) const
#define byteBCDH2int(i)
uint DescriptorNumber(void) const
uint ServiceID(int i) const
QString Language(void) const
QString toString(void) const override
QString CountryCodeString(uint i) const
bool IsEast(void) const
west_east_flag 1 8.0
QString toString(void) const override
#define byte2BCD2int(i, j)
vector< const unsigned char * > m_subCellPtrs
AdaptationFieldDataDescriptor(const unsigned char *data, int len=300)
QString DefaultAuthority(void) const
uint Nibble2(uint i) const
ShortSmoothingBufferDescriptor(const unsigned char *data, int len=300)
QString CanonicalLanguageString(void) const
ImageIconDescriptor(const unsigned char *data, int len=300)
SatelliteDeliverySystemDescriptor(const unsigned char *data, int len=300)
QString toString(void) const override
QString toString(void) const override
QString Text(void) const
QString toString(void) const override
bool IsTeletext(void) const
uint TargetEventID(void) const
static QMap< uint, QString > s_categoryDesc
uint TeletextMagazineNum(uint i) const
uint OriginalNetworkId(uint i) const
static int x5
Definition: mythsocket.cpp:64
T2DeliverySystemDescriptor(const unsigned char *data, int len=300)
uint AncillaryDataID(void) const
QString EventShortName(void) const
bool LocalTimeOffsetPolarity(uint i) const
-1 if true, +1 if false (behind utc, ahead of utc, resp).
uint32_t PrivateDataSpecifier(void) const
uint ReservedFutureUse(void) const
bool IsEventSimulcast(void) const
uint CompositionPageID(uint i) const
NetworkNameDescriptor(const unsigned char *data, int len=300)
uint TextLength(void) const
uint RegionID(int i, int j) const
#define assert(x)
QString toString(void) const override
QString toString(void) const override
QString SisoMisoString(void) const
bool HasMobileInitialServiceID(void) const
QString TransmissionModeString(void) const
QString MobileHandOverTypeString(void) const
uint LastNumber(void) const
QString toString(void) const override
QString CountryCodeString(void) const
uint OriginalNetworkID() const
QString toString(void) const override
uint DescriptorTagExtension(void) const
QString FECOuterString(void) const
QString LanguageString(void) const
uint IconID(void) const
QString toString(void) const override
QString toString(void) const override
uint ContentType(size_t n=0) const
QString FECInnerString(void) const
uint Nibble(uint i) const
TransportStreamDescriptor(const unsigned char *data, int len=300)
unsigned long long FrequencyHz(void) const
uint UserNibble2(uint i) const
bool HasMainID(void) const
QString LinkageTypeString(void) const
int CanonicalLanguageKey(void) const
uint ServiceID(int i) const
uint FrequencyLoopLength(uint i) const
QString CountryCodeString(uint i) const
Sky Logical Channel Number descriptor.
SHDeliverySystemDescriptor(const unsigned char *data, int len=300)
NetworkChangeNotifyDescriptor(const unsigned char *data, int len=300)
QString ShortName(void) const
uint CellIDExtension(uint i, uint j) const
uint ServiceProviderNameLength(void) const
QString toString(void) const override
int CanonicalLanguageKey(uint i) const
int LanguageKey(void) const
QString CanonicalLanguageString(uint i) const
OpenTVChannelListDescriptor(const unsigned char *data, int len=300)
QString LanguageString(uint i) const
uint ContentEncoding(size_t n=0) const
uint GuardInterval(void) const
uint OldOriginalNetworkID(void) const
QString ModulationSystemString(void) const
QString CanonicalLanguageString(void) const
uint CellID(uint i) const
QString toString(void) const override
static QString iso639_key_to_str3(int code)
Definition: iso639.h:46
uint MobileOriginType(void) const
QString toString(void) const override
uint LCNCount(int i) const
int RegionID(uint i) const
QString toString(void) const override
MTV_PUBLIC QString dvb_decode_text(const unsigned char *src, uint length, const unsigned char *encoding_override, uint encoding_override_length)
bool IsValid(void) const
const unsigned char * Selector(void) const
bool IsAudio(void) const
QString toString(void) const override
QString CanonicalLanguageString(void) const
unsigned char HEVCProperties(void) const
uint ServiceID(uint i) const
QString dvb_decode_short_name(const unsigned char *src, uint raw_length)
unsigned long long FrequencykHz(void) const
uint BSID(void) const
DataBroadcastIdDescriptor(const unsigned char *data, int len=300)
int CanonicalLanguageKey(uint i) const
uint ServiceType(void) const
QString Text(const unsigned char *encoding_override, uint encoding_length) const
unsigned char HEAACProperties(void) const
QString ModulationString(void) const
TelephoneDescriptor(const unsigned char *data, int len=300)
uint ComponentType(void) const
uint StreamContent(void) const
uint DataComponentTag(void) const
ServiceAvailabilityDescriptor(const unsigned char *data, int len=300)
ServiceListDescriptor(const unsigned char *data, int len=300)
uint LogicalChannelNumber(int i) const
uint LinkageType(void) const
int CanonicalLanguageKey(void) const
QString toString(void) const override
uint ServiceCount(void) const
QString toString(void) const override
QString toString(void) const override
uint MobileHandOverType(void) const
uint ChannelNumber(uint i) const
static int x3
Definition: mythsocket.cpp:62
ParentalRatingDescriptor(const unsigned char *data, int len=300)
unsigned char AudioProperties(void) const
uint AdaptationFieldDataID(void) const
LinkageDescriptor(const unsigned char *data, int len=300)
uint LanguageCodePresent(void) const
uint CountryCode(uint i) const
uint CASystemCount(void) const
uint CodingType(void) const
QString OrbitalPositionString(void) const
uint LocalTimeOffset(uint i) const
uint Nibble1(uint i) const
QString CanonicalLanguageString(void) const
QString toString(void) const override
QString BandwidthString(void) const
QString ServiceName(void) const
bool IsHDTV(void) const
static int x1
Definition: mythsocket.cpp:60
CableDeliverySystemDescriptor(const unsigned char *data, int len=300)
StreamIdentifierDescriptor(const unsigned char *data, int len=300)
QString LanguageString(void) const
SupplementaryAudioDescriptor(const unsigned char *data, int len=300)
uint FrequencyRaw(void) const
frequency 32 2.0