vdr  1.7.27
descriptor.h
Go to the documentation of this file.
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 2.4 2012/01/11 11:35:17 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 getModulationSystem() const;
00214    int getModulationType() const;
00215    int getRollOff() const;
00216    int getSymbolRate() const;
00217    int getFecInner() const;
00218 protected:
00219    virtual void Parse();
00220 private:
00221    const descr_satellite_delivery_system *s;
00222 };
00223 
00224 class CableDeliverySystemDescriptor : public Descriptor {
00225 public:
00226    int getFrequency() const;
00227    int getFecOuter() const;
00228    int getModulation() const;
00229    int getSymbolRate() const;
00230    int getFecInner() const;
00231 protected:
00232    virtual void Parse();
00233 private:
00234    const descr_cable_delivery_system *s;
00235 };
00236 
00237 class TerrestrialDeliverySystemDescriptor : public Descriptor {
00238 public:
00239    int getFrequency() const;
00240    int getBandwidth() const;
00241    int getPriority() const;
00242    int getTimeSlicingIndicator() const;
00243    int getMpeFecIndicator() const;
00244    int getConstellation() const;
00245    int getHierarchy() const;
00246    int getCodeRateHP() const;
00247    int getCodeRateLP() const;
00248    int getGuardInterval() const;
00249    int getTransmissionMode() const;
00250    bool getOtherFrequency() const;
00251 protected:
00252    virtual void Parse();
00253 private:
00254    const descr_terrestrial_delivery *s;
00255 };
00256 
00257 class ServiceDescriptor : public Descriptor {
00258 public:
00259    int getServiceType() const;
00260    String serviceName;
00261    String providerName;
00262 protected:
00263    virtual void Parse();
00264 private:
00265    const descr_service *s;
00266 };
00267 
00268 class NVODReferenceDescriptor : public Descriptor {
00269 public:
00270    class Service : public LoopElement {
00271    public:
00272       int getTransportStream() const;
00273       int getOriginalNetworkId() const;
00274       int getServiceId() const;
00275       virtual int getLength() { return sizeof(item_nvod_reference); }
00276    protected:
00277       virtual void Parse();
00278    private:
00279       const item_nvod_reference *s;
00280    };
00281    StructureLoop<Service> serviceLoop;
00282 protected:
00283    virtual void Parse();
00284 };
00285 
00286 class TimeShiftedServiceDescriptor : public Descriptor {
00287 public:
00288    int getReferenceServiceId() const;
00289 protected:
00290    virtual void Parse();
00291 private:
00292    const descr_time_shifted_service *s;
00293 };
00294 
00295 class ComponentDescriptor : public Descriptor {
00296 public:
00297    int getStreamContent() const;
00298    int getComponentType() const;
00299    int getComponentTag() const;
00300    char languageCode[4];
00301    String description;
00302 protected:
00303    virtual void Parse();
00304 private:
00305    const descr_component *s;
00306 };
00307 
00308 class PrivateDataSpecifierDescriptor : public Descriptor {
00309 public:
00310    int getPrivateDataSpecifier() const;
00311 protected:
00312    virtual void Parse();
00313 private:
00314    const descr_private_data_specifier *s;
00315 };
00316 
00317 class SubtitlingDescriptor : public Descriptor {
00318 public:
00319    class Subtitling : public LoopElement {
00320    public:
00321       char languageCode[4];
00322       int getSubtitlingType() const;
00323       int getCompositionPageId() const;
00324       int getAncillaryPageId() const;
00325       virtual int getLength() { return sizeof(item_subtitling); }
00326    protected:
00327       virtual void Parse();
00328    private:
00329       const item_subtitling *s;
00330    };
00331    StructureLoop<Subtitling> subtitlingLoop;
00332 protected:
00333    virtual void Parse();
00334 };
00335 
00336 class ServiceMoveDescriptor : public Descriptor {
00337 public:
00338    int getNewOriginalNetworkId() const;
00339    int getNewTransportStreamId() const;
00340    int getNewServiceId() const;
00341 protected:
00342    virtual void Parse();
00343 private:
00344    const descr_service_move *s;
00345 };
00346 
00347 class FrequencyListDescriptor : public Descriptor {
00348 public:
00349    int getCodingType() const;
00350    TypeLoop<ThirtyTwoBit> frequencies;
00351 protected:
00352    virtual void Parse();
00353 private:
00354    const descr_frequency_list *s;
00355 };
00356 
00357 class ServiceIdentifierDescriptor : public Descriptor {
00358 public:
00359    String textualServiceIdentifier;
00360 protected:
00361    virtual void Parse();
00362 };
00363 
00364 class ContentIdentifierDescriptor : public Descriptor {
00365 public:
00366    class Identifier : public LoopElement {
00367    public:
00368       String identifier;
00369       int getCridType() const;
00370       int getCridLocation() const;
00371       virtual int getLength() { return sizeof(content_identifier_entry)+identifier.getLength(); }
00372    protected:
00373       virtual void Parse();
00374    private:
00375       const content_identifier_entry *s;
00376    };
00377    StructureLoop<Identifier> identifierLoop;
00378 protected:
00379    virtual void Parse();
00380 };
00381 
00382 class DefaultAuthorityDescriptor : public Descriptor {
00383 public:
00384    String DefaultAuthority; //ID
00385 protected:
00386    virtual void Parse();
00387 };
00388 
00389 //abstract base class
00390 class MultilingualNameDescriptor : public Descriptor {
00391 public:
00392    class Name : public LoopElement {
00393    public:
00394       char languageCode[4];
00395       String name;
00396       virtual int getLength() { return sizeof(entry_multilingual_name)+name.getLength(); }
00397    protected:
00398       virtual void Parse();
00399    };
00400    StructureLoop<Name> nameLoop;
00401 protected:
00402    virtual void Parse();
00403 };
00404 
00405 class MultilingualNetworkNameDescriptor : public MultilingualNameDescriptor {
00406    //inherits nameLoop from MultilingualNameDescriptor
00407 };
00408 
00409 class MultilingualBouquetNameDescriptor : public MultilingualNameDescriptor {
00410    //inherits nameLoop from MultilingualNameDescriptor
00411 };
00412 
00413 class MultilingualComponentDescriptor : public MultilingualNameDescriptor {
00414 public:
00415    int getComponentTag() const;
00416    //inherits nameLoop from MultilingualNameDescriptor
00417 protected:
00418    virtual void Parse();
00419 private:
00420    const descr_multilingual_component *s;
00421 };
00422 
00423 class MultilingualServiceNameDescriptor : public Descriptor {
00424 public:
00425    class Name : public MultilingualNameDescriptor::Name {
00426    public:
00427       virtual int getLength() { return sizeof(entry_multilingual_name)+providerName.getLength()+sizeof(entry_multilingual_service_name_mid)+name.getLength(); }
00428       String providerName;
00429       //inherits name, meaning: service name;
00430    protected:
00431       virtual void Parse();
00432    };
00433    StructureLoop<Name> nameLoop;
00434 protected:
00435    virtual void Parse();
00436 };
00437 
00438 class LocalTimeOffsetDescriptor : public Descriptor {
00439 public:
00440    class LocalTimeOffset : public LoopElement {
00441    public:
00442       char countryCode[4];
00443       virtual int getLength() { return sizeof(local_time_offset_entry); }
00444       int getCountryId() const;
00445       int getLocalTimeOffsetPolarity() const;
00446       int getLocalTimeOffset() const;
00447       time_t getTimeOfChange() const;
00448       int getNextTimeOffset() const;
00449    protected:
00450       virtual void Parse();
00451    private:
00452       const local_time_offset_entry *s;
00453    };
00454    StructureLoop<LocalTimeOffset> localTimeOffsetLoop;
00455 protected:
00456    virtual void Parse();
00457 };
00458 
00459 class LinkageDescriptor : public Descriptor {
00460 public:
00461    int getTransportStreamId() const;
00462    int getOriginalNetworkId() const;
00463    int getServiceId() const;
00464    LinkageType getLinkageType() const;
00465    int getHandOverType() const;
00466    int getOriginType() const;
00467    int getId() const;
00468    CharArray privateData;
00469 protected:
00470    virtual void Parse();
00471 private:
00472    const descr_linkage *s;
00473    const descr_linkage_8 *s1;
00474 };
00475 
00476 class ISO639LanguageDescriptor : public Descriptor {
00477 public:
00478    char languageCode[4]; //for backwards compatibility
00479    class Language : public LoopElement {
00480    public:
00481       virtual int getLength() { return sizeof(descr_iso_639_language_loop); }
00482       char languageCode[4];
00483       AudioType getAudioType();
00484    protected:
00485       virtual void Parse();
00486    private:
00487       const descr_iso_639_language_loop *s;
00488    };
00489    StructureLoop<Language> languageLoop;
00490 protected:
00491    virtual void Parse();
00492 private:
00493    const descr_iso_639_language *s;
00494 };
00495 
00496 class PDCDescriptor : public Descriptor {
00497 public:
00498    int getDay() const;
00499    int getMonth() const;
00500    int getHour() const;
00501    int getMinute() const;
00502 protected:
00503    virtual void Parse();
00504 private:
00505    const descr_pdc *s;
00506 };
00507 
00508 class AncillaryDataDescriptor : public Descriptor {
00509 public:
00510    int getAncillaryDataIdentifier() const;
00511 protected:
00512    virtual void Parse();
00513 private:
00514    const descr_ancillary_data *s;
00515 };
00516 
00517 class S2SatelliteDeliverySystemDescriptor : public Descriptor {
00518 public:
00519    int getScramblingSequenceSelector() const;
00520    int getMultipleInputStreamFlag() const;
00521    int getBackwardsCompatibilityIndicator() const;
00522    int getScramblingSequenceIndex() const;
00523    int getInputStreamIdentifier() const { return input_stream_identifier; }
00524 protected:
00525    virtual void Parse();
00526 private:
00527    const descr_s2_satellite_delivery_system *s;
00528    const descr_scrambling_sequence_selector *sss;
00529    int input_stream_identifier;
00530 };
00531 
00532 class ExtensionDescriptor : public Descriptor {
00533 public:
00534    int getExtensionDescriptorTag() const;
00535 protected:
00536    virtual void Parse();
00537 private:
00538    const descr_extension *s;
00539 };
00540 
00541 class T2DeliverySystemDescriptor : public Descriptor {
00542 public:
00543    int getExtendedDataFlag() const;
00544    int getExtensionDescriptorTag() const;
00545    int getPlpId() const;
00546    int getT2SystemId() const;
00547    int getSisoMiso() const;
00548    int getBandwidth() const;
00549    int getGuardInterval() const;
00550    int getTransmissionMode() const;
00551    int getOtherFrequencyFlag() const;
00552    int getTfsFlag() const;
00553 protected:
00554    virtual void Parse();
00555 private:
00556    const descr_t2_delivery_system *s;
00557    int extended_data_flag;
00558 };
00559 
00560 // Private DVB Descriptor  Premiere.de
00561 // 0xF2  Content Transmission Descriptor
00562 // http://dvbsnoop.sourceforge.net/examples/example-private-section.html
00563 
00564 class PremiereContentTransmissionDescriptor : public Descriptor {
00565 public:
00566    class StartDayEntry : public LoopElement {
00567    public:
00568       class StartTimeEntry : public LoopElement {
00569       public:
00570          virtual int getLength() { return sizeof(item_premiere_content_transmission_time); }
00571          time_t getStartTime(int mjd) const; //UTC
00572       protected:
00573          virtual void Parse();
00574       private:
00575          const item_premiere_content_transmission_time *s;
00576       };
00577       StructureLoop<StartTimeEntry> startTimeLoop;
00578       virtual int getLength();
00579       int getMJD() const;
00580       int getLoopLength() const;
00581    protected:
00582       virtual void Parse();
00583    private:
00584       const item_premiere_content_transmission_day *s;
00585    };
00586    StructureLoop<StartDayEntry> startDayLoop;
00587    int getOriginalNetworkId() const;
00588    int getTransportStreamId() const;
00589    int getServiceId() const;
00590 protected:
00591    virtual void Parse();
00592 private:
00593    const descr_premiere_content_transmission *s;
00594 };
00595 
00596 //a descriptor currently unimplemented in this library
00597 class UnimplementedDescriptor : public Descriptor {
00598 protected:
00599    virtual void Parse() {}
00600 };
00601 
00602 class ApplicationSignallingDescriptor : public Descriptor {
00603 public:
00604    class ApplicationEntryDescriptor : public LoopElement {
00605    public:
00606       virtual int getLength() { return sizeof(application_signalling_entry); }
00607       int getApplicationType() const;
00608       int getAITVersionNumber() const;
00609    protected:
00610       virtual void Parse();
00611    private:
00612       const application_signalling_entry *s;
00613    };
00614    StructureLoop<ApplicationEntryDescriptor> entryLoop;
00615 protected:
00616    virtual void Parse();
00617 };
00618 
00619 class MHP_ApplicationDescriptor : public Descriptor {
00620 public:
00621    class Profile : public LoopElement {
00622    public:
00623       virtual int getLength() { return sizeof(application_profile_entry); }
00624       int getApplicationProfile() const;
00625       int getVersionMajor() const;
00626       int getVersionMinor() const;
00627       int getVersionMicro() const;
00628    private:
00629       const application_profile_entry *s;
00630    protected:
00631       virtual void Parse();
00632    };
00633    StructureLoop<Profile> profileLoop;
00634    bool isServiceBound() const;
00635    int getVisibility() const;
00636    int getApplicationPriority() const;
00637    TypeLoop<EightBit> transportProtocolLabels;
00638 private:
00639    const descr_application_end *s;
00640 protected:
00641    virtual void Parse();
00642 };
00643 
00644 class MHP_ApplicationNameDescriptor : public Descriptor {
00645 public:
00646    class NameEntry : public LoopElement {
00647    public:
00648       virtual int getLength() { return sizeof(descr_application_name_entry)+name.getLength(); }
00649       char languageCode[4];
00650       String name;
00651    protected:
00652       virtual void Parse();
00653    };
00654    StructureLoop<NameEntry> nameLoop;
00655 protected:
00656    virtual void Parse();
00657 };
00658 
00659 class MHP_TransportProtocolDescriptor : public Descriptor {
00660 public:
00661    class UrlExtensionEntry : public LoopElement {
00662    public:
00663       virtual int getLength() { return sizeof(descr_url_extension_entry)+UrlExtension.getLength(); }
00664       String UrlExtension;
00665    protected:
00666       virtual void Parse();
00667    };
00668 
00669    enum Protocol { ObjectCarousel = 0x01, IPviaDVB = 0x02, HTTPoverInteractionChannel = 0x03 };
00670    int getProtocolId() const;
00671    int getProtocolLabel() const;
00672    bool isRemote() const;
00673    int getComponentTag() const;
00674    char *getUrlBase(char *buffer, int size);
00675    StructureLoop<UrlExtensionEntry> UrlExtensionLoop;
00676 
00677 protected:
00678    virtual void Parse();
00679 private:
00680    const descr_transport_protocol *s;
00681    bool remote;
00682    int componentTag;
00683    String UrlBase;
00684 };
00685 
00686 class MHP_DVBJApplicationDescriptor : public Descriptor {
00687 public:
00688    class ApplicationEntry : public LoopElement {
00689    public:
00690       virtual int getLength() { return sizeof(descr_dvbj_application_entry)+parameter.getLength(); }
00691       String parameter;
00692    protected:
00693       virtual void Parse();
00694    };
00695    StructureLoop<ApplicationEntry> applicationLoop;
00696 protected:
00697    virtual void Parse();
00698 };
00699 
00700 class MHP_DVBJApplicationLocationDescriptor : public Descriptor {
00701 public:
00702    String baseDirectory;
00703    String classPath;
00704    String initialClass;
00705 protected:
00706    virtual void Parse();
00707 };
00708 
00709 class MHP_ApplicationIconsDescriptor : public Descriptor {
00710 public:
00711    String iconLocator;
00712    int getIconFlags() const;
00713 protected:
00714    virtual void Parse();
00715 private:
00716    const descr_application_icons_descriptor_end *s;
00717 };
00718 
00719 class MHP_SimpleApplicationLocationDescriptor : public Descriptor {
00720 public:
00721    char *getLocation(char *buffer, int size);
00722 protected:
00723    virtual void Parse();
00724 private:
00725    String location;
00726 };
00727 
00728 class RegistrationDescriptor : public Descriptor {
00729 public:
00730    int getFormatIdentifier() const;
00731    CharArray privateData;
00732 protected:
00733    virtual void Parse();
00734 private:
00735    const descr_registration *s;
00736 };
00737 
00738 } //end of namespace
00739 
00740 #endif //LIBSI_TABLE_H