|
SASC-NG
DVBSoftCAM
|
00001 /*************************************************************************** 00002 * Copyright (c) 2003 by Marcel Wiesweg * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * $Id: descriptor.h 1.15 2006/05/28 14:25:30 kls Exp $ 00010 * * 00011 ***************************************************************************/ 00012 00013 #ifndef LIBSI_DESCRIPTOR_H 00014 #define LIBSI_DESCRIPTOR_H 00015 00016 #include "si.h" 00017 #include "headers.h" 00018 00019 namespace SI { 00020 00021 class ShortEventDescriptor : public Descriptor { 00022 public: 00023 char languageCode[4]; 00024 String name; //name of the event 00025 String text; //short description 00026 protected: 00027 virtual void Parse(); 00028 }; 00029 00030 class ExtendedEventDescriptor : public GroupDescriptor { 00031 public: 00032 class Item : public LoopElement { 00033 public: 00034 virtual int getLength() { return sizeof(item_extended_event)+sizeof(item_extended_event_mid)+item.getLength()+itemDescription.getLength(); } 00035 String item; 00036 String itemDescription; 00037 protected: 00038 virtual void Parse(); 00039 }; 00040 char languageCode[4]; 00041 int getDescriptorNumber(); 00042 int getLastDescriptorNumber(); 00043 StructureLoop<Item> itemLoop; 00044 String text; 00045 protected: 00046 virtual void Parse(); 00047 private: 00048 const descr_extended_event *s; 00049 }; 00050 00051 class ExtendedEventDescriptors : public DescriptorGroup { 00052 public: 00053 int getMaximumTextLength(const char *separation1="\t", const char *separation2="\n"); 00054 //Returns a concatenated version of first the non-itemized and then the itemized text 00055 //same semantics as with SI::String 00056 char *getText(const char *separation1="\t", const char *separation2="\n"); 00057 //buffer must at least be getTextLength(), getMaximumTextLength() is a good choice 00058 char *getText(char *buffer, int size, const char *separation1="\t", const char *separation2="\n"); 00059 00060 //these only return the non-itemized text fields in concatenated form 00061 int getMaximumTextPlainLength(); 00062 char *getTextPlain(); 00063 char *getTextPlain(char *buffer, int size); 00064 00065 //these only return the itemized text fields in concatenated form. 00066 //Between the description and the text the separation1 character is used, 00067 //separation2 used between two pairs. Example: 00068 //Director\tSteven Spielberg\nActor\tMichael Mendl\n 00069 int getMaximumTextItemizedLength(const char *separation1="\t", const char *separation2="\n"); 00070 char *getTextItemized(const char *separation1="\t", const char *separation2="\n"); 00071 char *getTextItemized(char *buffer, int size, const char *separation1="\t", const char *separation2="\n"); 00072 //returns the itemized text pair by pair. Maximum length for buffers is 256. 00073 //Return value is false if and only if the end of the list is reached. 00074 //The argument valid indicates whether the buffers contain valid content. 00075 bool getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText, int sizeItemDescription, int sizeItemText); 00076 }; 00077 00078 class TimeShiftedEventDescriptor : public Descriptor { 00079 public: 00080 int getReferenceServiceId() const; 00081 int getReferenceEventId() const; 00082 protected: 00083 virtual void Parse(); 00084 private: 00085 const descr_time_shifted_event *s; 00086 }; 00087 00088 class ContentDescriptor : public Descriptor { 00089 public: 00090 class Nibble : public LoopElement { 00091 public: 00092 virtual int getLength() { return sizeof(nibble_content); } 00093 int getContentNibbleLevel1() const; 00094 int getContentNibbleLevel2() const; 00095 int getUserNibble1() const; 00096 int getUserNibble2() const; 00097 protected: 00098 virtual void Parse(); 00099 private: 00100 const nibble_content *s; 00101 }; 00102 StructureLoop<Nibble> nibbleLoop; 00103 protected: 00104 virtual void Parse(); 00105 }; 00106 00107 class ParentalRatingDescriptor : public Descriptor { 00108 public: 00109 class Rating : public LoopElement { 00110 public: 00111 char languageCode[4]; 00112 int getRating() const; 00113 virtual int getLength() { return sizeof(parental_rating); } 00114 protected: 00115 virtual void Parse(); 00116 private: 00117 const parental_rating *s; 00118 }; 00119 StructureLoop<Rating> ratingLoop; 00120 protected: 00121 virtual void Parse(); 00122 }; 00123 00124 class TeletextDescriptor : public Descriptor { 00125 public: 00126 class Teletext : public LoopElement { 00127 public: 00128 char languageCode[4]; 00129 int getTeletextType() const; 00130 int getTeletextMagazineNumber() const; 00131 int getTeletextPageNumber() const; 00132 virtual int getLength() { return sizeof(item_teletext); } 00133 protected: 00134 virtual void Parse(); 00135 private: 00136 const item_teletext *s; 00137 }; 00138 StructureLoop<Teletext> teletextLoop; 00139 protected: 00140 virtual void Parse(); 00141 }; 00142 00143 class CaDescriptor : public Descriptor { 00144 public: 00145 int getCaType() const; 00146 int getCaPid() const; 00147 CharArray privateData; 00148 protected: 00149 virtual void Parse(); 00150 private: 00151 const descr_ca *s; 00152 }; 00153 00154 class StreamIdentifierDescriptor : public Descriptor { 00155 public: 00156 int getComponentTag() const; 00157 protected: 00158 virtual void Parse(); 00159 private: 00160 const descr_stream_identifier *s; 00161 }; 00162 00163 class NetworkNameDescriptor : public Descriptor { 00164 public: 00165 String name; 00166 protected: 00167 virtual void Parse(); 00168 }; 00169 00170 class CaIdentifierDescriptor : public Descriptor { 00171 public: 00172 TypeLoop<SixteenBit> identifiers; 00173 protected: 00174 virtual void Parse(); 00175 }; 00176 00177 class CarouselIdentifierDescriptor : public Descriptor { 00178 public: 00179 int getCarouselId() const; 00180 int getFormatId() const; 00181 protected: 00182 virtual void Parse(); 00183 private: 00184 const descr_carousel_identifier *s; 00185 }; 00186 00187 class BouquetNameDescriptor : public NetworkNameDescriptor { 00188 }; 00189 00190 class ServiceListDescriptor : public Descriptor { 00191 public: 00192 class Service : public LoopElement { 00193 public: 00194 int getServiceId() const; 00195 int getServiceType() const; 00196 virtual int getLength() { return sizeof(descr_service_list_loop); } 00197 protected: 00198 virtual void Parse(); 00199 private: 00200 const descr_service_list_loop *s; 00201 }; 00202 StructureLoop<Service> serviceLoop; 00203 protected: 00204 virtual void Parse(); 00205 }; 00206 00207 class SatelliteDeliverySystemDescriptor : public Descriptor { 00208 public: 00209 int getFrequency() const; 00210 int getOrbitalPosition() const; 00211 int getWestEastFlag() const; 00212 int getPolarization() const; 00213 int getModulation() const; 00214 int getSymbolRate() const; 00215 int getFecInner() const; 00216 protected: 00217 virtual void Parse(); 00218 private: 00219 const descr_satellite_delivery_system *s; 00220 }; 00221 00222 class CableDeliverySystemDescriptor : public Descriptor { 00223 public: 00224 int getFrequency() const; 00225 int getFecOuter() const; 00226 int getModulation() const; 00227 int getSymbolRate() const; 00228 int getFecInner() const; 00229 protected: 00230 virtual void Parse(); 00231 private: 00232 const descr_cable_delivery_system *s; 00233 }; 00234 00235 class TerrestrialDeliverySystemDescriptor : public Descriptor { 00236 public: 00237 int getFrequency() const; 00238 int getBandwidth() const; 00239 int getConstellation() const; 00240 int getHierarchy() const; 00241 int getCodeRateHP() const; 00242 int getCodeRateLP() const; 00243 int getGuardInterval() const; 00244 int getTransmissionMode() const; 00245 bool getOtherFrequency() const; 00246 protected: 00247 virtual void Parse(); 00248 private: 00249 const descr_terrestrial_delivery *s; 00250 }; 00251 00252 class ServiceDescriptor : public Descriptor { 00253 public: 00254 int getServiceType() const; 00255 String serviceName; 00256 String providerName; 00257 protected: 00258 virtual void Parse(); 00259 private: 00260 const descr_service *s; 00261 }; 00262 00263 class NVODReferenceDescriptor : public Descriptor { 00264 public: 00265 class Service : public LoopElement { 00266 public: 00267 int getTransportStream() const; 00268 int getOriginalNetworkId() const; 00269 int getServiceId() const; 00270 virtual int getLength() { return sizeof(item_nvod_reference); } 00271 protected: 00272 virtual void Parse(); 00273 private: 00274 const item_nvod_reference *s; 00275 }; 00276 StructureLoop<Service> serviceLoop; 00277 protected: 00278 virtual void Parse(); 00279 }; 00280 00281 class TimeShiftedServiceDescriptor : public Descriptor { 00282 public: 00283 int getReferenceServiceId() const; 00284 protected: 00285 virtual void Parse(); 00286 private: 00287 const descr_time_shifted_service *s; 00288 }; 00289 00290 class ComponentDescriptor : public Descriptor { 00291 public: 00292 int getStreamContent() const; 00293 int getComponentType() const; 00294 int getComponentTag() const; 00295 char languageCode[4]; 00296 String description; 00297 protected: 00298 virtual void Parse(); 00299 private: 00300 const descr_component *s; 00301 }; 00302 00303 class PrivateDataSpecifierDescriptor : public Descriptor { 00304 public: 00305 int getPrivateDataSpecifier() const; 00306 protected: 00307 virtual void Parse(); 00308 private: 00309 const descr_private_data_specifier *s; 00310 }; 00311 00312 class SubtitlingDescriptor : public Descriptor { 00313 public: 00314 class Subtitling : public LoopElement { 00315 public: 00316 char languageCode[4]; 00317 int getSubtitlingType() const; 00318 int getCompositionPageId() const; 00319 int getAncillaryPageId() const; 00320 virtual int getLength() { return sizeof(item_subtitling); } 00321 protected: 00322 virtual void Parse(); 00323 private: 00324 const item_subtitling *s; 00325 }; 00326 StructureLoop<Subtitling> subtitlingLoop; 00327 protected: 00328 virtual void Parse(); 00329 }; 00330 00331 class ServiceMoveDescriptor : public Descriptor { 00332 public: 00333 int getNewOriginalNetworkId() const; 00334 int getNewTransportStreamId() const; 00335 int getNewServiceId() const; 00336 protected: 00337 virtual void Parse(); 00338 private: 00339 const descr_service_move *s; 00340 }; 00341 00342 class FrequencyListDescriptor : public Descriptor { 00343 public: 00344 int getCodingType() const; 00345 TypeLoop<ThirtyTwoBit> frequencies; 00346 protected: 00347 virtual void Parse(); 00348 private: 00349 const descr_frequency_list *s; 00350 }; 00351 00352 class ServiceIdentifierDescriptor : public Descriptor { 00353 public: 00354 String textualServiceIdentifier; 00355 protected: 00356 virtual void Parse(); 00357 }; 00358 00359 //abstract base class 00360 class MultilingualNameDescriptor : public Descriptor { 00361 public: 00362 class Name : public LoopElement { 00363 public: 00364 char languageCode[4]; 00365 String name; 00366 virtual int getLength() { return sizeof(entry_multilingual_name)+name.getLength(); } 00367 protected: 00368 virtual void Parse(); 00369 }; 00370 StructureLoop<Name> nameLoop; 00371 protected: 00372 virtual void Parse(); 00373 }; 00374 00375 class MultilingualNetworkNameDescriptor : public MultilingualNameDescriptor { 00376 //inherits nameLoop from MultilingualNameDescriptor 00377 }; 00378 00379 class MultilingualBouquetNameDescriptor : public MultilingualNameDescriptor { 00380 //inherits nameLoop from MultilingualNameDescriptor 00381 }; 00382 00383 class MultilingualComponentDescriptor : public MultilingualNameDescriptor { 00384 public: 00385 int getComponentTag() const; 00386 //inherits nameLoop from MultilingualNameDescriptor 00387 protected: 00388 virtual void Parse(); 00389 private: 00390 const descr_multilingual_component *s; 00391 }; 00392 00393 class MultilingualServiceNameDescriptor : public Descriptor { 00394 public: 00395 class Name : public MultilingualNameDescriptor::Name { 00396 public: 00397 virtual int getLength() { return sizeof(entry_multilingual_name)+providerName.getLength()+sizeof(entry_multilingual_service_name_mid)+name.getLength(); } 00398 String providerName; 00399 //inherits name, meaning: service name; 00400 protected: 00401 virtual void Parse(); 00402 }; 00403 StructureLoop<Name> nameLoop; 00404 protected: 00405 virtual void Parse(); 00406 }; 00407 00408 class LocalTimeOffsetDescriptor : public Descriptor { 00409 public: 00410 class LocalTimeOffset : public LoopElement { 00411 public: 00412 char countryCode[4]; 00413 virtual int getLength() { return sizeof(local_time_offset_entry); } 00414 int getCountryId() const; 00415 int getLocalTimeOffsetPolarity() const; 00416 int getLocalTimeOffset() const; 00417 time_t getTimeOfChange() const; 00418 int getNextTimeOffset() const; 00419 protected: 00420 virtual void Parse(); 00421 private: 00422 const local_time_offset_entry *s; 00423 }; 00424 StructureLoop<LocalTimeOffset> localTimeOffsetLoop; 00425 protected: 00426 virtual void Parse(); 00427 }; 00428 00429 class LinkageDescriptor : public Descriptor { 00430 public: 00431 int getTransportStreamId() const; 00432 int getOriginalNetworkId() const; 00433 int getServiceId() const; 00434 LinkageType getLinkageType() const; 00435 int getHandOverType() const; 00436 int getOriginType() const; 00437 int getId() const; 00438 CharArray privateData; 00439 protected: 00440 virtual void Parse(); 00441 private: 00442 const descr_linkage *s; 00443 const descr_linkage_8 *s1; 00444 }; 00445 00446 class ISO639LanguageDescriptor : public Descriptor { 00447 public: 00448 char languageCode[4]; //for backwards compatibility 00449 class Language : public LoopElement { 00450 public: 00451 virtual int getLength() { return sizeof(descr_iso_639_language_loop); } 00452 char languageCode[4]; 00453 AudioType getAudioType(); 00454 protected: 00455 virtual void Parse(); 00456 private: 00457 const descr_iso_639_language_loop *s; 00458 }; 00459 StructureLoop<Language> languageLoop; 00460 protected: 00461 virtual void Parse(); 00462 private: 00463 const descr_iso_639_language *s; 00464 }; 00465 00466 class PDCDescriptor : public Descriptor { 00467 public: 00468 int getDay() const; 00469 int getMonth() const; 00470 int getHour() const; 00471 int getMinute() const; 00472 protected: 00473 virtual void Parse(); 00474 private: 00475 const descr_pdc *s; 00476 }; 00477 00478 class AncillaryDataDescriptor : public Descriptor { 00479 public: 00480 int getAncillaryDataIdentifier() const; 00481 protected: 00482 virtual void Parse(); 00483 private: 00484 const descr_ancillary_data *s; 00485 }; 00486 00487 // Private DVB Descriptor Premiere.de 00488 // 0xF2 Content Transmission Descriptor 00489 // http://dvbsnoop.sourceforge.net/examples/example-private-section.html 00490 00491 class PremiereContentTransmissionDescriptor : public Descriptor { 00492 public: 00493 class StartDayEntry : public LoopElement { 00494 public: 00495 class StartTimeEntry : public LoopElement { 00496 public: 00497 virtual int getLength() { return sizeof(item_premiere_content_transmission_time); } 00498 time_t getStartTime(int mjd) const; //UTC 00499 protected: 00500 virtual void Parse(); 00501 private: 00502 const item_premiere_content_transmission_time *s; 00503 }; 00504 StructureLoop<StartTimeEntry> startTimeLoop; 00505 virtual int getLength(); 00506 int getMJD() const; 00507 int getLoopLength() const; 00508 protected: 00509 virtual void Parse(); 00510 private: 00511 const item_premiere_content_transmission_day *s; 00512 }; 00513 StructureLoop<StartDayEntry> startDayLoop; 00514 int getOriginalNetworkId() const; 00515 int getTransportStreamId() const; 00516 int getServiceId() const; 00517 protected: 00518 virtual void Parse(); 00519 private: 00520 const descr_premiere_content_transmission *s; 00521 }; 00522 00523 //a descriptor currently unimplemented in this library 00524 class UnimplementedDescriptor : public Descriptor { 00525 protected: 00526 virtual void Parse() {} 00527 }; 00528 00529 class ApplicationSignallingDescriptor : public Descriptor { 00530 public: 00531 class ApplicationEntryDescriptor : public LoopElement { 00532 public: 00533 virtual int getLength() { return sizeof(application_signalling_entry); } 00534 int getApplicationType() const; 00535 int getAITVersionNumber() const; 00536 protected: 00537 virtual void Parse(); 00538 private: 00539 const application_signalling_entry *s; 00540 }; 00541 StructureLoop<ApplicationEntryDescriptor> entryLoop; 00542 protected: 00543 virtual void Parse(); 00544 }; 00545 00546 class MHP_ApplicationDescriptor : public Descriptor { 00547 public: 00548 class Profile : public LoopElement { 00549 public: 00550 virtual int getLength() { return sizeof(application_profile_entry); } 00551 int getApplicationProfile() const; 00552 int getVersionMajor() const; 00553 int getVersionMinor() const; 00554 int getVersionMicro() const; 00555 private: 00556 const application_profile_entry *s; 00557 protected: 00558 virtual void Parse(); 00559 }; 00560 StructureLoop<Profile> profileLoop; 00561 bool isServiceBound() const; 00562 int getVisibility() const; 00563 int getApplicationPriority() const; 00564 TypeLoop<EightBit> transportProtocolLabels; 00565 private: 00566 const descr_application_end *s; 00567 protected: 00568 virtual void Parse(); 00569 }; 00570 00571 class MHP_ApplicationNameDescriptor : public Descriptor { 00572 public: 00573 class NameEntry : public LoopElement { 00574 public: 00575 virtual int getLength() { return sizeof(descr_application_name_entry)+name.getLength(); } 00576 char languageCode[4]; 00577 String name; 00578 protected: 00579 virtual void Parse(); 00580 }; 00581 StructureLoop<NameEntry> nameLoop; 00582 protected: 00583 virtual void Parse(); 00584 }; 00585 00586 class MHP_TransportProtocolDescriptor : public Descriptor { 00587 public: 00588 enum Protocol { ObjectCarousel = 0x01, IPviaDVB = 0x02, HTTPoverInteractionChannel = 0x03 }; 00589 int getProtocolId() const; 00590 int getProtocolLabel() const; 00591 bool isRemote() const; 00592 int getComponentTag() const; 00593 protected: 00594 virtual void Parse(); 00595 private: 00596 const descr_transport_protocol *s; 00597 bool remote; 00598 int componentTag; 00599 }; 00600 00601 class MHP_DVBJApplicationDescriptor : public Descriptor { 00602 public: 00603 class ApplicationEntry : public LoopElement { 00604 public: 00605 virtual int getLength() { return sizeof(descr_dvbj_application_entry)+parameter.getLength(); } 00606 String parameter; 00607 protected: 00608 virtual void Parse(); 00609 }; 00610 StructureLoop<ApplicationEntry> applicationLoop; 00611 protected: 00612 virtual void Parse(); 00613 }; 00614 00615 class MHP_DVBJApplicationLocationDescriptor : public Descriptor { 00616 public: 00617 String baseDirectory; 00618 String classPath; 00619 String initialClass; 00620 protected: 00621 virtual void Parse(); 00622 }; 00623 00624 class MHP_ApplicationIconsDescriptor : public Descriptor { 00625 public: 00626 String iconLocator; 00627 int getIconFlags() const; 00628 protected: 00629 virtual void Parse(); 00630 private: 00631 const descr_application_icons_descriptor_end *s; 00632 }; 00633 00634 } //end of namespace 00635 00636 #endif //LIBSI_TABLE_H