MythTV  master
dvbdescriptors.cpp
Go to the documentation of this file.
1 // C headers
2 #include <unistd.h>
3 #include <algorithm>
4 
5 // Qt headers
6 #include <QTextCodec>
7 #include <QCoreApplication>
8 
9 // MythTV headers
10 #include "dvbdescriptors.h"
11 #include "iso6937tables.h"
12 #include "freesat_huffman.h"
13 #include "mythlogging.h"
14 #include "programinfo.h"
15 
16 
17 static QString decode_iso6937(const unsigned char *buf, uint length)
18 {
19  // ISO/IEC 6937 to unicode (UCS2) convertor...
20  // This is a composed encoding - accent first then plain character
21  QString result = "";
22  ushort ch = 0x20;
23  for (uint i = 0; (i < length) && buf[i]; i++)
24  {
25  if (ch == 0xFFFF)
26  {
27  // Process second byte of two byte character
28  ch = iso6937table_secondary[buf[i-1]][buf[i]];
29  if (ch == 0xFFFF)
30  {
31  // If no valid code found in secondary table,
32  // reprocess this second byte as first byte.
33  ch = iso6937table_base[buf[i]];
34  if (ch == 0xFFFF)
35  continue; // process second byte
36  }
37  }
38  else
39  {
40  // Process first character of two possible characters.
41  // double byte characters have a sentinel (0xffff) in this table.
42  ch = iso6937table_base[buf[i]];
43  if (ch == 0xFFFF)
44  continue; // process second byte
45 
46  }
47  result += QChar(ch);
48  }
49  return result;
50 }
51 
52 static QString decode_text(const unsigned char *buf, uint length);
53 
54 // Decode a text string according to ETSI EN 300 468 Annex A
55 QString dvb_decode_text(const unsigned char *src, uint raw_length,
56  const unsigned char *encoding_override,
57  uint encoding_override_length)
58 {
59  if (!raw_length)
60  return "";
61 
62  if (src[0] == 0x1f)
63  return freesat_huffman_to_string(src, raw_length);
64 
65  /* UCS-2 aka ISO/IEC 10646-1 Basic Multilingual Plane */
66  if (src[0] == 0x11)
67  {
68  size_t length = (raw_length - 1) / 2;
69  QChar *to = new QChar[length];
70  for (size_t i=0; i<length; i++)
71  to[i] = (src[1 + i*2] << 8) + src[1 + i*2 + 1];
72  QString to2(to, length);
73  delete [] to;
74  return to2;
75  }
76 
77  if (((0x11 < src[0]) && (src[0] < 0x15)) ||
78  ((0x15 < src[0]) && (src[0] < 0x1f)))
79  {
80  // TODO: Handle multi-byte encodings
81  LOG(VB_SIPARSER, LOG_ERR,
82  "dvb_decode_text: Multi-byte coded text is not yet supported.");
83  return "";
84  }
85 
86  // if a override encoding is specified and the default ISO 6937 encoding
87  // would be used copy the override encoding in front of the text
88  unsigned char *dst =
89  new unsigned char[raw_length + encoding_override_length];
90 
91  uint length = 0;
92  if (encoding_override && src[0] >= 0x20) {
93  memcpy(dst, encoding_override, encoding_override_length);
94  length = encoding_override_length;
95  }
96 
97  // Strip formatting characters
98  for (uint i = 0; i < raw_length; i++)
99  {
100  if ((src[i] < 0x80) || (src[i] > 0x9F))
101  dst[length++] = src[i];
102  // replace CR/LF with a space
103  else if (src[i] == 0x8A)
104  dst[length++] = 0x20;
105  }
106 
107  // Exit on empty string, sans formatting.
108 
109  QString sStr = (!length) ? "" : decode_text(dst, length);
110 
111  delete [] dst;
112 
113  return sStr;
114 }
115 
116 static QString decode_text(const unsigned char *buf, uint length)
117 {
118  // Only some of the QTextCodec calls are reentrant.
119  // If you use this please verify that you are using a reentrant call.
120  static const QTextCodec *iso8859_codecs[16] =
121  {
122  QTextCodec::codecForName("Latin1"),
123  QTextCodec::codecForName("ISO8859-1"), // Western
124  QTextCodec::codecForName("ISO8859-2"), // Central European
125  QTextCodec::codecForName("ISO8859-3"), // Central European
126  QTextCodec::codecForName("ISO8859-4"), // Baltic
127  QTextCodec::codecForName("ISO8859-5"), // Cyrillic
128  QTextCodec::codecForName("ISO8859-6"), // Arabic
129  QTextCodec::codecForName("ISO8859-7"), // Greek
130  QTextCodec::codecForName("ISO8859-8"), // Hebrew, visually ordered
131  QTextCodec::codecForName("ISO8859-9"), // Turkish
132  QTextCodec::codecForName("ISO8859-10"),
133  QTextCodec::codecForName("ISO8859-11"),
134  QTextCodec::codecForName("ISO8859-12"),
135  QTextCodec::codecForName("ISO8859-13"),
136  QTextCodec::codecForName("ISO8859-14"),
137  QTextCodec::codecForName("ISO8859-15"), // Western
138  };
139 
140  // Decode using the correct text codec
141  if (buf[0] >= 0x20)
142  {
143  return decode_iso6937(buf, length);
144  }
145  if ((buf[0] >= 0x01) && (buf[0] <= 0x0B))
146  {
147  return iso8859_codecs[4 + buf[0]]->toUnicode((char*)(buf + 1), length - 1);
148  }
149  if (buf[0] == 0x10)
150  {
151  // If the first byte of the text field has a value "0x10"
152  // then the following two bytes carry a 16-bit value (uimsbf) N
153  // to indicate that the remaining data of the text field is
154  // coded using the character code table specified by
155  // ISO Standard 8859, parts 1 to 9
156 
157  uint code = buf[1] << 8 | buf[2];
158  if (code <= 15)
159  return iso8859_codecs[code]->toUnicode((char*)(buf + 3), length - 3);
160  return QString::fromLocal8Bit((char*)(buf + 3), length - 3);
161  }
162  if (buf[0] == 0x15) // Already Unicode
163  {
164  return QString::fromUtf8((char*)(buf + 1), length - 1);
165  }
166 
167  // Unknown/invalid encoding - assume local8Bit
168  return QString::fromLocal8Bit((char*)(buf + 1), length - 1);
169 }
170 
171 
172 QString dvb_decode_short_name(const unsigned char *src, uint raw_length)
173 {
174  if (raw_length > 50)
175  {
176  LOG(VB_SIPARSER, LOG_WARNING,
177  QString("dvb_decode_short_name: name is %1 chars "
178  "long. Unlikely to be a short name.")
179  .arg(raw_length));
180  return "";
181  }
182 
183  if (((0x10 < src[0]) && (src[0] < 0x15)) ||
184  ((0x15 < src[0]) && (src[0] < 0x20)))
185  {
186  // TODO: Handle multi-byte encodings
187  LOG(VB_SIPARSER, LOG_ERR, "dvb_decode_short_name: "
188  "Multi-byte coded text is not yet supported.");
189  return "";
190  }
191 
192  unsigned char *dst = new unsigned char[raw_length];
193  uint length = 0;
194 
195  // check for emphasis control codes
196  for (uint i = 0; i < raw_length; i++)
197  if (src[i] == 0x86)
198  while ((++i < raw_length) && (src[i] != 0x87))
199  {
200  if ((src[i] < 0x80) || (src[i] > 0x9F))
201  dst[length++] = src[i];
202  // replace CR/LF with a space
203  else if (src[i] == 0x8A)
204  dst[length++] = 0x20;
205  }
206 
207  QString sStr = (!length) ? dvb_decode_text(src, raw_length)
208  : decode_text(dst, length);
209 
210  delete [] dst;
211 
212  return sStr;
213 }
214 
216 QMap<uint,QString> ContentDescriptor::categoryDesc;
217 volatile bool ContentDescriptor::categoryDescExists = false;
218 
220 {
221  if (0x1 == Nibble1(i))
223  if (0x4 == Nibble1(i))
226 }
227 
228 const char *linkage_types[] =
229 {
230  "Reserved(0x00)",
231  "Information Service",
232  "EPG Service",
233  "CA Replacement Service",
234  "TS Containing Complete Network/Bouquet SI",
235  "Service Replacement Service",
236  "Data Broadcast Service",
237  "RCS Map",
238  "Mobile Hand-Over",
239  "System Software Update Service",
240  "TS Containing SSU, BAT or NIT",
241  "IP/MAC Notification Service",
242  "TS Containing INT, BAT or NIT",
243  "Event Linkage",
244 };
245 
246 
248 {
249  if (LinkageType() < (sizeof(linkage_types) / sizeof(const char*)))
250  return QString(linkage_types[LinkageType()]);
251  if ((LinkageType() <= 0x7f) || (LinkageType() == 0x7f))
252  return QString("Reserved(0x%1)").arg(LinkageType(),2,16,QChar('0'));
253  return QString("User Defined(0x%1)").arg(LinkageType(),2,16,QChar('0'));
254 }
255 
257 {
259  return "Hand-Over to an Identical Service";
261  return "Hand-Over to a Local Variation";
263  return "Hand-over to an Associated Service";
264  return "Reserved";
265 }
266 
268 {
269  if (!categoryDescExists)
270  Init();
271 
272  QMutexLocker locker(&categoryLock);
273 
274  // Try to get detailed description
275  QMap<uint,QString>::const_iterator it = categoryDesc.find(Nibble(i));
276  if (it != categoryDesc.end())
277  return *it;
278 
279  // Fall back to category description
280  it = categoryDesc.find(Nibble1(i)<<4);
281  if (it != categoryDesc.end())
282  return *it;
283 
284  // Found nothing? Just return empty string.
285  return "";
286 }
287 
289 {
290  QString tmp("ContentDescriptor: ");
291  for (uint i = 0; i < Count(); i++)
293  return tmp;
294 }
295 
297 {
298  QMutexLocker locker(&categoryLock);
299 
300  if (categoryDescExists)
301  return;
302 
303  //: %1 is the main category, %2 is the subcategory
304  QString subCatStr = QCoreApplication::translate("(Categories)",
305  "%1 - %2", "Category with subcategory display");
306 
307  categoryDesc[0x10] = QCoreApplication::translate("(Categories)", "Movie");
308  categoryDesc[0x11] = subCatStr
309  .arg(QCoreApplication::translate("(Categories)", "Movie"))
310  .arg(QCoreApplication::translate("(Categories)", "Detective/Thriller"));
311  categoryDesc[0x12] = subCatStr
312  .arg(QCoreApplication::translate("(Categories)", "Movie"))
313  .arg(QCoreApplication::translate("(Categories)",
314  "Adventure/Western/War"));
315  categoryDesc[0x13] = subCatStr
316  .arg(QCoreApplication::translate("(Categories)", "Movie"))
317  .arg(QCoreApplication::translate("(Categories)",
318  "Science Fiction/Fantasy/Horror"));
319  categoryDesc[0x14] = subCatStr
320  .arg(QCoreApplication::translate("(Categories)", "Movie"))
321  .arg(QCoreApplication::translate("(Categories)", "Comedy"));
322  categoryDesc[0x15] = subCatStr
323  .arg(QCoreApplication::translate("(Categories)", "Movie"))
324  .arg(QCoreApplication::translate("(Categories)",
325  "Soap/melodrama/folkloric"));
326  categoryDesc[0x16] = subCatStr
327  .arg(QCoreApplication::translate("(Categories)", "Movie"))
328  .arg(QCoreApplication::translate("(Categories)", "Romance"));
329  categoryDesc[0x17] = subCatStr
330  .arg(QCoreApplication::translate("(Categories)","Movie"))
331  .arg(QCoreApplication::translate("(Categories)",
332  "Serious/Classical/Religious/Historical Movie/Drama"));
333  categoryDesc[0x18] = subCatStr
334  .arg(QCoreApplication::translate("(Categories)","Movie"))
335  .arg(QCoreApplication::translate("(Categories)", "Adult",
336  "Adult Movie"));
337 
338  categoryDesc[0x20] = QCoreApplication::translate("(Categories)", "News");
339  categoryDesc[0x21] = QCoreApplication::translate("(Categories)",
340  "News/weather report");
341  categoryDesc[0x22] = QCoreApplication::translate("(Categories)",
342  "News magazine");
343  categoryDesc[0x23] = QCoreApplication::translate("(Categories)",
344  "Documentary");
345  categoryDesc[0x24] = QCoreApplication::translate("(Categories)",
346  "Intelligent Programs");
347 
348  categoryDesc[0x30] = QCoreApplication::translate("(Categories)",
349  "Entertainment");
350  categoryDesc[0x31] = QCoreApplication::translate("(Categories)",
351  "Game Show");
352  categoryDesc[0x32] = QCoreApplication::translate("(Categories)",
353  "Variety Show");
354  categoryDesc[0x33] = QCoreApplication::translate("(Categories)",
355  "Talk Show");
356 
357  categoryDesc[0x40] = QCoreApplication::translate("(Categories)",
358  "Sports");
359  categoryDesc[0x41] = QCoreApplication::translate("(Categories)",
360  "Special Events (World Cup, World Series, etc)");
361  categoryDesc[0x42] = QCoreApplication::translate("(Categories)",
362  "Sports Magazines");
363  categoryDesc[0x43] = QCoreApplication::translate("(Categories)",
364  "Football (Soccer)");
365  categoryDesc[0x44] = QCoreApplication::translate("(Categories)",
366  "Tennis/Squash");
367  categoryDesc[0x45] = QCoreApplication::translate("(Categories)",
368  "Misc. Team Sports");
369  // not football/soccer
370  categoryDesc[0x46] = QCoreApplication::translate("(Categories)",
371  "Athletics");
372  categoryDesc[0x47] = QCoreApplication::translate("(Categories)",
373  "Motor Sport");
374  categoryDesc[0x48] = QCoreApplication::translate("(Categories)",
375  "Water Sport");
376  categoryDesc[0x49] = QCoreApplication::translate("(Categories)",
377  "Winter Sports");
378  categoryDesc[0x4A] = QCoreApplication::translate("(Categories)",
379  "Equestrian");
380  categoryDesc[0x4B] = QCoreApplication::translate("(Categories)",
381  "Martial Sports");
382 
383  categoryDesc[0x50] = QCoreApplication::translate("(Categories)", "Kids");
384  categoryDesc[0x51] = QCoreApplication::translate("(Categories)",
385  "Pre-School Children's Programs");
386  categoryDesc[0x52] = QCoreApplication::translate("(Categories)",
387  "Entertainment Programs for 6 to 14");
388  categoryDesc[0x53] = QCoreApplication::translate("(Categories)",
389  "Entertainment Programs for 10 to 16");
390  categoryDesc[0x54] = QCoreApplication::translate("(Categories)",
391  "Informational/Educational");
392  categoryDesc[0x55] = QCoreApplication::translate("(Categories)",
393  "Cartoons/Puppets");
394 
395  categoryDesc[0x60] = QCoreApplication::translate("(Categories)",
396  "Music/Ballet/Dance");
397  categoryDesc[0x61] = QCoreApplication::translate("(Categories)",
398  "Rock/Pop");
399  categoryDesc[0x62] = QCoreApplication::translate("(Categories)",
400  "Classical Music");
401  categoryDesc[0x63] = QCoreApplication::translate("(Categories)",
402  "Folk Music");
403  categoryDesc[0x64] = QCoreApplication::translate("(Categories)",
404  "Jazz");
405  categoryDesc[0x65] = QCoreApplication::translate("(Categories)",
406  "Musical/Opera");
407  categoryDesc[0x66] = QCoreApplication::translate("(Categories)",
408  "Ballet");
409 
410  categoryDesc[0x70] = QCoreApplication::translate("(Categories)",
411  "Arts/Culture");
412  categoryDesc[0x71] = QCoreApplication::translate("(Categories)",
413  "Performing Arts");
414  categoryDesc[0x72] = QCoreApplication::translate("(Categories)",
415  "Fine Arts");
416  categoryDesc[0x73] = QCoreApplication::translate("(Categories)",
417  "Religion");
418  categoryDesc[0x74] = QCoreApplication::translate("(Categories)",
419  "Popular Culture/Traditional Arts");
420  categoryDesc[0x75] = QCoreApplication::translate("(Categories)",
421  "Literature");
422  categoryDesc[0x76] = QCoreApplication::translate("(Categories)",
423  "Film/Cinema");
424  categoryDesc[0x77] = QCoreApplication::translate("(Categories)",
425  "Experimental Film/Video");
426  categoryDesc[0x78] = QCoreApplication::translate("(Categories)",
427  "Broadcasting/Press");
428  categoryDesc[0x79] = QCoreApplication::translate("(Categories)",
429  "New Media");
430  categoryDesc[0x7A] = QCoreApplication::translate("(Categories)",
431  "Arts/Culture Magazines");
432  categoryDesc[0x7B] = QCoreApplication::translate("(Categories)", "Fashion");
433 
434  categoryDesc[0x80] = QCoreApplication::translate("(Categories)",
435  "Social/Policical/Economics");
436  categoryDesc[0x81] = QCoreApplication::translate("(Categories)",
437  "Magazines/Reports/Documentary");
438  categoryDesc[0x82] = QCoreApplication::translate("(Categories)",
439  "Economics/Social Advisory");
440  categoryDesc[0x83] = QCoreApplication::translate("(Categories)",
441  "Remarkable People");
442 
443  categoryDesc[0x90] = QCoreApplication::translate("(Categories)",
444  "Education/Science/Factual");
445  categoryDesc[0x91] = QCoreApplication::translate("(Categories)",
446  "Nature/animals/Environment");
447  categoryDesc[0x92] = QCoreApplication::translate("(Categories)",
448  "Technology/Natural Sciences");
449  categoryDesc[0x93] = QCoreApplication::translate("(Categories)",
450  "Medicine/Physiology/Psychology");
451  categoryDesc[0x94] = QCoreApplication::translate("(Categories)",
452  "Foreign Countries/Expeditions");
453  categoryDesc[0x95] = QCoreApplication::translate("(Categories)",
454  "Social/Spiritual Sciences");
455  categoryDesc[0x96] = QCoreApplication::translate("(Categories)",
456  "Further Education");
457  categoryDesc[0x97] = QCoreApplication::translate("(Categories)",
458  "Languages");
459 
460  categoryDesc[0xA0] = QCoreApplication::translate("(Categories)",
461  "Leisure/Hobbies");
462  categoryDesc[0xA1] = QCoreApplication::translate("(Categories)",
463  "Tourism/Travel");
464  categoryDesc[0xA2] = QCoreApplication::translate("(Categories)",
465  "Handicraft");
466  categoryDesc[0xA3] = QCoreApplication::translate("(Categories)",
467  "Motoring");
468  categoryDesc[0xA4] = QCoreApplication::translate("(Categories)",
469  "Fitness & Health");
470  categoryDesc[0xA5] = QCoreApplication::translate("(Categories)", "Cooking");
471  categoryDesc[0xA6] = QCoreApplication::translate("(Categories)",
472  "Advertizement/Shopping");
473  categoryDesc[0xA7] = QCoreApplication::translate("(Categories)",
474  "Gardening");
475  // Special
476  categoryDesc[0xB0] = QCoreApplication::translate("(Categories)",
477  "Original Language");
478  categoryDesc[0xB1] = QCoreApplication::translate("(Categories)",
479  "Black & White");
480  categoryDesc[0xB2] = QCoreApplication::translate("(Categories)",
481  "\"Unpublished\" Programs");
482  categoryDesc[0xB3] = QCoreApplication::translate("(Categories)",
483  "Live Broadcast");
484  // UK Freeview custom id
485  categoryDesc[0xF0] = QCoreApplication::translate("(Categories)",
486  "Drama");
487 
488  categoryDescExists = true;
489 }
490 
492 {
493  QString str = "FrequencyListDescriptor: frequencies: ";
494 
495  for (uint i = 0; i < FrequencyCount(); i++)
496  str.append(QString(" %1").arg(FrequencyHz(i)));
497 
498  return str;
499 }
500 
502 {
503  QString str = "";
504 
505  if (IsDTV())
506  str.append(" (TV)");
507  else if (IsDigitalAudio())
508  str.append(" (Radio)");
509  else if (IsHDTV())
510  str.append(" (HDTV)");
511  else if (IsUHDTV())
512  str.append(" (UHDTV)");
513  else if (IsTeletext())
514  str.append(" (Teletext)");
515  else
516  str.append(QString(" (Unknown 0x%1)").arg(ServiceType(),2,16,QChar('0')));
517 
518  return str;
519 }
520 
521 QString TeletextDescriptor::toString(void) const
522 {
523  QString str = QString("Teletext Descriptor: %1 pages")
524  .arg(StreamCount());
525 
526  for (uint i = 0; i < StreamCount(); i++)
527  {
528  if (1 != StreamCount())
529  str.append("\n ");
530 
531  str.append(QString(" type(%1) mag(%2) page(%3) lang(%4)")
532  .arg(TeletextType(i))
533  .arg(TeletextMagazineNum(i), 0, 16)
534  .arg(TeletextPageNum(i), 2, 16, QChar('0'))
535  .arg(LanguageString(i)));
536  }
537 
538  return str;
539 }
540 
542 {
543  QString str = QString("CableDeliverySystemDescriptor: ");
544 
545  str.append(QString("Frequency: %1\n").arg(FrequencyHz()));
546  str.append(QString(" Mod=%1, SymbR=%2, FECInner=%3, FECOuter=%4")
547  .arg(ModulationString())
548  .arg(SymbolRateHz())
549  .arg(FECInnerString())
550  .arg(FECOuterString()));
551 
552  return str;
553 }
554 
556 {
557  QString str = QString("SatelliteDeliverySystemDescriptor: ");
558 
559  str.append(QString("Frequency: %1, Type: %2\n").arg(FrequencyHz())
560  .arg(ModulationSystemString()));
561  str.append(QString(" Mod=%1, SymbR=%2, FECInner=%3, Orbit=%4, Pol=%5")
562  .arg(ModulationString())
563  .arg(SymbolRateHz())
564  .arg(FECInnerString())
565  .arg(OrbitalPositionString())
566  .arg(PolarizationString()));
567 
568  return str;
569 }
570 
572 {
573  QString str = QString("TerrestrialDeliverySystemDescriptor: ");
574 
575  str.append(QString("Frequency: %1\n").arg(FrequencyHz()));
576  str.append(QString(" BW=%1k, C=%2, HP=%3, LP=%4, GI=%5, TransMode=%6k")
577  .arg(BandwidthString())
578  .arg(ConstellationString())
579  .arg(CodeRateHPString())
580  .arg(CodeRateLPString())
581  .arg(GuardIntervalString())
582  .arg(TransmissionModeString()));
583 
584  return str;
585 }
586 
588 {
589  QString ret = "UKChannelListDescriptor sid->chan_num: ";
590  for (uint i = 0; i < ChannelCount(); i++)
591  {
592  ret += QString("%1->%2").arg(ServiceID(i)).arg(ChannelNumber(i));
593  ret += (i+1<ChannelCount()) ? ", " : "";
594  }
595  return ret;
596 }
597 
599 {
600  QString ret = "DVBSimulcastChannelDescriptor sid->chan_num: ";
601  for (uint i = 0; i < ChannelCount(); i++)
602  {
603  ret += QString("%1->%2").arg(ServiceID(i)).arg(ChannelNumber(i));
604  ret += (i+1<ChannelCount()) ? ", " : "";
605  }
606  return ret;
607 }
608 
610 {
611  QString ret = "Freesat LCN Descriptor ";
612  ret += QString("(0x%1)").arg(DescriptorTag(),2,16,QChar('0'));
613  ret += QString(" length(%1)").arg(DescriptorLength());
614 
615  for (uint i=0; i<ServiceCount(); i++)
616  {
617  ret += QString("\n ServiceID (%1) (0x%2) ").arg(ServiceID(i)).arg(ServiceID(i),4,16,QChar('0'));
618  ret += QString("ChanID (0x%1)").arg(ChanID(i), 4, 16, QChar('0'));
619  for (uint j=0; j<LCNCount(i); j++)
620  {
621  ret += QString("\n LCN: %1 Region: %2").arg(LogicalChannelNumber(i,j),3).arg(RegionID(i,j));
622  }
623  }
624  return ret;
625 }
626 
628 {
629  QString ret = "Freesat Region Descriptor ";
630  ret += QString("(0x%1)").arg(DescriptorTag(),2,16,QChar('0'));
631  ret += QString(" length(%1)").arg(DescriptorLength());
632 
633  for (uint i=0; i<RegionCount(); ++i)
634  {
635  uint region_id = RegionID(i);
636  QString language = Language(i);
637  QString region_name = RegionName(i);
638  ret += QString("\n Region (%1) (%2) '%3'")
639  .arg(region_id,2).arg(language).arg(region_name);
640  }
641  return ret;
642 }
643 
645 {
646  QString ret = QString("Freesat Callsign Descriptor ");
647  ret += QString("(0x%1)").arg(DescriptorTag(),2,16,QChar('0'));
648  ret += QString(" length(%1)").arg(DescriptorLength());
649  ret += QString(" (%1) '%2'").arg(Language()).arg(Callsign());
650  return ret;
651 }
652 
654 {
655  QString ret = QString("CAIdentifierDescriptor ");
656  for (uint i = 0; i < CASystemCount(); ++i)
657  {
658  ret += QString("ca_system_id(0x%1) ")
659  .arg(CASystemId(i), 0, 16);
660  }
661  return ret;
662 }
663 
665 {
666  QString ret = QString("DataBroadcastDescriptor: "
667  "data_broadcast_id(%1) "
668  "component_tag(%1) ")
669  .arg(DataBroadcastId(), 0, 10)
670  .arg(DataComponentTag(), 0, 10);
671 
672  ret += QString("selector(0x ");
673  for (uint i = 0; i < SelectorLength(); i++)
674  ret += QString("%1 ").arg(Selector()[i], 0, 16);
675  ret += ") ";
676 
677  ret += QString("ISO_639_language_code(%1) ")
678  .arg(LanguageString());
679 
680  ret += QString("text(%1) ") + Text();
681 
682  return ret;
683 }
684 
686 {
687  QString ret = QString("LocalTimeOffsetDescriptor ");
688  uint count = Count();
689  for (uint i = 0; i < count; ++i)
690  {
691  ret += QString("country_code(%1) country_region_id(0x%2) "
692  "local_time_offset_with_polarity(%3) "
693  "time_of_change(TODO)")
694  .arg(CountryCodeString(i))
695  .arg(CountryRegionId(i), 0, 16)
697  // TODO add time of change
698  }
699  return ret;
700 }
701 
703 {
704  QString ret = QString("NVODReferenceDescriptor ");
705  for (uint i = 0; i < Count(); ++i)
706  {
707  ret += QString("transport_stream_id(0x%1) original_network_id(0x%2) "
708  "service_id(0x%3) ")
709  .arg(TransportStreamId(i), 0, 16)
710  .arg(OriginalNetworkId(i), 0, 16)
711  .arg(ServiceId(i), 0, 16);
712  }
713  return ret;
714 }
715 
717 {
718  return QString("PartialTransportStreamDescriptor peak_rate(%1) "
719  "min_overall_smooth_rate(%2) max_overall_smooth_buf(3)")
720  .arg(PeakRate()).arg(SmoothRate()).arg(SmoothBuf());
721 }
722 
723 QString AC3Descriptor::toString(void) const
724 {
725  QString ret = QString("AC3DescriptorDescriptor ");
726  if (HasComponentType())
727  ret += QString("component_type(%1) ")
728  .arg(ComponentType(), 0, 10);
729  if (HasBSID())
730  ret += QString("bsid(0x%1) ").arg(BSID(),0,16);
731  if (HasMainID())
732  ret += QString("mainid(0x%1) ").arg(MainID(),0,16);
733  if (HasASVC())
734  ret += QString("asvc(%1) ").arg(ASVC());
735  return ret;
736 }
737 
738 QMap<QString,QString> ExtendedEventDescriptor::Items(void) const
739 {
740  QMap<QString, QString> ret;
741 
742  uint index = 0;
743 
744  /* handle all items
745  * minimum item size is for 8bit length + 8bit length
746  */
747  while (LengthOfItems() - index >= 2)
748  {
749  QString item_description = dvb_decode_text (&_data[8 + index], _data[7 + index]);
750  index += 1 + _data[7 + index];
751  QString item = dvb_decode_text (&_data[8 + index], _data[7 + index]);
752  index += 1 + _data[7 + index];
753  ret.insertMulti (item_description, item);
754  }
755 
756  return ret;
757 }
uint ChanID(int i) const
unsigned long long FrequencyHz(void) const
bool HasASVC(void) const
uint Count(void) const
ProgramInfo::CategoryType GetMythCategory(uint i) const
QMap< QString, QString > Items(void) const
QString LanguageString(void) const
QString freesat_huffman_to_string(const unsigned char *compressed, uint size)
bool HasComponentType(void) const
unsigned long long FrequencyHz(uint i) const
uint ServiceCount(void) const
int CASystemId(uint i) const
const QString Language(void) const
bool IsUHDTV(void) const
QString toString(void) const override
QString FECInnerString(void) const
uint DescriptorTag(void) const
uint ServiceId(uint i) const
QString dvb_decode_text(const unsigned char *src, uint raw_length, const unsigned char *encoding_override, uint encoding_override_length)
unsigned int uint
Definition: compat.h:140
QString toString(void) const override
static QString decode_text(const unsigned char *buf, uint length)
uint ServiceID(uint i) const
static guint32 * tmp
Definition: goom_core.c:35
uint MainID(void) const
static QString decode_iso6937(const unsigned char *buf, uint length)
uint CountryRegionId(uint i) const
const uint16_t iso6937table_base[256]
const QString RegionName(uint i) const
static int x4
Definition: mythsocket.cpp:63
uint StreamCount(void) const
uint TransportStreamId(uint i) const
uint LogicalChannelNumber(int i, int j) const
uint ASVC(void) const
QString toString(void) const override
uint RegionCount(void) const
QString toString(void) const override
static void Init(void)
uint Count(void) const
uint TeletextType(uint i) const
bool IsTeletext(void) const
QString toString(void) const override
QString toString(void) const override
QString Text(void) const
uint ChannelNumber(uint i) const
uint SelectorLength(void) const
QString toString(void) const
uint LengthOfItems(void) const
QString ModulationString(void) const
static volatile bool categoryDescExists
QString ConstellationString(void) const
QString toString(void) const override
uint TeletextPageNum(uint i) const
int LocalTimeOffsetWithPolarity(uint i) const
static QMap< uint, QString > categoryDesc
QString GetDescription(uint i) const
bool HasBSID(void) const
QString Callsign(void) const
uint DataBroadcastId(void) const
uint ServiceType(void) const
bool IsDigitalAudio(void) const
uint DescriptorLength(void) const
uint ServiceID(int i) const
QString CountryCodeString(uint i) const
QString toString(void) const override
QString myth_category_type_to_string(ProgramInfo::CategoryType category_type)
uint TeletextMagazineNum(uint i) const
uint OriginalNetworkId(uint i) const
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
uint RegionID(int i, int j) const
QString toString(void) const override
QString toString(void) const override
QString TransmissionModeString(void) const
QString MobileHandOverTypeString(void) const
QString toString(void) const override
QString FECOuterString(void) const
QString toString(void) const override
const char * linkage_types[]
QString FECInnerString(void) const
uint Nibble(uint i) const
unsigned long long FrequencyHz(void) const
const unsigned char * _data
bool HasMainID(void) const
QString LinkageTypeString(void) const
QString dvb_decode_short_name(const unsigned char *src, uint raw_length)
QString LanguageString(uint i) const
QString ModulationSystemString(void) const
QString toString(void) const override
uint LCNCount(int i) const
int RegionID(uint i) const
QString toString(void) const override
const unsigned char * Selector(void) const
uint BSID(void) const
const QString Language(uint i) const
QString ModulationString(void) const
const uint16_t * iso6937table_secondary[256]
uint ComponentType(void) const
uint DataComponentTag(void) const
uint LinkageType(void) const
QString toString(void) const override
QString toString(void) const override
QString toString(void) const override
uint MobileHandOverType(void) const
uint ChannelNumber(uint i) const
uint CASystemCount(void) const
QString OrbitalPositionString(void) const
static QMutex categoryLock
uint Nibble1(uint i) const
static int x1
Definition: mythsocket.cpp:60