00001
00002
00003 #ifndef _DVB_DESCRIPTORS_H_
00004 #define _DVB_DESCRIPTORS_H_
00005
00006 #include <cassert>
00007 #include <vector>
00008 #include <map>
00009 #include <qmutex.h>
00010 #include <qstring.h>
00011 #include "mythcontext.h"
00012 #include "mpegdescriptors.h"
00013 #include "../programinfo.h"
00014
00015 using namespace std;
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 static QString coderate_inner(uint coderate);
00041
00042 extern QString dvb_decode_text(const unsigned char *src, uint length,
00043 const unsigned char *encoding_override,
00044 uint encoding_override_length);
00045
00046 inline QString dvb_decode_text(const unsigned char *src, uint length)
00047 {
00048 return dvb_decode_text(src, length, NULL, 0);
00049 }
00050
00051 #define byteBCDH2int(i) (i >> 4)
00052 #define byteBCDL2int(i) (i & 0x0f)
00053 #define byteBCD2int(i) (byteBCDH2int(i) * 10 + byteBCDL2int(i))
00054 #define byte2BCD2int(i, j) \
00055 (byteBCDH2int(i) * 1000 + byteBCDL2int(i) * 100 + \
00056 byteBCDH2int(j) * 10 + byteBCDL2int(j))
00057 #define byte3BCD2int(i, j, k) \
00058 (byteBCDH2int(i) * 100000 + byteBCDL2int(i) * 10000 + \
00059 byteBCDH2int(j) * 1000 + byteBCDL2int(j) * 100 + \
00060 byteBCDH2int(k) * 10 + byteBCDL2int(k))
00061 #define byte4BCD2int(i, j, k, l) \
00062 (byteBCDH2int(i) * 10000000LL + byteBCDL2int(i) * 1000000 + \
00063 byteBCDH2int(j) * 100000 + byteBCDL2int(j) * 10000 + \
00064 byteBCDH2int(k) * 1000 + byteBCDL2int(k) * 100 + \
00065 byteBCDH2int(l) * 10 + byteBCDL2int(l))
00066
00067 class NetworkNameDescriptor : public MPEGDescriptor
00068 {
00069 public:
00070 NetworkNameDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00071 {
00072
00073
00074 assert(DescriptorID::network_name == DescriptorTag());
00075
00076 }
00077
00078 QString Name() const
00079 { return dvb_decode_text(_data+2, DescriptorLength()); }
00080 QString toString() const
00081 { return QString("NetworkNameDescriptor: ")+Name(); }
00082 };
00083
00084 class LinkageDescriptor : public MPEGDescriptor
00085 {
00086 public:
00087 enum
00088 {
00089 lt_InformationService = 0x01,
00090 lt_EPGService = 0x02,
00091 lt_CAReplacementService = 0x03,
00092 lt_TSContainingCompleteNetworkBouquetSI = 0x04,
00093 lt_ServiceReplacementService = 0x05,
00094 lt_DataBroadcastService = 0x06,
00095 lt_RCSMap = 0x07,
00096 lt_MobileHandOver = 0x08,
00097 lt_SystemSoftwareUpdateService = 0x09,
00098 lt_TSContaining_SSU_BAT_NIT = 0x0A,
00099 lt_IP_MACNotificationService = 0x0B,
00100 lt_TSContaining_INT_BAT_NIT = 0x0C,
00101 };
00102
00103 LinkageDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00104 {
00105
00106
00107 assert(DescriptorID::linkage == DescriptorTag());
00108
00109 }
00110
00111 uint TSID() const { return (_data[2]<<8) | _data[3]; }
00112
00113 uint OriginalNetworkID() const { return (_data[4]<<8) | _data[5]; }
00114
00115 uint ServiceID() const { return (_data[6]<<8) | _data[7]; }
00116
00117 uint LinkageType() const { return _data[8]; }
00118
00119
00120
00121 uint PrivateDataLength_N8() const { return DescriptorLength() - 7; }
00122 const unsigned char* PrivateData_N8() const { return _data+9; }
00123
00124
00125
00126 uint HandOverType() const { return _data[10]>>4; }
00127
00128
00129 bool OriginType() const { return _data[10]&0x1; }
00130
00131
00132
00133 bool HasNetworkID() const { return bool(HandOverType() & 0x3); }
00134 uint NetworkID() const { return (_data[11]<<8) | _data[12]; }
00135
00136
00137 bool HasInitialServiceID() const { return !OriginType(); }
00138 uint InitialServiceID() const
00139 { return HasNetworkID() ? (_data[13]<<8) | _data[14] : NetworkID(); }
00140
00141
00142
00143 uint PrivateDataOffset_8() const
00144 {
00145 return 11 + (HasNetworkID() ? 2 : 0) +
00146 (HasInitialServiceID() ? 2 : 0);
00147 }
00148 uint PrivateDataLength_8() const
00149 { return DescriptorLength() - (PrivateDataOffset_8()-2); }
00150 const unsigned char* PrivateData_8() const
00151 { return _data + PrivateDataOffset_8(); }
00152
00153 QString toString() const { return QString("LinkageDescriptor(stub)"); }
00154 };
00155
00156 class AdaptationFieldDataDescriptor : public MPEGDescriptor
00157 {
00158 public:
00159 AdaptationFieldDataDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00160 {
00161
00162
00163 assert(DescriptorID::adaptation_field_data == DescriptorTag());
00164
00165 }
00166
00168 uint AdaptationFieldDataID() const { return _data[2]; }
00169
00170 QString toString() const { return QString("AdaptationFieldDataDescriptor(stub)"); }
00171 };
00172
00173 class AncillaryDataDescriptor : public MPEGDescriptor
00174 {
00175 public:
00176 AncillaryDataDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00177 {
00178
00179
00180 assert(DescriptorID::ancillary_data == DescriptorTag());
00181
00182 }
00183
00185 uint AncillaryDataID() const { return _data[2]; }
00186
00187 QString toString() const { return QString("AncillaryDataDescriptor(stub)"); }
00188 };
00189
00190 class AnnouncementSupportDescriptor : public MPEGDescriptor
00191 {
00192 public:
00193 AnnouncementSupportDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00194 {
00195
00196
00197 assert(DescriptorID::announcement_support == DescriptorTag());
00198
00199 }
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 QString toString() const { return QString("AnnouncementSupportDescriptor(stub)"); }
00216 };
00217
00218 class BouquetNameDescriptor : public MPEGDescriptor
00219 {
00220 public:
00221 BouquetNameDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00222 {
00223
00224
00225 assert(DescriptorID::bouquet_name == DescriptorTag());
00226
00227 }
00228
00229
00230 QString toString() const { return QString("BouquetNameDescriptor(stub)"); }
00231 };
00232
00233 class CAIdentifierDescriptor : public MPEGDescriptor
00234 {
00235 public:
00236 CAIdentifierDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00237 {
00238
00239
00240 assert(DescriptorID::CA_identifier == DescriptorTag());
00241
00242 }
00243
00244
00245
00246
00247 QString toString() const { return QString("CAIdentifierDescriptor(stub)"); }
00248 };
00249
00250 class CellFrequencyLinkDescriptor : public MPEGDescriptor
00251 {
00252 public:
00253 CellFrequencyLinkDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00254 {
00255
00256
00257 assert(DescriptorID::cell_frequency_link == DescriptorTag());
00258
00259 }
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 QString toString() const { return QString("CellFrequencyLinkDescriptor(stub)"); }
00273 };
00274
00275 class CellListDescriptor : public MPEGDescriptor
00276 {
00277 public:
00278 CellListDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00279 {
00280
00281
00282 assert(DescriptorID::cell_list == DescriptorTag());
00283
00284 }
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 QString toString() const { return QString("CellListDescriptor(stub)"); }
00305 };
00306
00307 class ComponentDescriptor : public MPEGDescriptor
00308 {
00309 public:
00310 ComponentDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00311 {
00312
00313
00314 assert(DescriptorID::component == DescriptorTag());
00315
00316 }
00317
00318
00319
00320 uint StreamContent(void) const { return _data[2] & 0xf; }
00321
00322 uint ComponentType(void) const { return _data[3]; }
00323
00324 uint ComponentTag(void) const { return _data[4]; }
00325
00326 int LanguageKey(void) const
00327 { return iso639_str3_to_key(&_data[5]); }
00328 QString LanguageString(void) const
00329 { return iso639_key_to_str3(LanguageKey()); }
00330 int CanonicalLanguageKey(void) const
00331 { return iso639_key_to_canonical_key(LanguageKey()); }
00332 QString CanonicalLanguageString(void) const
00333 { return iso639_key_to_str3(CanonicalLanguageKey()); }
00334
00335
00336
00337 bool IsVideo(void) const
00338 {
00339 return 0x1 == StreamContent() ||
00340 0x5 == StreamContent();
00341 }
00342 bool IsAudio(void) const
00343 {
00344 switch(StreamContent())
00345 {
00346 case 0x02:
00347 case 0x04:
00348 case 0x06:
00349 case 0x07:
00350 return true;
00351 default:
00352 return false;
00353 }
00354 }
00355 bool IsSubtitle(void) const { return 0x3 == StreamContent(); }
00356
00357 unsigned char VideoProperties(void) const
00358 {
00359 if (0x1 == StreamContent())
00360 return MPEG2Properties();
00361 if (0x5 == StreamContent())
00362 return VID_AVC || AVCProperties();
00363
00364 return VID_UNKNOWN;
00365 }
00366
00367 unsigned char MPEG2Properties(void) const
00368 {
00369 switch(ComponentType())
00370 {
00371 case 0x2 ... 0x4:
00372 case 0x6 ... 0x8:
00373 return VID_WIDESCREEN;
00374 case 0x09:
00375 case 0x0D:
00376 return VID_HDTV;
00377 case 0x0A ... 0x0C:
00378 case 0x0E ... 0x10:
00379 return VID_WIDESCREEN | VID_HDTV;
00380 default:
00381 return VID_UNKNOWN;
00382 }
00383 }
00384
00385 unsigned char AVCProperties(void) const
00386 {
00387 switch(ComponentType())
00388 {
00389 case 0x3 ... 0x4:
00390 case 0x7 ... 0x8:
00391 return VID_WIDESCREEN;
00392 case 0x0B ... 0x0C:
00393 case 0x0F ... 0x10:
00394 return VID_WIDESCREEN | VID_HDTV;
00395 default:
00396 return VID_UNKNOWN;
00397 }
00398 }
00399
00400 unsigned char AudioProperties(void) const
00401 {
00402 switch (StreamContent())
00403 {
00404 case 0x2:
00405 return MP2Properties();
00406 case 0x04:
00407 return AC3Properties();
00408 case 0x06:
00409 return HEAACProperties();
00410 default:
00411 return AUD_UNKNOWN;
00412 }
00413 }
00414
00415 unsigned char MP2Properties(void) const
00416 {
00417 switch (ComponentType())
00418 {
00419 case 0x1:
00420 return AUD_MONO;
00421 case 0x3:
00422 return AUD_STEREO;
00423 case 0x5:
00424 return AUD_SURROUND;
00425 case 0x40:
00426 return AUD_VISUALIMPAIR;
00427 case 0x41:
00428 return AUD_HARDHEAR;
00429 default:
00430 return AUD_UNKNOWN;
00431 }
00432 }
00433
00434 unsigned char AC3Properties(void) const
00435 {
00436 unsigned char properties = AUD_UNKNOWN;
00437
00438 switch (ComponentType() & 0x7)
00439 {
00440 case 0x0:
00441 properties |= AUD_MONO;
00442 break;
00443 case 0x2:
00444 properties |= AUD_STEREO;
00445 break;
00446 case 0x3:
00447 properties |= AUD_DOLBY;
00448 break;
00449 case 0x4 ... 0x5:
00450 properties |= AUD_SURROUND;
00451 break;
00452 }
00453
00454 if (((ComponentType() >> 3) & 0x7) == 0x2)
00455 properties |= AUD_VISUALIMPAIR;
00456
00457 if (((ComponentType() >> 3) & 0x7) == 0x3)
00458 properties |= AUD_HARDHEAR;
00459
00460 return properties;
00461 }
00462
00463 unsigned char HEAACProperties(void) const
00464 {
00465 switch (ComponentType())
00466 {
00467 case 0x1:
00468 return AUD_MONO;
00469 case 0x3:
00470 case 0x43:
00471 return AUD_STEREO;
00472 case 0x5:
00473 return AUD_SURROUND;
00474 case 0x40:
00475 case 0x44:
00476 return AUD_VISUALIMPAIR;
00477 case 0x41:
00478 case 0x45:
00479 return AUD_HARDHEAR;
00480 default:
00481 return AUD_UNKNOWN;
00482 }
00483 }
00484
00485 unsigned char SubtitleType(void) const
00486 {
00487 if (!IsSubtitle())
00488 return SUB_UNKNOWN;
00489
00490 switch (ComponentType())
00491 {
00492 case 0x1:
00493 case 0x3:
00494 case 0x10 ... 0x13:
00495 return SUB_NORMAL;
00496 case 0x20 ... 0x23:
00497 return SUB_HARDHEAR;
00498 default:
00499 return SUB_UNKNOWN;
00500 }
00501 }
00502
00503 QString toString() const { return QString("ComponentDescriptor(stream_content: 0x%1, "
00504 "component_type: 0x%2)").arg(StreamContent(), 0, 16)
00505 .arg(ComponentType(), 0, 16); }
00506 };
00507
00508 typedef enum
00509 {
00510 kCategoryNone = 0,
00511 kCategoryMovie,
00512 kCategorySeries,
00513 kCategorySports,
00514 kCategoryTVShow,
00515 kCategoryLast,
00516 } MythCategoryType;
00517
00518 QString myth_category_type_to_string(uint category_type);
00519 MythCategoryType string_to_myth_category_type(const QString &type);
00520
00521 class ContentDescriptor : public MPEGDescriptor
00522 {
00523 public:
00524 ContentDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00525 {
00526
00527
00528 assert(DescriptorID::content == DescriptorTag());
00529
00530 }
00531
00532 uint Count(void) const { return DescriptorLength() >> 1; }
00533
00534
00535
00536 uint Nibble1(uint i) const { return _data[2 + (i<<1)] >> 4; }
00537
00538 uint Nibble2(uint i) const { return _data[2 + (i<<1)] & 0xf; }
00539
00540 uint Nibble(uint i) const { return _data[2 + (i<<1)]; }
00541
00542
00543 uint UserNibble1(uint i) const { return _data[3 + (i<<1)] >> 4; }
00544
00545 uint UserNibble2(uint i) const { return _data[3 + (i<<1)] & 0xf; }
00546 uint UserNibble(uint i) const { return _data[3 + (i<<1)]; }
00547
00548
00549 MythCategoryType GetMythCategory(uint i) const;
00550 QString GetDescription(uint i) const;
00551 QString toString() const;
00552
00553 private:
00554 static void Init(void);
00555
00556 private:
00557 static QMutex categoryLock;
00558 static map<uint,QString> categoryDesc;
00559 static bool categoryDescExists;
00560 };
00561
00562 class CountryAvailabilityDescriptor : public MPEGDescriptor
00563 {
00564 public:
00565 CountryAvailabilityDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00566 {
00567
00568
00569 assert(DescriptorID::country_availability == DescriptorTag());
00570
00571 }
00572
00573
00574
00575
00576
00577
00578 QString toString() const { return QString("CountryAvailabilityDescriptor(stub)"); }
00579 };
00580
00581 class DataBroadcastDescriptor : public MPEGDescriptor
00582 {
00583 public:
00584 DataBroadcastDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00585 {
00586
00587
00588 assert(DescriptorID::data_broadcast == DescriptorTag());
00589
00590 }
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602 QString toString() const { return QString("DataBroadcastDescriptor(stub)"); }
00603 };
00604
00605 class DataBroadcastIdDescriptor : public MPEGDescriptor
00606 {
00607 public:
00608 DataBroadcastIdDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00609 {
00610
00611
00612 assert(DescriptorID::data_broadcast_id == DescriptorTag());
00613
00614 }
00615
00616
00617
00618
00619 QString toString() const { return QString("DataBroadcastIdDescriptor(stub)"); }
00620 };
00621
00622 class CableDeliverySystemDescriptor : public MPEGDescriptor
00623 {
00624 public:
00625 CableDeliverySystemDescriptor(const unsigned char* data)
00626 : MPEGDescriptor(data)
00627 {
00628
00629
00630 assert(DescriptorID::cable_delivery_system == DescriptorTag());
00631
00632 }
00633
00634
00635 uint FrequencyRaw() const
00636 {
00637 return ((_data[2]<<24) | (_data[3]<<16) |
00638 (_data[4]<<8) | (_data[5]));
00639 }
00640 unsigned long long FrequencyHz() const
00641 {
00642 return byte4BCD2int(_data[2], _data[3], _data[4], _data[5]) * 100;
00643 }
00644
00645
00646 enum
00647 {
00648 kOuterFEC_None = 0x1,
00649 kOuterFEC_RS204_RS188 = 0x2,
00650 };
00651 uint FECOuter() const { return _data[7] & 0xf; }
00652 QString FECOuterString() const
00653 {
00654 return (FECOuter() == kOuterFEC_None) ? "None" :
00655 ((FECOuter() == kOuterFEC_RS204_RS188) ? "RS(204/188)" : "unknown");
00656 }
00657
00658 enum
00659 {
00660 kModulationQAM16 = 0x01,
00661 kModulationQAM32 = 0x02,
00662 kModulationQAM64 = 0x03,
00663 kModulationQAM128 = 0x04,
00664 kModulationQAM256 = 0x05,
00665 };
00666 uint Modulation() const { return _data[8]; }
00667 QString ModulationString() const
00668 {
00669 static QString ms[] =
00670 { "auto", "qam_16", "qam_32", "qam_64", "qam_128", "qam_256" };
00671 return (Modulation() <= kModulationQAM256) ?
00672 ms[Modulation()] : QString("auto");
00673 }
00674
00675 uint SymbolRateRaw() const
00676 {
00677 return ((_data[9]<<20) | (_data[10]<<12) |
00678 (_data[11]<<4) | (_data[12]>>4));
00679 }
00680 uint SymbolRateHz() const
00681 {
00682 return ((byte3BCD2int(_data[9], _data[10], _data[11]) * 1000) +
00683 (byteBCDH2int(_data[12]) * 100));
00684 }
00685
00686 enum
00687 {
00688 kInnerFEC_1_2_ConvolutionCodeRate = 0x1,
00689 kInnerFEC_2_3_ConvolutionCodeRate = 0x2,
00690 kInnerFEC_3_4_ConvolutionCodeRate = 0x3,
00691 kInnerFEC_5_6_ConvolutionCodeRate = 0x4,
00692 kInnerFEC_7_8_ConvolutionCodeRate = 0x5,
00693 kInnerFEC_8_9_ConvolutionCodeRate = 0x6,
00694 kInnerFEC_None = 0xF,
00695 };
00696 uint FECInner() const { return _data[12] & 0xf; }
00697 QString FECInnerString() const { return coderate_inner(FECInner()); }
00698 QString toString() const;
00699 };
00700
00701 class SatelliteDeliverySystemDescriptor : public MPEGDescriptor
00702 {
00703 public:
00704 SatelliteDeliverySystemDescriptor(const unsigned char* data)
00705 : MPEGDescriptor(data)
00706 {
00707
00708
00709 assert(DescriptorID::satellite_delivery_system == DescriptorTag());
00710
00711 }
00712
00714 uint FrequencyRaw() const
00715 {
00716 return ((_data[2]<<24) | (_data[3]<<16) |
00717 (_data[4]<<8) | (_data[5]));
00718 }
00719 unsigned long long FrequencyHz() const
00720 {
00721 return byte4BCD2int(_data[2], _data[3], _data[4], _data[5]) * 10;
00722 }
00724 uint OrbitalPosition() const
00725 { return byte2BCD2int(_data[6], _data[7]); }
00726 QString OrbitalPositionString() const
00727 {
00728 uint num = OrbitalPosition();
00729 return QString("%1.%2 %3").arg(num / 10).arg(num % 10)
00730 .arg((IsEast()) ? "East" : "West");
00731 }
00732 double OrbitalPositionFloat() const
00733 { return ((double) OrbitalPosition()) / 10.0; }
00735 bool IsEast() const { return (_data[8]&0x80); }
00736 bool IsWest() const { return !IsEast(); }
00737
00738 uint Polarization() const { return (_data[8]>>5)&0x3; }
00739 QString PolarizationString() const
00740 {
00741 static QString ps[] = { "h", "v", "l", "r" };
00742 return ps[Polarization()];
00743 }
00744 bool IsCircularPolarization() const { return (_data[8]>>6)&0x1; }
00745 bool IsLinearPolarization() const { return !((_data[8]>>6)&0x1); }
00746 bool IsHorizontalLeftPolarization() const { return (_data[8]>>5)&0x1; }
00747 bool IsVerticalRightPolarization() const { return !((_data[8]>>5)&0x1); }
00748
00749 enum
00750 {
00751 kModulationQPSK_NS = 0x0,
00752 kModulationQPSK = 0x1,
00753 kModulation8PSK = 0x2,
00754 kModulationQAM16 = 0x3,
00755 };
00756 uint Modulation() const { return _data[8]&0x1f; }
00757 QString ModulationString() const
00758 {
00759 static QString ms[] = { "qpsk", "qpsk", "8psk", "qam_16" };
00760 return (Modulation() <= kModulationQAM16) ? ms[Modulation()] : "auto";
00761 }
00762
00763 uint SymbolRate() const
00764 {
00765 return ((_data[9]<<20) | (_data[10]<<12) |
00766 (_data[11]<<4) | (_data[12]>>4));
00767 }
00768 uint SymbolRateHz() const
00769 {
00770 return ((byte3BCD2int(_data[9], _data[10], _data[11]) * 1000) +
00771 (byteBCDH2int(_data[12]) * 100));
00772 }
00773
00774 enum
00775 {
00776 kInnerFEC_1_2_ConvolutionCodeRate = 0x1,
00777 kInnerFEC_2_3_ConvolutionCodeRate = 0x2,
00778 kInnerFEC_3_4_ConvolutionCodeRate = 0x3,
00779 kInnerFEC_5_6_ConvolutionCodeRate = 0x4,
00780 kInnerFEC_7_8_ConvolutionCodeRate = 0x5,
00781 kInnerFEC_8_9_ConvolutionCodeRate = 0x6,
00782 kInnerFEC_None = 0xF,
00783 };
00784 uint FECInner() const { return _data[12] & 0xf; }
00785 QString FECInnerString() const { return coderate_inner(FECInner()); }
00786
00787 QString toString() const;
00788
00789 };
00790
00791 class TerrestrialDeliverySystemDescriptor : public MPEGDescriptor
00792 {
00793 public:
00794 TerrestrialDeliverySystemDescriptor(const unsigned char* data)
00795 : MPEGDescriptor(data)
00796 {
00797
00798
00799 assert(DescriptorID::terrestrial_delivery_system == DescriptorTag());
00800
00801 }
00802
00803
00804 uint Frequency() const
00805 {
00806 return ((_data[2]<<24) | (_data[3]<<16) |
00807 (_data[4]<<8) | (_data[5]));
00808 }
00809 uint FrequencyHz() const { return Frequency() * 10; }
00810
00811
00812 enum
00813 {
00814 kBandwidth8Mhz = 0x0,
00815 kBandwidth7Mhz = 0x1,
00816 kBandwidth6Mhz = 0x2,
00817 kBandwidth5Mhz = 0x3,
00818 };
00819 uint Bandwidth() const { return _data[6]>>5; }
00820 uint BandwidthHz() const { return (8 - Bandwidth()) * 1000000; }
00821 QString BandwidthString() const
00822 {
00823 static QString bs[] = { "8", "7", "6", "5" };
00824 return (Bandwidth() <= kBandwidth5Mhz) ? bs[Bandwidth()] : "auto";
00825 }
00826
00827 bool HighPriority() const { return _data[6] & 0x10; }
00828
00829 bool IsTimeSlicingIndicatorUsed() const { return !(_data[6] & 0x08); }
00830
00831 bool IsMPE_FECUsed() const { return !(_data[6] & 0x04); }
00832
00833
00834 enum
00835 {
00836 kConstellationQPSK = 0x0,
00837 kConstellationQAM16 = 0x1,
00838 kConstellationQAM64 = 0x2,
00839 };
00840 uint Constellation() const { return _data[7]>>6; }
00841 QString ConstellationString() const
00842 {
00843 static QString cs[] = { "qpsk", "qam_16", "qam_64" };
00844 return (Constellation() <= kConstellationQAM64) ?
00845 cs[Constellation()] : "auto";
00846 }
00847
00848 enum
00849 {
00850 kHierarchyInfoNonHierarchicalNativeInterleaver = 0x0,
00851 kHierarchyInfoAlpha1NativeInterleaver = 0x1,
00852 kHierarchyInfoAlpha2NativeInterleaver = 0x2,
00853 kHierarchyInfoAlpha4NativeInterleaver = 0x3,
00854 kHierarchyInfoNonHierarchicalInDepthInterleaver = 0x4,
00855 kHierarchyInfoAlpha1InDepthInterleaver = 0x5,
00856 kHierarchyInfoAlpha2InDepthInterleaver = 0x6,
00857 kHierarchyInfoAlpha4InDepthInterleaver = 0x7,
00858 };
00859 uint Hierarchy() const { return (_data[7]>>3) & 0x7; }
00860
00862 QString HierarchyString() const
00863 {
00864 static QString hs[] = { "n", "1", "2", "4", "a", "a", "a", "a" };
00865 return hs[Hierarchy()];
00866 }
00867 bool NativeInterleaver() const { return _data[7] & 0x20; }
00868 uint Alpha() const
00869 {
00870 uint i = (_data[7]>>3) & 0x3;
00871 return (0x2 == i) ? 4 : i;
00872 }
00873
00874 enum
00875 {
00876 kCodeRate_1_2 = 0x0,
00877 kCodeRate_2_3 = 0x1,
00878 kCodeRate_3_4 = 0x2,
00879 kCodeRate_5_6 = 0x3,
00880 kCodeRate_7_8 = 0x4,
00881 };
00882 uint CodeRateHP() const { return _data[7] & 0x7; }
00883 QString CodeRateHPString() const
00884 {
00885 static QString cr[] = {
00886 "1/2", "2/3", "3/4", "5/6", "7/8", "auto", "auto", "auto"
00887 };
00888 return cr[CodeRateHP()];
00889 }
00890
00891 uint CodeRateLP() const { return (_data[8]>>5) & 0x7; }
00892 QString CodeRateLPString() const
00893 {
00894 static QString cr[] = {
00895 "1/2", "2/3", "3/4", "5/6", "7/8", "auto", "auto", "auto"
00896 };
00897 return cr[CodeRateLP()];
00898 }
00899
00900 enum
00901 {
00902 kGuardInterval_1_32 = 0x0,
00903 kGuardInterval_1_16 = 0x1,
00904 kGuardInterval_1_8 = 0x2,
00905 kGuardInterval_1_4 = 0x3,
00906 };
00907 uint GuardInterval() const { return (_data[8]>>3) & 0x3; }
00908 QString GuardIntervalString() const
00909 {
00910 static QString gi[] = { "1/32", "1/16", "1/8", "1/4" };
00911 return gi[GuardInterval()];
00912 }
00913
00914 enum
00915 {
00916 kTransmissionMode2k = 0x00,
00917 kTransmissionMode8k = 0x01,
00918 kTransmissionMode4k = 0x02,
00919 };
00920 uint TransmissionMode() const { return (_data[8]>>1) & 0x3; }
00921 QString TransmissionModeString() const
00922 {
00923 static QString tm[] = { "2", "8", "4", "auto" };
00924 return tm[TransmissionMode()];
00925 }
00926
00927 bool OtherFrequencyInUse() const { return _data[8] & 0x1; }
00928
00929
00930 QString toString() const;
00931 };
00932
00933 class DSNGDescriptor : public MPEGDescriptor
00934 {
00935 public:
00936 DSNGDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00937 {
00938
00939
00940 assert(DescriptorID::DSNG == DescriptorTag());
00941
00942 }
00943
00944
00945 QString toString() const { return QString("DSNGDescriptor(stub)"); }
00946 };
00947
00948 class ExtendedEventDescriptor : public MPEGDescriptor
00949 {
00950 public:
00951 ExtendedEventDescriptor(const unsigned char* data) : MPEGDescriptor(data)
00952 {
00953
00954
00955 assert(DescriptorID::extended_event == DescriptorTag());
00956
00957 }
00958
00959
00960 uint DescriptorNumber(void) const { return _data[2] >> 4; }
00961
00962 uint LastNumber(void) const { return _data[2] & 0xf; }
00963
00964 int LanguageKey(void) const
00965 { return iso639_str3_to_key(&_data[3]); }
00966 QString LanguageString(void) const
00967 { return iso639_key_to_str3(LanguageKey()); }
00968 int CanonicalLanguageKey(void) const
00969 { return iso639_key_to_canonical_key(LanguageKey()); }
00970 QString CanonicalLanguageString(void) const
00971 { return iso639_key_to_str3(CanonicalLanguageKey()); }
00972
00973 uint LengthOfItems(void) const { return _data[6]; }
00974
00975
00976
00977
00978
00979
00980
00981
00982 uint TextLength(void) const { return _data[7 + _data[6]]; }
00983
00984 QString Text(void) const
00985 { return dvb_decode_text(&_data[8 + _data[6]], TextLength()); }
00986
00987
00988 QString Text(const unsigned char *encoding_override,
00989 uint encoding_length) const
00990 {
00991 return dvb_decode_text(&_data[8 + _data[6]], TextLength(),
00992 encoding_override, encoding_length);
00993 }
00994
00995
00996 QString toString() const { return QString("ExtendedEventDescriptor(stub)"); }
00997 };
00998
00999 class FrequencyListDescriptor : public MPEGDescriptor
01000 {
01001 public:
01002 FrequencyListDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01003 {
01004
01005
01006 assert(DescriptorID::frequency_list == DescriptorTag());
01007
01008 }
01009
01010
01011
01012 enum
01013 {
01014 kCodingTypeNotDefined = 0x0,
01015 kCodingTypeSatellite = 0x1,
01016 kCodingTypeCable = 0x2,
01017 kCodingTypeTerrestrial = 0x3,
01018 };
01019 uint CodingType(void) const { return _data[2] & 0x3; }
01020
01021
01022
01023
01024 uint FrequencyCount() const { return DescriptorLength()>>2; }
01025 unsigned long long Frequency(uint i) const
01026 {
01027 if (kCodingTypeTerrestrial == CodingType())
01028 return ((_data[3 + (i<<2)]<<24) | (_data[4 + (i<<2)]<<16) |
01029 (_data[5 + (i<<2)]<<8) | (_data[6 + (i<<2)]));
01030 else
01031 return byte4BCD2int(_data[3 + (i<<2)], _data[4 + (i<<2)],
01032 _data[5 + (i<<2)], _data[6 + (i<<2)]);
01033 }
01034 unsigned long long FrequencyHz(uint i) const
01035 {
01036 return Frequency(i) *
01037 ((kCodingTypeTerrestrial == CodingType()) ? 10 : 100);
01038 }
01039
01040 QString toString() const;
01041 };
01042
01043 class LocalTimeOffsetDescriptor : public MPEGDescriptor
01044 {
01045 public:
01046 LocalTimeOffsetDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01047 {
01048
01049
01050 assert(DescriptorID::local_time_offset == DescriptorTag());
01051
01052 }
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064 QString toString() const { return QString("LocalTimeOffsetDescriptor(stub)"); }
01065 };
01066
01067 class MosaicDescriptor : public MPEGDescriptor
01068 {
01069 public:
01070 MosaicDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01071 {
01072
01073
01074 assert(DescriptorID::mosaic == DescriptorTag());
01075
01076 }
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118 QString toString() const { return QString("MosaicDescriptor(stub)"); }
01119 };
01120
01121 class MultilingualBouquetNameDescriptor : public MPEGDescriptor
01122 {
01123 public:
01124 MultilingualBouquetNameDescriptor(const unsigned char* data)
01125 : MPEGDescriptor(data)
01126 {
01127
01128
01129 assert(DescriptorID::multilingual_bouquet_name == DescriptorTag());
01130
01131 }
01132
01133
01134
01135
01136
01137
01138
01139 QString toString() const { return QString("MultilingualBouguetNameDescriptor(stub)"); }
01140 };
01141
01142 class MultilingualNetworkNameDescriptor : public MPEGDescriptor
01143 {
01144 public:
01145 MultilingualNetworkNameDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01146 {
01147
01148
01149 assert(DescriptorID::multilingual_network_name == DescriptorTag());
01150
01151 }
01152
01153
01154
01155
01156
01157
01158
01159 QString toString() const { return QString("MultilingualNetworkNameDescriptor(stub)"); }
01160 };
01161
01162 class MultilingualServiceNameDescriptor : public MPEGDescriptor
01163 {
01164 public:
01165 MultilingualServiceNameDescriptor(const unsigned char* data)
01166 : MPEGDescriptor(data)
01167 {
01168
01169
01170 assert(DescriptorID::multilingual_service_name == DescriptorTag());
01171
01172 }
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182 QString toString() const { return QString("MultiLingualServiceNameDescriptor(stub)"); }
01183 };
01184
01185 class NVODReferenceDescriptor : public MPEGDescriptor
01186 {
01187 public:
01188 NVODReferenceDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01189 {
01190
01191
01192 assert(DescriptorID::NVOD_reference == DescriptorTag());
01193
01194 }
01195
01196
01197
01198
01199
01200
01201
01202 QString toString() const { return QString("NVODReferenceDescriptor(stub)"); }
01203 };
01204
01205 class ParentalRatingDescriptor : public MPEGDescriptor
01206 {
01207 public:
01208 ParentalRatingDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01209 {
01210
01211
01212 assert(DescriptorID::parental_rating == DescriptorTag());
01213
01214 }
01215
01216
01217
01218
01219
01220
01221 QString toString() const { return QString("ParentalRatingDescriptor(stub)"); }
01222 };
01223
01224 class PDCDescriptor : public MPEGDescriptor
01225 {
01226 public:
01227 PDCDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01228 {
01229
01230
01231 assert(DescriptorID::PDC == DescriptorTag());
01232
01233 }
01234
01235
01236
01237 QString toString() const { return QString("PDCDescriptor(stub)"); }
01238 };
01239
01240 class PrivateDataSpecifierDescriptor : public MPEGDescriptor
01241 {
01242 public:
01243 PrivateDataSpecifierDescriptor(const unsigned char* data)
01244 : MPEGDescriptor(data)
01245 {
01246
01247
01248 assert(DescriptorID::private_data_specifier == DescriptorTag());
01249
01250 }
01251
01252
01253 QString toString() const { return QString("PrivateDataSpecifierDescriptor(stub)"); }
01254 };
01255
01256 class ScramblingDescriptor : public MPEGDescriptor
01257 {
01258 public:
01259 ScramblingDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01260 {
01261
01262
01263 assert(DescriptorID::scrambling == DescriptorTag());
01264
01265 }
01266
01267
01268
01269 QString toString() const { return QString("ScramblingDescriptor"); }
01270 };
01271
01272 class ServiceDescriptor : public MPEGDescriptor
01273 {
01274 public:
01275 ServiceDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01276 {
01277
01278
01279 assert(DescriptorID::service == DescriptorTag());
01280
01281 }
01282 enum
01283 {
01284 kServiceTypeDigitalTelevision = 0x01,
01285 kServiceTypeDigitalRadioSound = 0x02,
01286 kServiceTypeTeletext = 0x03,
01287 kServiceTypeNVODReference = 0x04,
01288 kServiceTypeNVODTimeShifted = 0x05,
01289 kServiceTypeMosaic = 0x06,
01290 kServiceTypePALCodedSignal = 0x07,
01291 kServiceTypeSECAMCodedSignal = 0x08,
01292 kServiceTypeD_D2_MAC = 0x09,
01293 kServiceTypeFMRadio = 0x0A,
01294 kServiceTypeNTSCCodedSignal = 0x0B,
01295 kServiceTypeDataBroadcast = 0x0C,
01296 kServiceTypeCommonInterface = 0x0D,
01297 kServiceTypeRCS_Map = 0x0E,
01298 kServiceTypeRCS_FLS = 0x0F,
01299 kServiceTypeDVB_MHP = 0x10,
01300 kServiceTypeHDTV = 0x11,
01301 kServiceTypeHDTV2 = 0x19,
01302 kServiceTypeEchoStarTV1 = 0x91,
01303 kServiceTypeEchoStarTV2 = 0x9a,
01304 kServiceTypeEchoStarTV3 = 0xa4,
01305 kServiceTypeEchoStarTV4 = 0xa6,
01306 kServiceTypeNimiqTV1 = 0x81,
01307 kServiceTypeNimiqTV2 = 0x85,
01308 kServiceTypeNimiqTV3 = 0x86,
01309 kServiceTypeNimiqTV4 = 0x89,
01310 kServiceTypeNimiqTV5 = 0x8a,
01311 kServiceTypeNimiqTV6 = 0x8d,
01312 kServiceTypeNimiqTV7 = 0x8f,
01313 kServiceTypeNimiqTV8 = 0x90,
01314 kServiceTypeNimiqTV9 = 0x96,
01315
01316 };
01317
01318 uint ServiceType(void) const { return _data[2]; }
01319
01320 uint ServiceProviderNameLength(void) const { return _data[3]; }
01321
01322 QString ServiceProviderName(void) const
01323 { return dvb_decode_text(_data + 4, ServiceProviderNameLength()); }
01324
01325 uint ServiceNameLength(void) const
01326 { return _data[4 + ServiceProviderNameLength()]; }
01327
01328 QString ServiceName(void) const
01329 {
01330 return dvb_decode_text(_data + 5 + ServiceProviderNameLength(),
01331 ServiceNameLength());
01332 }
01333 bool IsDTV(void) const
01334 { return ((ServiceType() == kServiceTypeDigitalTelevision) ||
01335 IsHDTV() ||
01336 (ServiceType() == kServiceTypeEchoStarTV1) ||
01337 (ServiceType() == kServiceTypeEchoStarTV2) ||
01338 (ServiceType() == kServiceTypeEchoStarTV3) ||
01339 (ServiceType() == kServiceTypeEchoStarTV4) ||
01340 (ServiceType() == kServiceTypeNimiqTV1) ||
01341 (ServiceType() == kServiceTypeNimiqTV2) ||
01342 (ServiceType() == kServiceTypeNimiqTV3) ||
01343 (ServiceType() == kServiceTypeNimiqTV4) ||
01344 (ServiceType() == kServiceTypeNimiqTV5) ||
01345 (ServiceType() == kServiceTypeNimiqTV6) ||
01346 (ServiceType() == kServiceTypeNimiqTV7) ||
01347 (ServiceType() == kServiceTypeNimiqTV8) ||
01348 (ServiceType() == kServiceTypeNimiqTV9)); }
01349 bool IsDigitalAudio(void) const
01350 { return ServiceType() == kServiceTypeDigitalRadioSound; }
01351 bool IsHDTV(void) const
01352 { return
01353 (ServiceType() == kServiceTypeHDTV) ||
01354 (ServiceType() == kServiceTypeHDTV2); }
01355 bool IsTeletext(void) const
01356 { return ServiceType() == kServiceTypeDataBroadcast; }
01357
01358 QString toString() const;
01359 };
01360
01361 class ServiceAvailabilityDescriptor : public MPEGDescriptor
01362 {
01363 public:
01364 ServiceAvailabilityDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01365 {
01366
01367
01368 assert(DescriptorID::service_availability == DescriptorTag());
01369
01370 }
01371
01372
01373
01374
01375 QString toString() const { return QString("ServiceAvailabilityDescriptor(stub)"); }
01376 };
01377
01378 class ServiceListDescriptor : public MPEGDescriptor
01379 {
01380 public:
01381 ServiceListDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01382 {
01383
01384
01385 assert(DescriptorID::service_list == DescriptorTag());
01386
01387 }
01388
01389
01390
01391
01392
01393
01394 QString toString() const { return QString("ServiceListDescriptor(stub)"); }
01395 };
01396
01397 class ServiceMoveDescriptor : public MPEGDescriptor
01398 {
01399 public:
01400 ServiceMoveDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01401 {
01402
01403
01404 assert(DescriptorID::service_move == DescriptorTag());
01405
01406 }
01407
01408
01409
01410
01411 QString toString() const { return QString("ServiceMoveDescriptor(stub)"); }
01412 };
01413
01414 class ShortEventDescriptor : public MPEGDescriptor
01415 {
01416 public:
01417 ShortEventDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01418 {
01419
01420
01421 assert(DescriptorID::short_event == DescriptorTag());
01422
01423 }
01424
01425
01426 int LanguageKey(void) const
01427 { return iso639_str3_to_key(&_data[2]); }
01428 QString LanguageString(void) const
01429 { return iso639_key_to_str3(LanguageKey()); }
01430 int CanonicalLanguageKey(void) const
01431 { return iso639_key_to_canonical_key(LanguageKey()); }
01432 QString CanonicalLanguageString(void) const
01433 { return iso639_key_to_str3(CanonicalLanguageKey()); }
01434
01435 uint EventNameLength(void) const { return _data[5]; }
01436
01437 QString EventName(void) const
01438 { return dvb_decode_text(&_data[6], _data[5]); }
01439
01440 uint TextLength(void) const { return _data[6 + _data[5]]; }
01441
01442 QString Text(void) const
01443 { return dvb_decode_text(&_data[7 + _data[5]], TextLength()); }
01444
01445
01446 QString EventName(const unsigned char *encoding_override,
01447 uint encoding_length) const
01448 {
01449 return dvb_decode_text(&_data[6], _data[5],
01450 encoding_override, encoding_length);
01451 }
01452
01453 QString Text(const unsigned char *encoding_override,
01454 uint encoding_length) const
01455 {
01456 return dvb_decode_text(&_data[7 + _data[5]], TextLength(),
01457 encoding_override, encoding_length);
01458 }
01459
01460
01461 QString toString() const
01462 { return LanguageString() + " : " + EventName() + " : " + Text(); }
01463 };
01464
01465 class ShortSmoothingBufferDescriptor : public MPEGDescriptor
01466 {
01467 public:
01468 ShortSmoothingBufferDescriptor(const unsigned char* data)
01469 : MPEGDescriptor(data)
01470 {
01471
01472
01473 assert(DescriptorID::short_smoothing_buffer == DescriptorTag());
01474
01475 }
01476
01477
01478
01479
01480 QString toString() const { return QString("ShortSmoothingBufferDescriptor(stub)"); }
01481 };
01482
01483 class StreamIdentifierDescriptor : public MPEGDescriptor
01484 {
01485 public:
01486 StreamIdentifierDescriptor(const unsigned char* data)
01487 : MPEGDescriptor(data)
01488 {
01489
01490
01491 assert(DescriptorID::stream_identifier == DescriptorTag());
01492
01493 }
01494
01495 QString toString() const { return QString("StreamIdentifierDescriptor(stub)"); }
01496 };
01497
01498 class SubtitlingDescriptor : public MPEGDescriptor
01499 {
01500 public:
01501 SubtitlingDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01502 {
01503
01504
01505 assert(DescriptorID::subtitling == DescriptorTag());
01506
01507 }
01508
01509 uint StreamCount(void) const { return DescriptorLength() >> 3; }
01510
01511
01512
01513 int LanguageKey(uint i) const
01514 { return iso639_str3_to_key(&_data[2 + (i<<3)]); }
01515 QString LanguageString(uint i) const
01516 { return iso639_key_to_str3(LanguageKey(i)); }
01517 int CanonicalLanguageKey(uint i) const
01518 { return iso639_key_to_canonical_key(LanguageKey(i)); }
01519 QString CanonicalLanguageString(uint i) const
01520 { return iso639_key_to_str3(CanonicalLanguageKey(i)); }
01521
01522
01523 uint SubtitleType(uint i) const
01524 { return _data[5 + (i<<3)]; }
01525
01526 uint CompositionPageID(uint i) const
01527 { return (_data[6 + (i<<3)] << 8) | _data[7 + (i<<3)]; }
01528
01529 uint AncillaryPageID(uint i) const
01530 { return (_data[8 + (i<<3)] << 8) | _data[9 + (i<<3)]; }
01531
01532 QString toString() const { return QString("SubtitlingDescriptor(stub)"); }
01533 };
01534
01535 class TelephoneDescriptor : public MPEGDescriptor
01536 {
01537 public:
01538 TelephoneDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01539 {
01540
01541
01542 assert(DescriptorID::telephone == DescriptorTag());
01543
01544 }
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567 QString toString() const { return QString("TelephoneDescriptor(stub)"); }
01568 };
01569
01570 class TeletextDescriptor : public MPEGDescriptor
01571 {
01572 public:
01573 TeletextDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01574 {
01575
01576
01577 assert(DescriptorID::teletext == DescriptorTag());
01578
01579 }
01580
01581 uint StreamCount(void) const { return DescriptorLength() / 5; }
01582
01583
01584
01585
01586 int LanguageKey(uint i) const
01587 { return iso639_str3_to_key(&_data[2 + (i*5)]); }
01588 QString LanguageString(uint i) const
01589 { return iso639_key_to_str3(LanguageKey(i)); }
01590 int CanonicalLanguageKey(uint i) const
01591 { return iso639_key_to_canonical_key(LanguageKey(i)); }
01592 QString CanonicalLanguageString(uint i) const
01593 { return iso639_key_to_str3(CanonicalLanguageKey(i)); }
01594
01595 uint TeletextType(uint i) const
01596 { return _data[5 + (i*5)] >> 3; }
01597
01598 uint TeletextMagazineNum(uint i) const
01599 { return _data[5 + (i*5)] & 0x7; }
01600
01601 uint TeletextPageNum(uint i) const
01602 { return _data[6 + (i*5)]; }
01603
01604 QString toString() const { return QString("TeletextDescriptor(stub)"); }
01605 };
01606
01607 class TimeShiftedEventDescriptor : public MPEGDescriptor
01608 {
01609 public:
01610 TimeShiftedEventDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01611 {
01612
01613
01614 assert(DescriptorID::time_shifted_event == DescriptorTag());
01615
01616 }
01617
01618
01619
01620 QString toString() const { return QString("TimeShiftedEventDescriptor(stub)"); }
01621 };
01622
01623 class TimeShiftedServiceDescriptor : public MPEGDescriptor
01624 {
01625 public:
01626 TimeShiftedServiceDescriptor(const unsigned char* data)
01627 : MPEGDescriptor(data)
01628 {
01629
01630
01631 assert(DescriptorID::dvb_time_shifted_service == DescriptorTag());
01632
01633 }
01634
01635
01636 QString toString() const { return QString("TimeShiftedServiceDescriptor(stub)"); }
01637 };
01638
01639 class TransportStreamDescriptor : public MPEGDescriptor
01640 {
01641 public:
01642 TransportStreamDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01643 {
01644
01645
01646 assert(DescriptorID::transport_stream == DescriptorTag());
01647
01648 }
01649
01650
01651 QString toString() const { return QString("TransportStreamDescriptor(stub)"); }
01652 };
01653
01654 class VBIDataDescriptor : public MPEGDescriptor
01655 {
01656 public:
01657 VBIDataDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01658 {
01659
01660
01661 assert(DescriptorID::VBI_data == DescriptorTag());
01662
01663 }
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683 QString toString() const { return QString("VBIDataDescriptor(stub)"); }
01684 };
01685
01686 class VBITeletextDescriptor : public MPEGDescriptor
01687 {
01688 public:
01689 VBITeletextDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01690 {
01691
01692
01693 assert(DescriptorID::VBI_teletext == DescriptorTag());
01694
01695 }
01696
01697
01698
01699
01700
01701
01702
01703
01704 QString toString() const { return QString("VBITeletextDescriptor(stub)"); }
01705 };
01706
01707 class PartialTransportStreamDescriptor : public MPEGDescriptor
01708 {
01709 public:
01710 PartialTransportStreamDescriptor(const unsigned char* data)
01711 : MPEGDescriptor(data)
01712 {
01713
01714
01715 assert(DescriptorID::partial_transport_stream == DescriptorTag());
01716
01717 }
01718
01719
01720
01721
01722
01723
01724 QString toString() const { return QString("PartialTransportStreamDescriptor(stub)"); }
01725 };
01726
01727
01728
01729 class AC3Descriptor : public MPEGDescriptor
01730 {
01731 public:
01732 AC3Descriptor(const unsigned char* data) : MPEGDescriptor(data)
01733 {
01734
01735
01736 assert(DescriptorID::AC3 == DescriptorTag());
01737
01738 }
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755 QString toString() const { return QString("AC3DescriptorDescriptor(stub)"); }
01756 };
01757
01758 static QString coderate_inner(uint cr)
01759 {
01760 switch (cr)
01761 {
01762 case 0x0: return "auto";
01763 case 0x1: return "1/2";
01764 case 0x2: return "2/3";
01765 case 0x3: return "3/4";
01766 case 0x4: return "5/6";
01767 case 0x5: return "7/8";
01768 case 0x8: return "8/9";
01769 case 0xf: return "none";
01770 default: return "auto";
01771 }
01772 }
01773
01774 class UKChannelListDescriptor : public MPEGDescriptor
01775 {
01776 public:
01777 UKChannelListDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01778 {
01779
01780
01781 assert(DescriptorID::dvb_uk_channel_list == DescriptorTag());
01782
01783 }
01784
01785 uint ChannelCount() const { return DescriptorLength() >> 2; }
01786
01787 uint ServiceID(uint i) const
01788 { return (_data[2 + (i<<2)] << 8) | _data[3 + (i<<2)]; }
01789
01790 uint ChannelNumber(uint i) const
01791 { return ((_data[4 + (i<<2)] << 8) | _data[5 + (i<<2)]) & 0x3ff; }
01792
01793 QString toString() const { return QString("UKChannelListDescriptor(stub)"); }
01794 };
01795
01796 class DVBContentIdentifierDescriptor : public MPEGDescriptor
01797 {
01798 public:
01799 DVBContentIdentifierDescriptor(const unsigned char* data) : MPEGDescriptor(data)
01800 {
01801
01802
01803 assert(DescriptorID::dvb_content_identifier == DescriptorTag());
01804
01805 }
01806
01807 uint ContentType() const { return _data[2] >> 2; }
01808
01809 uint ContentEncoding() const { return _data[2] & 0x03; }
01810
01811
01812 QString ContentId() const
01813 { return QString::fromAscii((const char *)_data+4, _data[3]); }
01814
01815 QString toString() const { return QString("DVBContentIdentifierDescriptor(stub)"); }
01816 };
01817
01818
01819 #endif