vdr-1.4.7/libsi/descriptor.c

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.c 1.21 2006/05/28 14:25:30 kls Exp $
00010  *                                                                         *
00011  ***************************************************************************/
00012 
00013 #include <string.h>
00014 #include "descriptor.h"
00015 
00016 namespace SI {
00017 
00018 void ShortEventDescriptor::Parse() {
00019    int offset=0;
00020    const descr_short_event *s;
00021    data.setPointerAndOffset<const descr_short_event>(s, offset);
00022    languageCode[0]=s->lang_code1;
00023    languageCode[1]=s->lang_code2;
00024    languageCode[2]=s->lang_code3;
00025    languageCode[3]=0;
00026    name.setDataAndOffset(data+offset, s->event_name_length, offset);
00027    const descr_short_event_mid *mid;
00028    data.setPointerAndOffset<const descr_short_event_mid>(mid, offset);
00029    text.setData(data+offset, mid->text_length);
00030 }
00031 
00032 int ExtendedEventDescriptor::getDescriptorNumber() {
00033    return s->descriptor_number;
00034 }
00035 
00036 int ExtendedEventDescriptor::getLastDescriptorNumber() {
00037    return s->last_descriptor_number;
00038 }
00039 
00040 void ExtendedEventDescriptor::Parse() {
00041    int offset=0;
00042    data.setPointerAndOffset<const descr_extended_event>(s, offset);
00043    languageCode[0]=s->lang_code1;
00044    languageCode[1]=s->lang_code2;
00045    languageCode[2]=s->lang_code3;
00046    languageCode[3]=0;
00047    itemLoop.setDataAndOffset(data+offset, s->length_of_items, offset);
00048    const descr_extended_event_mid *mid;
00049    data.setPointerAndOffset<const descr_extended_event_mid>(mid, offset);
00050    text.setData(data+offset, mid->text_length);
00051 }
00052 
00053 void ExtendedEventDescriptor::Item::Parse() {
00054    int offset=0;
00055    const item_extended_event *first;
00056    data.setPointerAndOffset<const item_extended_event>(first, offset);
00057    itemDescription.setDataAndOffset(data+offset, first->item_description_length, offset);
00058    const item_extended_event_mid *mid;
00059    data.setPointerAndOffset<const item_extended_event_mid>(mid, offset);
00060    item.setData(data+offset, mid->item_length);
00061 }
00062 
00063 /*int ExtendedEventDescriptors::getTextLength() {
00064    int ret=0;
00065    for (int i=0;i<length;i++) {
00066       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00067       if (!d)
00068          continue;
00069       ret+=d->text.getLength();
00070       ExtendedEventDescriptor::Item item;
00071       for (Loop::Iterator it; d->itemLoop.hasNext(it);   ) {
00072          item=d->itemLoop.getNext(it);
00073          ret+=item.item.getLength();
00074          ret+=item.itemDescription.getLength();
00075          ret+=2; //the blanks
00076       }
00077    }
00078    return ret;
00079 }*/
00080 
00081 int ExtendedEventDescriptors::getMaximumTextLength(const char *separation1, const char *separation2) {
00082    //add length of plain text, of itemized text with separators, and for one separator between the two fields.
00083    return getMaximumTextPlainLength()+getMaximumTextItemizedLength(separation1, separation2)+strlen(separation2);
00084 }
00085 
00086 char *ExtendedEventDescriptors::getText(const char *separation1, const char *separation2) {
00087    int size = getMaximumTextLength(separation1, separation2);
00088    char *text=new char[size];
00089    return getText(text, size, separation1, separation2);
00090 }
00091 
00092 char *ExtendedEventDescriptors::getText(char *buffer, int size, const char *separation1, const char *separation2) {
00093    int index=0, len;
00094    for (int i=0;i<length;i++) {
00095       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00096       if (!d)
00097          continue;
00098       d->text.getText(buffer+index, size);
00099       len = strlen(buffer+index);
00100       index += len;
00101       size -= len;
00102    }
00103 
00104    int sepLen1 = strlen(separation1);
00105    int sepLen2 = strlen(separation2);
00106    bool separated = false;
00107    for (int i=0;i<length;i++) {
00108       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00109       if (!d)
00110          continue;
00111 
00112       ExtendedEventDescriptor::Item item;
00113       for (Loop::Iterator it; d->itemLoop.getNext(item, it);   ) {
00114          if (!separated && size > sepLen2) {
00115             strcpy(buffer+index, separation2); // let's have a separator between the long text and the items
00116             index += sepLen2;
00117             size -= sepLen2;
00118             separated = true;
00119          }
00120 
00121          item.itemDescription.getText(buffer+index, size);
00122          len = strlen(buffer+index);
00123          index += len;
00124          size -= len;
00125          if (size > sepLen1) {
00126             strcpy(buffer+index, separation1);
00127             index += sepLen1;
00128             size -= sepLen1;
00129          }
00130 
00131          item.item.getText(buffer+index, size);
00132          len = strlen(buffer+index);
00133          index += len;
00134          size -= len;
00135          if (size > sepLen2) {
00136             strcpy(buffer+index, separation2);
00137             index += sepLen2;
00138             size -= sepLen2;
00139          }
00140       }
00141    }
00142 
00143    buffer[index]='\0';
00144    return buffer;
00145 }
00146 
00147 int ExtendedEventDescriptors::getMaximumTextPlainLength() {
00148    int ret=0;
00149    for (int i=0;i<length;i++) {
00150       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00151       if (!d)
00152          continue;
00153       ret+=d->text.getLength();
00154    }
00155    return ret;
00156 }
00157 
00158 char *ExtendedEventDescriptors::getTextPlain() {
00159    int size = getMaximumTextPlainLength();
00160    char *text=new char[size];
00161    return getTextPlain(text, size);
00162 }
00163 
00164 char *ExtendedEventDescriptors::getTextPlain(char *buffer, int size) {
00165    int index=0, len;
00166    for (int i=0;i<length;i++) {
00167       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00168       if (!d)
00169          continue;
00170       d->text.getText(buffer+index, size);
00171       len = strlen(buffer+index);
00172       index += len;
00173       size -= len;
00174    }
00175    buffer[index]='\0';
00176    return buffer;
00177 }
00178 
00179 int ExtendedEventDescriptors::getMaximumTextItemizedLength(const char *separation1, const char *separation2) {
00180    int ret=0;
00181    int sepLength=strlen(separation1)+strlen(separation2);
00182    for (int i=0;i<length;i++) {
00183       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00184       if (!d)
00185          continue;
00186       //The length includes two 8-bit length fields which have already been subtracted from sepLength //XXX kls 2004-06-06: what does this mean???
00187       ret+=d->itemLoop.getLength()+sepLength;
00188    }
00189    return ret;
00190 }
00191 
00192 char *ExtendedEventDescriptors::getTextItemized(const char *separation1, const char *separation2) {
00193    int size = getMaximumTextItemizedLength(separation1, separation2);
00194    char *text=new char[size];
00195    return getTextItemized(text, size, separation1, separation2);
00196 }
00197 
00198 char *ExtendedEventDescriptors::getTextItemized(char *buffer, int size, const char *separation1, const char *separation2) {
00199    int index=0, len;
00200    int sepLen1 = strlen(separation1);
00201    int sepLen2 = strlen(separation2);
00202    for (int i=0;i<length;i++) {
00203       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
00204       if (!d)
00205          continue;
00206 
00207       ExtendedEventDescriptor::Item item;
00208       for (Loop::Iterator it; d->itemLoop.getNext(item, it);   ) {
00209          item.itemDescription.getText(buffer+index, size);
00210          len = strlen(buffer+index);
00211          index += len;
00212          size -= len;
00213          if (size > sepLen1) {
00214             strcpy(buffer+index, separation1);
00215             index += sepLen1;
00216             size -= sepLen1;
00217          }
00218 
00219          item.item.getText(buffer+index, size);
00220          len = strlen(buffer+index);
00221          index += len;
00222          size -= len;
00223          if (size > sepLen2) {
00224             strcpy(buffer+index, separation2);
00225             index += sepLen2;
00226             size -= sepLen2;
00227          }
00228       }
00229    }
00230    buffer[index]='\0';
00231    return buffer;
00232 }
00233 
00234 //returns the itemized text pair by pair. Maximum length for buffers is 256.
00235 //Return value is false if and only if the end of the list is reached.
00236 bool ExtendedEventDescriptors::getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText, int sizeItemDescription, int sizeItemText) {
00237    //The iterator has to store two values: The descriptor index (4bit)
00238    //and the item loop index (max overall length 256, min item length 16 => max number 128 => 7bit)
00239    valid=false;
00240 
00241    int index=(it.i & 0x780) >> 7; // 0x780 == 1111 000 0000
00242    it.i &= 0x7F; //0x7F == 111 1111
00243 
00244    for (;index<length;index++) {
00245       ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[index];
00246       if (!d)
00247          continue;
00248 
00249       ExtendedEventDescriptor::Item item;
00250       if (d->itemLoop.getNext(item, it)) {
00251          item.item.getText(itemDescription, sizeItemDescription);
00252          item.itemDescription.getText(itemText, sizeItemText);
00253          valid=true;
00254          break;
00255       } else {
00256          it.reset();
00257          continue;
00258       }
00259    }
00260 
00261    it.i &= 0x7F;
00262    it.i |= (index & 0xF) << 7; //0xF == 1111
00263 
00264    return index<length;
00265 }
00266 
00267 int TimeShiftedEventDescriptor::getReferenceServiceId() const {
00268    return HILO(s->reference_service_id);
00269 }
00270 
00271 int TimeShiftedEventDescriptor::getReferenceEventId() const {
00272    return HILO(s->reference_event_id);
00273 }
00274 
00275 void TimeShiftedEventDescriptor::Parse() {
00276    s=data.getData<const descr_time_shifted_event>();
00277 }
00278 
00279 void ContentDescriptor::Parse() {
00280    //this descriptor is only a header and a loop
00281    nibbleLoop.setData(data+sizeof(descr_content), getLength()-sizeof(descr_content));
00282 }
00283 
00284 int ContentDescriptor::Nibble::getContentNibbleLevel1() const {
00285    return s->content_nibble_level_1;
00286 }
00287 
00288 int ContentDescriptor::Nibble::getContentNibbleLevel2() const {
00289    return s->content_nibble_level_2;
00290 }
00291 
00292 int ContentDescriptor::Nibble::getUserNibble1() const {
00293    return s->user_nibble_1;
00294 }
00295 
00296 int ContentDescriptor::Nibble::getUserNibble2() const {
00297    return s->user_nibble_2;
00298 }
00299 
00300 void ContentDescriptor::Nibble::Parse() {
00301    s=data.getData<const nibble_content>();
00302 }
00303 
00304 void ParentalRatingDescriptor::Parse() {
00305    //this descriptor is only a header and a loop
00306    ratingLoop.setData(data+sizeof(descr_parental_rating), getLength()-sizeof(descr_parental_rating));
00307 }
00308 
00309 int ParentalRatingDescriptor::Rating::getRating() const {
00310    return s->rating;
00311 }
00312 
00313 void ParentalRatingDescriptor::Rating::Parse() {
00314    s=data.getData<const parental_rating>();
00315    languageCode[0]=s->lang_code1;
00316    languageCode[1]=s->lang_code2;
00317    languageCode[2]=s->lang_code3;
00318    languageCode[3]=0;
00319 }
00320 
00321 void TeletextDescriptor::Parse() {
00322    //this descriptor is only a header and a loop
00323    teletextLoop.setData(data+sizeof(descr_teletext), getLength()-sizeof(descr_teletext));
00324 }
00325 
00326 void TeletextDescriptor::Teletext::Parse() {
00327    s=data.getData<const item_teletext>();
00328    languageCode[0]=s->lang_code1;
00329    languageCode[1]=s->lang_code2;
00330    languageCode[2]=s->lang_code3;
00331    languageCode[3]=0;
00332 }
00333 
00334 int TeletextDescriptor::Teletext::getTeletextType() const {
00335    return s->type;
00336 }
00337 
00338 int TeletextDescriptor::Teletext::getTeletextMagazineNumber() const {
00339    return s->magazine_number;
00340 }
00341 
00342 int TeletextDescriptor::Teletext::getTeletextPageNumber() const {
00343    return s->page_number;
00344 }
00345 
00346 int CaDescriptor::getCaType() const {
00347    return HILO(s->CA_type);
00348 }
00349 
00350 int CaDescriptor::getCaPid() const {
00351    return HILO(s->CA_PID);
00352 }
00353 
00354 void CaDescriptor::Parse() {
00355    int offset=0;
00356    data.setPointerAndOffset<const descr_ca>(s, offset);
00357    if (checkSize(getLength()-offset))
00358       privateData.assign(data.getData(offset), getLength()-offset);
00359 }
00360 
00361 int StreamIdentifierDescriptor::getComponentTag() const {
00362    return s->component_tag;
00363 }
00364 
00365 void StreamIdentifierDescriptor::Parse() {
00366    s=data.getData<const descr_stream_identifier>();
00367 }
00368 
00369 void NetworkNameDescriptor::Parse() {
00370    name.setData(data+sizeof(descr_network_name), getLength()-sizeof(descr_network_name));
00371 }
00372 
00373 void CaIdentifierDescriptor::Parse() {
00374    identifiers.setData(data+sizeof(descr_ca_identifier), getLength()-sizeof(descr_ca_identifier));
00375 }
00376 
00377 int CarouselIdentifierDescriptor::getCarouselId() const {
00378    return (HILO(s->carousel_id_hi) << 16) | HILO(s->carousel_id_lo);
00379 }
00380 
00381 int CarouselIdentifierDescriptor::getFormatId() const {
00382    return s->FormatId;
00383 }
00384 
00385 void CarouselIdentifierDescriptor::Parse() {
00386    s=data.getData<const descr_carousel_identifier>();
00387 }
00388 
00389 void ServiceListDescriptor::Parse() {
00390    serviceLoop.setData(data+sizeof(descr_service_list), getLength()-sizeof(descr_service_list));
00391 }
00392 
00393 int ServiceListDescriptor::Service::getServiceId() const {
00394    return HILO(s->service_id);
00395 }
00396 
00397 int ServiceListDescriptor::Service::getServiceType() const {
00398    return s->service_type;
00399 }
00400 
00401 void ServiceListDescriptor::Service::Parse() {
00402    s=data.getData<const descr_service_list_loop>();
00403 }
00404 
00405 int SatelliteDeliverySystemDescriptor::getFrequency() const {
00406    return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
00407 }
00408 
00409 int SatelliteDeliverySystemDescriptor::getOrbitalPosition() const {
00410    return HILO(s->orbital_position);
00411 }
00412 
00413 int SatelliteDeliverySystemDescriptor::getWestEastFlag() const {
00414    return s->west_east_flag;
00415 }
00416 
00417 int SatelliteDeliverySystemDescriptor::getPolarization() const {
00418    return s->polarization;
00419 }
00420 
00421 int SatelliteDeliverySystemDescriptor::getModulation() const {
00422    return s->modulation;
00423 }
00424 
00425 int SatelliteDeliverySystemDescriptor::getSymbolRate() const {
00426    return (HILO(s->symbol_rate_hi) << 12) | (s->symbol_rate_lo_1 << 4) | s->symbol_rate_lo_2;
00427 }
00428 
00429 int SatelliteDeliverySystemDescriptor::getFecInner() const {
00430    return s->fec_inner;
00431 }
00432 
00433 void SatelliteDeliverySystemDescriptor::Parse() {
00434    s=data.getData<const descr_satellite_delivery_system>();
00435 }
00436 
00437 int CableDeliverySystemDescriptor::getFrequency() const {
00438    return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
00439 }
00440 
00441 int CableDeliverySystemDescriptor::getFecOuter() const {
00442    return s->fec_outer;
00443 }
00444 
00445 int CableDeliverySystemDescriptor::getModulation() const {
00446    return s->modulation;
00447 }
00448 
00449 int CableDeliverySystemDescriptor::getSymbolRate() const {
00450    return (HILO(s->symbol_rate_hi) << 12) | (s->symbol_rate_lo_1 << 4) | s->symbol_rate_lo_2;
00451 }
00452 
00453 int CableDeliverySystemDescriptor::getFecInner() const {
00454    return s->fec_inner;
00455 }
00456 
00457 void CableDeliverySystemDescriptor::Parse() {
00458    s=data.getData<const descr_cable_delivery_system>();
00459 }
00460 
00461 int TerrestrialDeliverySystemDescriptor::getFrequency() const {
00462    return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
00463 }
00464 
00465 int TerrestrialDeliverySystemDescriptor::getBandwidth() const {
00466    return s->bandwidth;
00467 }
00468 
00469 int TerrestrialDeliverySystemDescriptor::getConstellation() const {
00470    return s->constellation;
00471 }
00472 
00473 int TerrestrialDeliverySystemDescriptor::getHierarchy() const {
00474    return s->hierarchy;
00475 }
00476 
00477 int TerrestrialDeliverySystemDescriptor::getCodeRateHP() const {
00478    return s->code_rate_HP;
00479 }
00480 
00481 int TerrestrialDeliverySystemDescriptor::getCodeRateLP() const {
00482    return s->code_rate_LP;
00483 }
00484 
00485 int TerrestrialDeliverySystemDescriptor::getGuardInterval() const {
00486    return s->guard_interval;
00487 }
00488 
00489 int TerrestrialDeliverySystemDescriptor::getTransmissionMode() const {
00490    return s->transmission_mode;
00491 }
00492 
00493 bool TerrestrialDeliverySystemDescriptor::getOtherFrequency() const {
00494    return s->other_frequency_flag;
00495 }
00496 
00497 void TerrestrialDeliverySystemDescriptor::Parse() {
00498    s=data.getData<const descr_terrestrial_delivery>();
00499 }
00500 
00501 int ServiceDescriptor::getServiceType() const {
00502    return s->service_type;
00503 }
00504 
00505 void ServiceDescriptor::Parse() {
00506    int offset=0;
00507    data.setPointerAndOffset<const descr_service>(s, offset);
00508    providerName.setDataAndOffset(data+offset, s->provider_name_length, offset);
00509    const descr_service_mid *mid;
00510    data.setPointerAndOffset<const descr_service_mid>(mid, offset);
00511    serviceName.setData(data+offset, mid->service_name_length);
00512 }
00513 
00514 void NVODReferenceDescriptor::Parse() {
00515    serviceLoop.setData(data+sizeof(descr_nvod_reference), getLength()-sizeof(descr_nvod_reference));
00516 }
00517 
00518 int NVODReferenceDescriptor::Service::getTransportStream() const {
00519    return HILO(s->transport_stream_id);
00520 }
00521 
00522 int NVODReferenceDescriptor::Service::getOriginalNetworkId() const {
00523    return HILO(s->original_network_id);
00524 }
00525 
00526 int NVODReferenceDescriptor::Service::getServiceId() const {
00527    return HILO(s->service_id);
00528 }
00529 
00530 void NVODReferenceDescriptor::Service::Parse() {
00531    s=data.getData<const item_nvod_reference>();
00532 }
00533 
00534 int TimeShiftedServiceDescriptor::getReferenceServiceId() const {
00535    return HILO(s->reference_service_id);
00536 }
00537 
00538 void TimeShiftedServiceDescriptor::Parse() {
00539    s=data.getData<const descr_time_shifted_service>();
00540 }
00541 
00542 int ComponentDescriptor::getStreamContent() const {
00543    return s->stream_content;
00544 }
00545 
00546 int ComponentDescriptor::getComponentType() const {
00547    return s->component_type;
00548 }
00549 
00550 int ComponentDescriptor::getComponentTag() const {
00551    return s->component_tag;
00552 }
00553 
00554 void ComponentDescriptor::Parse() {
00555    int offset=0;
00556    data.setPointerAndOffset<const descr_component>(s, offset);
00557    languageCode[0]=s->lang_code1;
00558    languageCode[1]=s->lang_code2;
00559    languageCode[2]=s->lang_code3;
00560    languageCode[3]=0;
00561    description.setData(data+offset, getLength()-offset);
00562 }
00563 
00564 void PrivateDataSpecifierDescriptor::Parse() {
00565    s=data.getData<const descr_private_data_specifier>();
00566 }
00567 
00568 int PrivateDataSpecifierDescriptor::getPrivateDataSpecifier() const {
00569    return (HILO(s->private_data_specifier_hi) << 16) | HILO(s->private_data_specifier_lo);
00570 }
00571 
00572 void SubtitlingDescriptor::Parse() {
00573    subtitlingLoop.setData(data+sizeof(descr_subtitling), getLength()-sizeof(descr_subtitling));
00574 }
00575 
00576 int SubtitlingDescriptor::Subtitling::getSubtitlingType() const {
00577    return s->subtitling_type;
00578 }
00579 
00580 int SubtitlingDescriptor::Subtitling::getCompositionPageId() const {
00581    return HILO(s->composition_page_id);
00582 }
00583 
00584 int SubtitlingDescriptor::Subtitling::getAncillaryPageId() const {
00585    return HILO(s->ancillary_page_id);
00586 }
00587 
00588 void SubtitlingDescriptor::Subtitling::Parse() {
00589    s=data.getData<const item_subtitling>();
00590    languageCode[0]=s->lang_code1;
00591    languageCode[1]=s->lang_code2;
00592    languageCode[2]=s->lang_code3;
00593    languageCode[3]=0;
00594 }
00595 
00596 int ServiceMoveDescriptor::getNewOriginalNetworkId() const {
00597    return HILO(s->new_original_network_id);
00598 }
00599 
00600 int ServiceMoveDescriptor::getNewTransportStreamId() const {
00601    return HILO(s->new_transport_stream_id);
00602 }
00603 
00604 int ServiceMoveDescriptor::getNewServiceId() const {
00605    return HILO(s->new_service_id);
00606 }
00607 
00608 void ServiceMoveDescriptor::Parse() {
00609    s=data.getData<const descr_service_move>();
00610 }
00611 
00612 int FrequencyListDescriptor::getCodingType() const {
00613    return s->coding_type;
00614 }
00615 
00616 void FrequencyListDescriptor::Parse() {
00617    int offset=0;
00618    data.setPointerAndOffset<const descr_frequency_list>(s, offset);
00619    frequencies.setData(data+offset, getLength()-offset);
00620 }
00621 
00622 void ServiceIdentifierDescriptor::Parse() {
00623    textualServiceIdentifier.setData(data+sizeof(descr_service_identifier), getLength()-sizeof(descr_service_identifier));
00624 }
00625 
00626 void MultilingualNameDescriptor::Parse() {
00627    nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
00628 }
00629 
00630 void MultilingualNameDescriptor::Name::Parse() {
00631    int offset=0;
00632    const entry_multilingual_name *s;
00633    data.setPointerAndOffset<const entry_multilingual_name>(s, offset);
00634    languageCode[0]=s->lang_code1;
00635    languageCode[1]=s->lang_code2;
00636    languageCode[2]=s->lang_code3;
00637    languageCode[3]=0;
00638    name.setData(data+offset, s->text_length);
00639 }
00640 
00641 int MultilingualComponentDescriptor::getComponentTag() const {
00642    return s->component_tag;
00643 }
00644 
00645 void MultilingualComponentDescriptor::Parse() {
00646    int offset=0;
00647    data.setPointerAndOffset<const descr_multilingual_component>(s, offset);
00648    nameLoop.setData(data+sizeof(descr_multilingual_component), getLength()-sizeof(descr_multilingual_component));
00649 }
00650 
00651 void MultilingualServiceNameDescriptor::Parse() {
00652    nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
00653 }
00654 
00655 void MultilingualServiceNameDescriptor::Name::Parse() {
00656    int offset=0;
00657    const entry_multilingual_name *s;
00658    data.setPointerAndOffset<const entry_multilingual_name>(s, offset);
00659    languageCode[0]=s->lang_code1;
00660    languageCode[1]=s->lang_code2;
00661    languageCode[2]=s->lang_code3;
00662    languageCode[3]=0;
00663    providerName.setDataAndOffset(data+offset, s->text_length, offset);
00664    const entry_multilingual_service_name_mid *mid;
00665    data.setPointerAndOffset<const entry_multilingual_service_name_mid>(mid, offset);
00666    name.setData(data+offset, mid->service_name_length);
00667 }
00668 
00669 void LocalTimeOffsetDescriptor::Parse() {
00670    localTimeOffsetLoop.setData(data+sizeof(descr_local_time_offset), getLength()-sizeof(descr_local_time_offset));
00671 }
00672 
00673 int LocalTimeOffsetDescriptor::LocalTimeOffset::getCountryId() const {
00674    return s->country_region_id;
00675 }
00676 
00677 int LocalTimeOffsetDescriptor::LocalTimeOffset::getLocalTimeOffsetPolarity() const {
00678    return s->local_time_offset_polarity;
00679 }
00680 
00681 int LocalTimeOffsetDescriptor::LocalTimeOffset::getLocalTimeOffset() const {
00682    return (s->local_time_offset_h << 8) | s->local_time_offset_m;
00683 }
00684 
00685 time_t LocalTimeOffsetDescriptor::LocalTimeOffset::getTimeOfChange() const {
00686    return DVBTime::getTime(s->time_of_change_mjd_hi, s->time_of_change_mjd_lo, s->time_of_change_time_h, s->time_of_change_time_m, s->time_of_change_time_s);
00687 }
00688 
00689 int LocalTimeOffsetDescriptor::LocalTimeOffset::getNextTimeOffset() const {
00690    return (s->next_time_offset_h << 8) | s->next_time_offset_m;
00691 }
00692 
00693 void LocalTimeOffsetDescriptor::LocalTimeOffset::Parse() {
00694    s=data.getData<const local_time_offset_entry>();
00695    countryCode[0]=s->country_code1;
00696    countryCode[1]=s->country_code2;
00697    countryCode[2]=s->country_code3;
00698    countryCode[3]=0;
00699 }
00700 
00701 void LinkageDescriptor::Parse() {
00702    int offset=0;
00703    s1 = NULL;
00704    data.setPointerAndOffset<const descr_linkage>(s, offset);
00705    if (checkSize(getLength()-offset)) {
00706       if (getLinkageType() == LinkageTypeMobileHandover)
00707          data.setPointerAndOffset<const descr_linkage_8>(s1, offset);
00708       privateData.assign(data.getData(offset), getLength()-offset);
00709       }
00710 }
00711 
00712 int LinkageDescriptor::getTransportStreamId() const {
00713    return HILO(s->transport_stream_id);
00714 }
00715 
00716 int LinkageDescriptor::getOriginalNetworkId() const {
00717    return HILO(s->original_network_id);
00718 }
00719 
00720 int LinkageDescriptor::getServiceId() const {
00721    return HILO(s->service_id);
00722 }
00723 
00724 LinkageType LinkageDescriptor::getLinkageType() const {
00725    return (LinkageType)s->linkage_type;
00726 }
00727 
00728 int LinkageDescriptor::getHandOverType() const {
00729    return s1 == NULL ? 0 : s1->hand_over_type;
00730 }
00731 
00732 int LinkageDescriptor::getOriginType() const {
00733    return s1 == NULL ? 0 : s1->origin_type;
00734 }
00735 
00736 int LinkageDescriptor::getId() const {
00737    return s1 == NULL ? 0 : HILO(s1->id);
00738 }
00739 
00740 void ISO639LanguageDescriptor::Parse() {
00741    languageLoop.setData(data+sizeof(descr_iso_639_language), getLength()-sizeof(descr_iso_639_language));
00742 
00743    //all this is for backwards compatibility only
00744    Loop::Iterator it;
00745    Language first;
00746    if (languageLoop.getNext(first, it)) {
00747       languageCode[0]=first.languageCode[0];
00748       languageCode[1]=first.languageCode[1];
00749       languageCode[2]=first.languageCode[2];
00750       languageCode[3]=0;
00751    } else
00752       languageCode[0]=0;
00753 }
00754 
00755 void ISO639LanguageDescriptor::Language::Parse() {
00756    s=data.getData<const descr_iso_639_language_loop>();
00757    languageCode[0]=s->lang_code1;
00758    languageCode[1]=s->lang_code2;
00759    languageCode[2]=s->lang_code3;
00760    languageCode[3]=0;
00761 }
00762 
00763 AudioType ISO639LanguageDescriptor::Language::getAudioType() {
00764    return (AudioType)s->audio_type;
00765 }
00766 
00767 void PDCDescriptor::Parse() {
00768    int offset=0;
00769    data.setPointerAndOffset<const descr_pdc>(s, offset);
00770 }
00771 
00772 int PDCDescriptor::getDay() const {
00773    return ((s->pil0 & 0x0F) << 1) | ((s->pil1 & 0x80) >> 7);
00774 }
00775 
00776 int PDCDescriptor::getMonth() const {
00777    return (s->pil1 >> 3) & 0x0F;
00778 }
00779 
00780 int PDCDescriptor::getHour() const {
00781    return ((s->pil1 & 0x07) << 2) | ((s->pil2 & 0xC0) >> 6);
00782 }
00783 
00784 int PDCDescriptor::getMinute() const {
00785    return s->pil2 & 0x3F;
00786 }
00787 
00788 void AncillaryDataDescriptor::Parse() {
00789    int offset=0;
00790    data.setPointerAndOffset<const descr_ancillary_data>(s, offset);
00791 }
00792 
00793 int AncillaryDataDescriptor::getAncillaryDataIdentifier() const {
00794    return s->ancillary_data_identifier;
00795 }
00796 
00797 int PremiereContentTransmissionDescriptor::getOriginalNetworkId() const {
00798    return HILO(s->original_network_id);
00799 }
00800 
00801 int PremiereContentTransmissionDescriptor::getTransportStreamId() const {
00802    return HILO(s->transport_stream_id);
00803 }
00804 
00805 int PremiereContentTransmissionDescriptor::getServiceId() const {
00806    return HILO(s->service_id);
00807 }
00808 
00809 void PremiereContentTransmissionDescriptor::Parse() {
00810    s=data.getData<const descr_premiere_content_transmission>();
00811    startDayLoop.setData(data+sizeof(descr_premiere_content_transmission), getLength()-sizeof(descr_premiere_content_transmission));
00812 }
00813 
00814 int PremiereContentTransmissionDescriptor::StartDayEntry::getMJD() const {
00815    return HILO(s->mjd);
00816 }
00817 
00818 int PremiereContentTransmissionDescriptor::StartDayEntry::getLoopLength() const {
00819    return s->start_time_loop;
00820 }
00821 
00822 int PremiereContentTransmissionDescriptor::StartDayEntry::getLength() {
00823    return sizeof(item_premiere_content_transmission_day)+getLoopLength();
00824 }
00825 
00826 void PremiereContentTransmissionDescriptor::StartDayEntry::Parse() {
00827    s=data.getData<const item_premiere_content_transmission_day>();
00828    startTimeLoop.setData(data+sizeof(item_premiere_content_transmission_day), getLoopLength());
00829 }
00830 
00831 time_t PremiereContentTransmissionDescriptor::StartDayEntry::StartTimeEntry::getStartTime(int mjd) const {
00832    return DVBTime::getTime(mjd >> 8, mjd & 0xff, s->start_time_h, s->start_time_m, s->start_time_s);
00833 }
00834 
00835 void PremiereContentTransmissionDescriptor::StartDayEntry::StartTimeEntry::Parse() {
00836    s=data.getData<const item_premiere_content_transmission_time>();
00837 }
00838 
00839 void ApplicationSignallingDescriptor::Parse() {
00840    entryLoop.setData(data+sizeof(descr_application_signalling), getLength()-sizeof(descr_application_signalling));
00841 }
00842 
00843 int ApplicationSignallingDescriptor::ApplicationEntryDescriptor::getApplicationType() const {
00844    return HILO(s->application_type);
00845 }
00846 
00847 int ApplicationSignallingDescriptor::ApplicationEntryDescriptor::getAITVersionNumber() const {
00848    return s->AIT_version_number;
00849 }
00850 
00851 void ApplicationSignallingDescriptor::ApplicationEntryDescriptor::Parse() {
00852    s=data.getData<const application_signalling_entry>();
00853 }
00854 
00855 bool MHP_ApplicationDescriptor::isServiceBound() const {
00856    return s->service_bound_flag;
00857 }
00858 
00859 int MHP_ApplicationDescriptor::getVisibility() const {
00860    return s->visibility;
00861 }
00862 
00863 int MHP_ApplicationDescriptor::getApplicationPriority() const {
00864    return s->application_priority;
00865 }
00866 
00867 void MHP_ApplicationDescriptor::Parse() {
00868    int offset=0;
00869    const descr_application *dapp;
00870    data.setPointerAndOffset<const descr_application>(dapp, offset);
00871    profileLoop.setDataAndOffset(data+offset, dapp->application_profiles_length, offset);
00872    data.setPointerAndOffset<const descr_application_end>(s, offset);
00873    transportProtocolLabels.setData(data+offset, getLength()-offset);
00874 }
00875 
00876 int MHP_ApplicationDescriptor::Profile::getApplicationProfile() const {
00877       return HILO(s->application_profile);
00878 }
00879 
00880 int MHP_ApplicationDescriptor::Profile::getVersionMajor() const {
00881       return s->version_major;
00882 }
00883 
00884 int MHP_ApplicationDescriptor::Profile::getVersionMinor() const {
00885       return s->version_minor;
00886 }
00887 
00888 int MHP_ApplicationDescriptor::Profile::getVersionMicro() const {
00889       return s->version_micro;
00890 }
00891 
00892 void MHP_ApplicationDescriptor::Profile::Parse() {
00893    s=data.getData<application_profile_entry>();
00894 }
00895 
00896 void MHP_ApplicationNameDescriptor::Parse() {
00897    nameLoop.setData(data+sizeof(descr_application_name), getLength()-sizeof(descr_application_name));
00898 }
00899 
00900 void MHP_ApplicationNameDescriptor::NameEntry::Parse() {
00901    const descr_application_name_entry *s;
00902    s=data.getData<const descr_application_name_entry>();
00903    name.setData(data+sizeof(descr_application_name_entry), s->application_name_length);
00904    languageCode[0]=s->lang_code1;
00905    languageCode[1]=s->lang_code2;
00906    languageCode[2]=s->lang_code3;
00907    languageCode[3]=0;
00908 }
00909 
00910 int MHP_TransportProtocolDescriptor::getProtocolId() const {
00911    return HILO(s->protocol_id);
00912 }
00913 
00914 int MHP_TransportProtocolDescriptor::getProtocolLabel() const {
00915    return s->transport_protocol_label;
00916 }
00917 
00918 bool MHP_TransportProtocolDescriptor::isRemote() const {
00919    return remote;
00920 }
00921 
00922 int MHP_TransportProtocolDescriptor::getComponentTag() const {
00923    return componentTag;
00924 }
00925 
00926 void MHP_TransportProtocolDescriptor::Parse() {
00927    int offset=0;
00928    data.setPointerAndOffset<const descr_transport_protocol>(s, offset);
00929    if (getProtocolId() == ObjectCarousel) {
00930       const transport_via_oc *oc;
00931       data.setPointerAndOffset<const transport_via_oc>(oc, offset);
00932       remote=oc->remote;
00933       if (remote) {
00934          const transport_via_oc_remote_end *rem;
00935          data.setPointerAndOffset<const transport_via_oc_remote_end>(rem, offset);
00936          componentTag=rem->component_tag;
00937       } else {
00938          const transport_via_oc_end *rem;
00939          data.setPointerAndOffset<const transport_via_oc_end>(rem, offset);
00940          componentTag=rem->component_tag;
00941       }
00942    } else { //unimplemented
00943       remote=false;
00944       componentTag=-1;
00945    }
00946 }
00947 
00948 void MHP_DVBJApplicationDescriptor::Parse() {
00949    applicationLoop.setData(data+sizeof(descr_dvbj_application), getLength()-sizeof(descr_dvbj_application));
00950 }
00951 
00952 void MHP_DVBJApplicationDescriptor::ApplicationEntry::Parse() {
00953    const descr_dvbj_application_entry *entry=data.getData<const descr_dvbj_application_entry>();
00954    parameter.setData(data+sizeof(descr_dvbj_application_entry), entry->parameter_length);
00955 }
00956 
00957 void MHP_DVBJApplicationLocationDescriptor::Parse() {
00958    int offset=0;
00959    const descr_dvbj_application_location *first;
00960    data.setPointerAndOffset<const descr_dvbj_application_location>(first, offset);
00961    baseDirectory.setDataAndOffset(data+offset, first->base_directory_length, offset);
00962    const descr_dvbj_application_location_mid *mid;
00963    data.setPointerAndOffset<const descr_dvbj_application_location_mid>(mid, offset);
00964    classPath.setDataAndOffset(data+offset, mid->classpath_extension_length, offset);
00965    initialClass.setData(data+offset, getLength()-offset);
00966 }
00967 
00968 int MHP_ApplicationIconsDescriptor::getIconFlags() const {
00969    return HILO(s->icon_flags);
00970 }
00971 
00972 void MHP_ApplicationIconsDescriptor::Parse() {
00973    int offset=0;
00974    const descr_application_icons_descriptor *first;
00975    data.setPointerAndOffset<const descr_application_icons_descriptor>(first, offset);
00976    iconLocator.setDataAndOffset(data+offset, first->icon_locator_length, offset);
00977    data.setPointerAndOffset<const descr_application_icons_descriptor_end>(s, offset);
00978 }
00979 
00980 } //end of namespace

Generated on Tue Nov 6 19:57:53 2007 for VDR by  doxygen 1.5.3-20071008