mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Removed superfluous white space; added RCS Id
This commit is contained in:
parent
7559685c8c
commit
8f5407bc81
@ -6,16 +6,15 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: descriptor.c 1.2 2003/12/13 10:42:05 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "descriptor.h"
|
#include "descriptor.h"
|
||||||
|
|
||||||
namespace SI {
|
namespace SI {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ShortEventDescriptor::Parse() {
|
void ShortEventDescriptor::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const descr_short_event *s;
|
const descr_short_event *s;
|
||||||
@ -29,9 +28,6 @@ void ShortEventDescriptor::Parse() {
|
|||||||
text.setData(data+offset, mid->text_length);
|
text.setData(data+offset, mid->text_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ExtendedEventDescriptor::getDescriptorNumber() {
|
int ExtendedEventDescriptor::getDescriptorNumber() {
|
||||||
return s->descriptor_number;
|
return s->descriptor_number;
|
||||||
}
|
}
|
||||||
@ -52,9 +48,6 @@ void ExtendedEventDescriptor::Parse() {
|
|||||||
text.setData(data+offset, mid->text_length);
|
text.setData(data+offset, mid->text_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ExtendedEventDescriptor::Item::Parse() {
|
void ExtendedEventDescriptor::Item::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const item_extended_event *first;
|
const item_extended_event *first;
|
||||||
@ -65,7 +58,6 @@ void ExtendedEventDescriptor::Item::Parse() {
|
|||||||
item.setData(data+offset, mid->item_length);
|
item.setData(data+offset, mid->item_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ExtendedEventDescriptors::getTextLength() {
|
int ExtendedEventDescriptors::getTextLength() {
|
||||||
int ret=0;
|
int ret=0;
|
||||||
for (int i=0;i<length;i++) {
|
for (int i=0;i<length;i++) {
|
||||||
@ -116,18 +108,18 @@ char *ExtendedEventDescriptors::getText(char *buffer) {
|
|||||||
memcpy(buffer+index, tempbuf, len);
|
memcpy(buffer+index, tempbuf, len);
|
||||||
index+=len;
|
index+=len;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedEventDescriptor::Item item;
|
ExtendedEventDescriptor::Item item;
|
||||||
for (Loop::Iterator it; d->itemLoop.hasNext(it); ) {
|
for (Loop::Iterator it; d->itemLoop.hasNext(it); ) {
|
||||||
item=d->itemLoop.getNext(it);
|
item=d->itemLoop.getNext(it);
|
||||||
|
|
||||||
item.item.getText(tempbuf);
|
item.item.getText(tempbuf);
|
||||||
len=strlen(tempbuf);
|
len=strlen(tempbuf);
|
||||||
if (len) {
|
if (len) {
|
||||||
memcpy(buffer+index, tempbuf, len);
|
memcpy(buffer+index, tempbuf, len);
|
||||||
index+=len;
|
index+=len;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.itemDescription.getText(tempbuf);
|
item.itemDescription.getText(tempbuf);
|
||||||
len=strlen(tempbuf);
|
len=strlen(tempbuf);
|
||||||
if (len) {
|
if (len) {
|
||||||
@ -140,9 +132,6 @@ char *ExtendedEventDescriptors::getText(char *buffer) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TimeShiftedEventDescriptor::getReferenceServiceId() const {
|
int TimeShiftedEventDescriptor::getReferenceServiceId() const {
|
||||||
return HILO(s->reference_service_id);
|
return HILO(s->reference_service_id);
|
||||||
}
|
}
|
||||||
@ -155,17 +144,11 @@ void TimeShiftedEventDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_time_shifted_event>();
|
s=data.getData<const descr_time_shifted_event>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ContentDescriptor::Parse() {
|
void ContentDescriptor::Parse() {
|
||||||
//this descriptor is only a header and a loop
|
//this descriptor is only a header and a loop
|
||||||
nibbleLoop.setData(data+sizeof(SectionHeader), getLength()-sizeof(SectionHeader));
|
nibbleLoop.setData(data+sizeof(SectionHeader), getLength()-sizeof(SectionHeader));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ContentDescriptor::Nibble::getContentNibbleLevel1() const {
|
int ContentDescriptor::Nibble::getContentNibbleLevel1() const {
|
||||||
return s->content_nibble_level_1;
|
return s->content_nibble_level_1;
|
||||||
}
|
}
|
||||||
@ -186,15 +169,11 @@ void ContentDescriptor::Nibble::Parse() {
|
|||||||
s=data.getData<const nibble_content>();
|
s=data.getData<const nibble_content>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ParentalRatingDescriptor::Parse() {
|
void ParentalRatingDescriptor::Parse() {
|
||||||
//this descriptor is only a header and a loop
|
//this descriptor is only a header and a loop
|
||||||
ratingLoop.setData(data+sizeof(SectionHeader), getLength()-sizeof(SectionHeader));
|
ratingLoop.setData(data+sizeof(SectionHeader), getLength()-sizeof(SectionHeader));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ParentalRatingDescriptor::Rating::getRating() const {
|
int ParentalRatingDescriptor::Rating::getRating() const {
|
||||||
return s->rating;
|
return s->rating;
|
||||||
}
|
}
|
||||||
@ -206,9 +185,6 @@ void ParentalRatingDescriptor::Rating::Parse() {
|
|||||||
languageCode[2]=s->lang_code3;
|
languageCode[2]=s->lang_code3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CaDescriptor::getCaType() const {
|
int CaDescriptor::getCaType() const {
|
||||||
return HILO(s->CA_type);
|
return HILO(s->CA_type);
|
||||||
}
|
}
|
||||||
@ -223,8 +199,6 @@ void CaDescriptor::Parse() {
|
|||||||
privateData.assign(data.getData(offset), getLength()-offset);
|
privateData.assign(data.getData(offset), getLength()-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int StreamIdentifierDescriptor::getComponentTag() const {
|
int StreamIdentifierDescriptor::getComponentTag() const {
|
||||||
return s->component_tag;
|
return s->component_tag;
|
||||||
}
|
}
|
||||||
@ -233,25 +207,14 @@ void StreamIdentifierDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_stream_identifier>();
|
s=data.getData<const descr_stream_identifier>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void NetworkNameDescriptor::Parse() {
|
void NetworkNameDescriptor::Parse() {
|
||||||
name.setData(data+sizeof(descr_network_name), getLength()-sizeof(descr_network_name));
|
name.setData(data+sizeof(descr_network_name), getLength()-sizeof(descr_network_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CaIdentifierDescriptor::Parse() {
|
void CaIdentifierDescriptor::Parse() {
|
||||||
identifiers.setData(data+sizeof(descr_ca_identifier), getLength()-sizeof(descr_ca_identifier));
|
identifiers.setData(data+sizeof(descr_ca_identifier), getLength()-sizeof(descr_ca_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CarouselIdentifierDescriptor::getCarouselId() const {
|
int CarouselIdentifierDescriptor::getCarouselId() const {
|
||||||
return (HILO(s->carousel_id_hi) << 16) | HILO(s->carousel_id_lo);
|
return (HILO(s->carousel_id_hi) << 16) | HILO(s->carousel_id_lo);
|
||||||
}
|
}
|
||||||
@ -264,16 +227,10 @@ void CarouselIdentifierDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_carousel_identifier>();
|
s=data.getData<const descr_carousel_identifier>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ServiceListDescriptor::Parse() {
|
void ServiceListDescriptor::Parse() {
|
||||||
serviceLoop.setData(data+sizeof(descr_service_list), getLength()-sizeof(descr_service_list));
|
serviceLoop.setData(data+sizeof(descr_service_list), getLength()-sizeof(descr_service_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ServiceListDescriptor::Service::getServiceId() const {
|
int ServiceListDescriptor::Service::getServiceId() const {
|
||||||
return HILO(s->service_id);
|
return HILO(s->service_id);
|
||||||
}
|
}
|
||||||
@ -286,9 +243,6 @@ void ServiceListDescriptor::Service::Parse() {
|
|||||||
s=data.getData<const descr_service_list_loop>();
|
s=data.getData<const descr_service_list_loop>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int SatelliteDeliverySystemDescriptor::getFrequency() const {
|
int SatelliteDeliverySystemDescriptor::getFrequency() const {
|
||||||
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
||||||
}
|
}
|
||||||
@ -321,9 +275,6 @@ void SatelliteDeliverySystemDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_satellite_delivery_system>();
|
s=data.getData<const descr_satellite_delivery_system>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CableDeliverySystemDescriptor::getFrequency() const {
|
int CableDeliverySystemDescriptor::getFrequency() const {
|
||||||
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
||||||
}
|
}
|
||||||
@ -348,9 +299,6 @@ void CableDeliverySystemDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_cable_delivery_system>();
|
s=data.getData<const descr_cable_delivery_system>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TerrestrialDeliverySystemDescriptor::getFrequency() const {
|
int TerrestrialDeliverySystemDescriptor::getFrequency() const {
|
||||||
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo);
|
||||||
}
|
}
|
||||||
@ -391,9 +339,6 @@ void TerrestrialDeliverySystemDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_terrestrial_delivery>();
|
s=data.getData<const descr_terrestrial_delivery>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ServiceDescriptor::getServiceType() const {
|
int ServiceDescriptor::getServiceType() const {
|
||||||
return s->service_type;
|
return s->service_type;
|
||||||
}
|
}
|
||||||
@ -411,9 +356,6 @@ void NVODReferenceDescriptor::Parse() {
|
|||||||
serviceLoop.setData(data+sizeof(descr_nvod_reference), getLength()-sizeof(descr_nvod_reference));
|
serviceLoop.setData(data+sizeof(descr_nvod_reference), getLength()-sizeof(descr_nvod_reference));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int NVODReferenceDescriptor::Service::getTransportStream() const {
|
int NVODReferenceDescriptor::Service::getTransportStream() const {
|
||||||
return HILO(s->transport_stream_id);
|
return HILO(s->transport_stream_id);
|
||||||
}
|
}
|
||||||
@ -430,9 +372,6 @@ void NVODReferenceDescriptor::Service::Parse() {
|
|||||||
s=data.getData<const item_nvod_reference>();
|
s=data.getData<const item_nvod_reference>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int TimeShiftedServiceDescriptor::getReferenceServiceId() const {
|
int TimeShiftedServiceDescriptor::getReferenceServiceId() const {
|
||||||
return HILO(s->reference_service_id);
|
return HILO(s->reference_service_id);
|
||||||
}
|
}
|
||||||
@ -441,9 +380,6 @@ void TimeShiftedServiceDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_time_shifted_service>();
|
s=data.getData<const descr_time_shifted_service>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ComponentDescriptor::getStreamContent() const {
|
int ComponentDescriptor::getStreamContent() const {
|
||||||
return s->stream_content;
|
return s->stream_content;
|
||||||
}
|
}
|
||||||
@ -465,16 +401,10 @@ void ComponentDescriptor::Parse() {
|
|||||||
description.setData(data+offset, getLength()-offset);
|
description.setData(data+offset, getLength()-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SubtitlingDescriptor::Parse() {
|
void SubtitlingDescriptor::Parse() {
|
||||||
subtitlingLoop.setData(data+sizeof(descr_subtitling), getLength()-sizeof(descr_subtitling));
|
subtitlingLoop.setData(data+sizeof(descr_subtitling), getLength()-sizeof(descr_subtitling));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int SubtitlingDescriptor::Subtitling::getSubtitlingType() const {
|
int SubtitlingDescriptor::Subtitling::getSubtitlingType() const {
|
||||||
return s->subtitling_type;
|
return s->subtitling_type;
|
||||||
}
|
}
|
||||||
@ -491,9 +421,6 @@ void SubtitlingDescriptor::Subtitling::Parse() {
|
|||||||
s=data.getData<const item_subtitling>();
|
s=data.getData<const item_subtitling>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ServiceMoveDescriptor::getNewOriginalNetworkId() const {
|
int ServiceMoveDescriptor::getNewOriginalNetworkId() const {
|
||||||
return HILO(s->new_original_network_id);
|
return HILO(s->new_original_network_id);
|
||||||
}
|
}
|
||||||
@ -510,9 +437,6 @@ void ServiceMoveDescriptor::Parse() {
|
|||||||
s=data.getData<const descr_service_move>();
|
s=data.getData<const descr_service_move>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int FrequencyListDescriptor::getCodingType() const {
|
int FrequencyListDescriptor::getCodingType() const {
|
||||||
return s->coding_type;
|
return s->coding_type;
|
||||||
}
|
}
|
||||||
@ -523,19 +447,14 @@ void FrequencyListDescriptor::Parse() {
|
|||||||
frequencies.setData(data+offset, getLength()-offset);
|
frequencies.setData(data+offset, getLength()-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ServiceIdentifierDescriptor::Parse() {
|
void ServiceIdentifierDescriptor::Parse() {
|
||||||
textualServiceIdentifier.setData(data+sizeof(descr_service_identifier), getLength()-sizeof(descr_service_identifier));
|
textualServiceIdentifier.setData(data+sizeof(descr_service_identifier), getLength()-sizeof(descr_service_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MultilingualNameDescriptor::Parse() {
|
void MultilingualNameDescriptor::Parse() {
|
||||||
nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
|
nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MultilingualNameDescriptor::Name::Parse() {
|
void MultilingualNameDescriptor::Name::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const entry_multilingual_name *s;
|
const entry_multilingual_name *s;
|
||||||
@ -546,7 +465,6 @@ void MultilingualNameDescriptor::Name::Parse() {
|
|||||||
name.setData(data+offset, s->text_length);
|
name.setData(data+offset, s->text_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MultilingualComponentDescriptor::getComponentTag() const {
|
int MultilingualComponentDescriptor::getComponentTag() const {
|
||||||
return s->component_tag;
|
return s->component_tag;
|
||||||
}
|
}
|
||||||
@ -554,19 +472,13 @@ int MultilingualComponentDescriptor::getComponentTag() const {
|
|||||||
void MultilingualComponentDescriptor::Parse() {
|
void MultilingualComponentDescriptor::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
data.setPointerAndOffset<const descr_multilingual_component>(s, offset);
|
data.setPointerAndOffset<const descr_multilingual_component>(s, offset);
|
||||||
nameLoop.setData(data+sizeof(descr_multilingual_component), getLength()-sizeof(descr_multilingual_component));
|
nameLoop.setData(data+sizeof(descr_multilingual_component), getLength()-sizeof(descr_multilingual_component));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MultilingualServiceNameDescriptor::Parse() {
|
void MultilingualServiceNameDescriptor::Parse() {
|
||||||
nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
|
nameLoop.setData(data+sizeof(descr_multilingual_network_name), getLength()-sizeof(descr_multilingual_network_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MultilingualServiceNameDescriptor::Name::Parse() {
|
void MultilingualServiceNameDescriptor::Name::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const entry_multilingual_name *s;
|
const entry_multilingual_name *s;
|
||||||
@ -580,9 +492,6 @@ void MultilingualServiceNameDescriptor::Name::Parse() {
|
|||||||
name.setData(data+offset, mid->service_name_length);
|
name.setData(data+offset, mid->service_name_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ApplicationSignallingDescriptor::Parse() {
|
void ApplicationSignallingDescriptor::Parse() {
|
||||||
entryLoop.setData(data+sizeof(descr_application_signalling), getLength()-sizeof(descr_application_signalling));
|
entryLoop.setData(data+sizeof(descr_application_signalling), getLength()-sizeof(descr_application_signalling));
|
||||||
}
|
}
|
||||||
@ -599,10 +508,6 @@ void ApplicationSignallingDescriptor::ApplicationEntryDescriptor::Parse() {
|
|||||||
s=data.getData<const application_signalling_entry>();
|
s=data.getData<const application_signalling_entry>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MHP_ApplicationDescriptor::isServiceBound() const {
|
bool MHP_ApplicationDescriptor::isServiceBound() const {
|
||||||
return s->service_bound_flag;
|
return s->service_bound_flag;
|
||||||
}
|
}
|
||||||
@ -615,7 +520,6 @@ int MHP_ApplicationDescriptor::getApplicationPriority() const {
|
|||||||
return s->application_priority;
|
return s->application_priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MHP_ApplicationDescriptor::Parse() {
|
void MHP_ApplicationDescriptor::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const descr_application *dapp;
|
const descr_application *dapp;
|
||||||
@ -625,7 +529,6 @@ void MHP_ApplicationDescriptor::Parse() {
|
|||||||
transportProtocolLabels.setData(data+offset, getLength()-offset);
|
transportProtocolLabels.setData(data+offset, getLength()-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MHP_ApplicationDescriptor::Profile::getApplicationProfile() const {
|
int MHP_ApplicationDescriptor::Profile::getApplicationProfile() const {
|
||||||
return HILO(s->application_profile);
|
return HILO(s->application_profile);
|
||||||
}
|
}
|
||||||
@ -646,8 +549,6 @@ void MHP_ApplicationDescriptor::Profile::Parse() {
|
|||||||
s=data.getData<application_profile_entry>();
|
s=data.getData<application_profile_entry>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MHP_ApplicationNameDescriptor::Parse() {
|
void MHP_ApplicationNameDescriptor::Parse() {
|
||||||
nameLoop.setData(data+sizeof(descr_application_name), getLength()-sizeof(descr_application_name));
|
nameLoop.setData(data+sizeof(descr_application_name), getLength()-sizeof(descr_application_name));
|
||||||
}
|
}
|
||||||
@ -661,8 +562,6 @@ void MHP_ApplicationNameDescriptor::NameEntry::Parse() {
|
|||||||
languageCode[2]=s->lang_code3;
|
languageCode[2]=s->lang_code3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MHP_TransportProtocolDescriptor::getProtocolId() const {
|
int MHP_TransportProtocolDescriptor::getProtocolId() const {
|
||||||
return HILO(s->protocol_id);
|
return HILO(s->protocol_id);
|
||||||
}
|
}
|
||||||
@ -701,8 +600,6 @@ void MHP_TransportProtocolDescriptor::Parse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MHP_DVBJApplicationDescriptor::Parse() {
|
void MHP_DVBJApplicationDescriptor::Parse() {
|
||||||
applicationLoop.setData(data+sizeof(descr_dvbj_application), getLength()-sizeof(descr_dvbj_application));
|
applicationLoop.setData(data+sizeof(descr_dvbj_application), getLength()-sizeof(descr_dvbj_application));
|
||||||
}
|
}
|
||||||
@ -712,7 +609,6 @@ void MHP_DVBJApplicationDescriptor::ApplicationEntry::Parse() {
|
|||||||
parameter.setData(data+sizeof(descr_dvbj_application_entry), entry->parameter_length);
|
parameter.setData(data+sizeof(descr_dvbj_application_entry), entry->parameter_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MHP_DVBJApplicationLocationDescriptor::Parse() {
|
void MHP_DVBJApplicationLocationDescriptor::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
const descr_dvbj_application_location *first;
|
const descr_dvbj_application_location *first;
|
||||||
@ -724,7 +620,6 @@ void MHP_DVBJApplicationLocationDescriptor::Parse() {
|
|||||||
initialClass.setData(data+offset, getLength()-offset);
|
initialClass.setData(data+offset, getLength()-offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int MHP_ApplicationIconsDescriptor::getIconFlags() const {
|
int MHP_ApplicationIconsDescriptor::getIconFlags() const {
|
||||||
return HILO(s->icon_flags);
|
return HILO(s->icon_flags);
|
||||||
}
|
}
|
||||||
@ -738,5 +633,3 @@ void MHP_ApplicationIconsDescriptor::Parse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: descriptor.h 1.2 2003/12/13 10:42:08 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef LIBSI_DESCRIPTOR_H
|
#ifndef LIBSI_DESCRIPTOR_H
|
||||||
@ -16,7 +18,6 @@
|
|||||||
|
|
||||||
namespace SI {
|
namespace SI {
|
||||||
|
|
||||||
|
|
||||||
class ShortEventDescriptor : public Descriptor {
|
class ShortEventDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
char languageCode[3];
|
char languageCode[3];
|
||||||
@ -56,10 +57,9 @@ public:
|
|||||||
//same semantics as with SI::String
|
//same semantics as with SI::String
|
||||||
char *getText();
|
char *getText();
|
||||||
//buffer must at least be getTextLength(), getMaximumTextLength() is a good choice
|
//buffer must at least be getTextLength(), getMaximumTextLength() is a good choice
|
||||||
char *getText(char *buffer);
|
char *getText(char *buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TimeShiftedEventDescriptor : public Descriptor {
|
class TimeShiftedEventDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
int getReferenceServiceId() const;
|
int getReferenceServiceId() const;
|
||||||
@ -89,7 +89,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ParentalRatingDescriptor : public Descriptor {
|
class ParentalRatingDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
class Rating : public LoopElement {
|
class Rating : public LoopElement {
|
||||||
@ -107,7 +106,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CaDescriptor : public Descriptor {
|
class CaDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
int getCaType() const;
|
int getCaType() const;
|
||||||
@ -172,7 +170,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SatelliteDeliverySystemDescriptor : public Descriptor {
|
class SatelliteDeliverySystemDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
int getFrequency() const;
|
int getFrequency() const;
|
||||||
@ -247,7 +244,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TimeShiftedServiceDescriptor : public Descriptor {
|
class TimeShiftedServiceDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
int getReferenceServiceId() const;
|
int getReferenceServiceId() const;
|
||||||
@ -288,7 +284,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ServiceMoveDescriptor : public Descriptor {
|
class ServiceMoveDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
int getNewOriginalNetworkId() const;
|
int getNewOriginalNetworkId() const;
|
||||||
@ -366,10 +361,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//a descriptor currently unimplemented in this library
|
//a descriptor currently unimplemented in this library
|
||||||
class UnimplementedDescriptor : public Descriptor {
|
class UnimplementedDescriptor : public Descriptor {
|
||||||
protected:
|
protected:
|
||||||
@ -418,7 +409,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MHP_ApplicationNameDescriptor : public Descriptor {
|
class MHP_ApplicationNameDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
class NameEntry : public LoopElement {
|
class NameEntry : public LoopElement {
|
||||||
@ -434,7 +424,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MHP_TransportProtocolDescriptor : public Descriptor {
|
class MHP_TransportProtocolDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
enum Protocol { ObjectCarousel = 0x01, IPviaDVB = 0x02, HTTPoverInteractionChannel = 0x03 };
|
enum Protocol { ObjectCarousel = 0x01, IPviaDVB = 0x02, HTTPoverInteractionChannel = 0x03 };
|
||||||
@ -464,7 +453,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MHP_DVBJApplicationLocationDescriptor : public Descriptor {
|
class MHP_DVBJApplicationLocationDescriptor : public Descriptor {
|
||||||
public:
|
public:
|
||||||
String baseDirectory;
|
String baseDirectory;
|
||||||
@ -484,9 +472,6 @@ private:
|
|||||||
const descr_application_icons_descriptor_end *s;
|
const descr_application_icons_descriptor_end *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
#endif //LIBSI_TABLE_H
|
#endif //LIBSI_TABLE_H
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# $Id: gendescr.pl 1.2 2003/12/13 10:42:05 kls Exp $
|
||||||
|
|
||||||
print "Name (ohne ...Descriptor):";
|
print "Name (ohne ...Descriptor):";
|
||||||
$name=<STDIN>;
|
$name=<STDIN>;
|
||||||
$name =~ s/\n$//;
|
$name =~ s/\n$//;
|
||||||
@ -10,7 +12,6 @@ print "Struct:";
|
|||||||
$struct=<STDIN>;
|
$struct=<STDIN>;
|
||||||
$struct =~ s/\n$//;
|
$struct =~ s/\n$//;
|
||||||
|
|
||||||
|
|
||||||
mm:
|
mm:
|
||||||
$index=0;
|
$index=0;
|
||||||
$which=1;
|
$which=1;
|
||||||
@ -44,7 +45,7 @@ sub schreib {
|
|||||||
print "Danke.\n";
|
print "Danke.\n";
|
||||||
open(OUTPUT_H, ">>".$filename_h) or die "Could not open file!!";
|
open(OUTPUT_H, ">>".$filename_h) or die "Could not open file!!";
|
||||||
open(OUTPUT_C, ">>".$filename_c) or die "Could not open file!!";
|
open(OUTPUT_C, ">>".$filename_c) or die "Could not open file!!";
|
||||||
|
|
||||||
if ($inner) {
|
if ($inner) {
|
||||||
$offset=" ";
|
$offset=" ";
|
||||||
} else {
|
} else {
|
||||||
@ -63,7 +64,7 @@ sub schreib {
|
|||||||
print (OUTPUT_H "\n".$offset." int get".$members[$i]."() const;");
|
print (OUTPUT_H "\n".$offset." int get".$members[$i]."() const;");
|
||||||
}
|
}
|
||||||
print(OUTPUT_H "\n".$offset."virtual int getLength() { return sizeof(".$struct."); }") if ($inner);
|
print(OUTPUT_H "\n".$offset."virtual int getLength() { return sizeof(".$struct."); }") if ($inner);
|
||||||
|
|
||||||
print(OUTPUT_H "\n".$offset."protected:\n".$offset." virtual void Parse();");
|
print(OUTPUT_H "\n".$offset."protected:\n".$offset." virtual void Parse();");
|
||||||
print(OUTPUT_H "\n".$offset."private:\n".$offset." const ".$struct." *s;") if ($struct ne "");
|
print(OUTPUT_H "\n".$offset."private:\n".$offset." const ".$struct." *s;") if ($struct ne "");
|
||||||
print(OUTPUT_H "\n".$offset."};\n\n");
|
print(OUTPUT_H "\n".$offset."};\n\n");
|
||||||
|
411
libsi/headers.h
411
libsi/headers.h
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,8 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: section.c 1.2 2003/12/13 10:42:14 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "section.h"
|
#include "section.h"
|
||||||
@ -74,8 +76,6 @@ void PMT::Stream::Parse() {
|
|||||||
streamDescriptors.setData(data+offset, HILO(s->ES_info_length));
|
streamDescriptors.setData(data+offset, HILO(s->ES_info_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************** NIT ***********************/
|
/*********************** NIT ***********************/
|
||||||
|
|
||||||
int NIT::getNetworkId() const {
|
int NIT::getNetworkId() const {
|
||||||
@ -105,11 +105,8 @@ void NIT::TransportStream::Parse() {
|
|||||||
transportStreamDescriptors.setData(data+offset, HILO(s->transport_descriptors_length));
|
transportStreamDescriptors.setData(data+offset, HILO(s->transport_descriptors_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************** SDT ***********************/
|
/*********************** SDT ***********************/
|
||||||
|
|
||||||
|
|
||||||
void SDT::Parse() {
|
void SDT::Parse() {
|
||||||
unsigned int offset=0;
|
unsigned int offset=0;
|
||||||
data.setPointerAndOffset<const sdt>(s, offset);
|
data.setPointerAndOffset<const sdt>(s, offset);
|
||||||
@ -150,8 +147,6 @@ void SDT::Service::Parse() {
|
|||||||
serviceDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
|
serviceDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************** EIT ***********************/
|
/*********************** EIT ***********************/
|
||||||
|
|
||||||
int EIT::getServiceId() const {
|
int EIT::getServiceId() const {
|
||||||
@ -167,7 +162,7 @@ int EIT::getOriginalNetworkId() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EIT::isPresentFollowing() const {
|
bool EIT::isPresentFollowing() const {
|
||||||
return getTableId() == TableIdEIT_presentFollowing || getTableId() == TableIdEIT_presentFollowing_other;
|
return getTableId() == TableIdEIT_presentFollowing || getTableId() == TableIdEIT_presentFollowing_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EIT::isActualTS() const {
|
bool EIT::isActualTS() const {
|
||||||
@ -183,7 +178,6 @@ void EIT::Parse() {
|
|||||||
eventLoop.setData(data+offset, getLength()-offset-4); //4 is for CRC
|
eventLoop.setData(data+offset, getLength()-offset-4); //4 is for CRC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t EIT::Event::getStartTime() const {
|
time_t EIT::Event::getStartTime() const {
|
||||||
return DVBTime::getTime(s->mjd_hi, s->mjd_lo, s->start_time_h, s->start_time_m, s->start_time_s);
|
return DVBTime::getTime(s->mjd_hi, s->mjd_lo, s->start_time_h, s->start_time_m, s->start_time_s);
|
||||||
}
|
}
|
||||||
@ -239,7 +233,6 @@ void EIT::Event::Parse() {
|
|||||||
eventDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
|
eventDescriptors.setData(data+offset, HILO(s->descriptors_loop_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************** TDT ***********************/
|
/*********************** TDT ***********************/
|
||||||
|
|
||||||
time_t TDT::getTime() const {
|
time_t TDT::getTime() const {
|
||||||
@ -250,7 +243,6 @@ void TDT::Parse() {
|
|||||||
s=data.getData<const tdt>();
|
s=data.getData<const tdt>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************** TOT ***********************/
|
/*********************** TOT ***********************/
|
||||||
|
|
||||||
time_t TOT::getTime() const {
|
time_t TOT::getTime() const {
|
||||||
@ -263,9 +255,6 @@ void TOT::Parse() {
|
|||||||
descriptorLoop.setData(data+offset, getLength()-offset-4);
|
descriptorLoop.setData(data+offset, getLength()-offset-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************** RST ***********************/
|
/*********************** RST ***********************/
|
||||||
|
|
||||||
void RST::Parse() {
|
void RST::Parse() {
|
||||||
@ -299,11 +288,8 @@ void RST::RunningInfo::Parse() {
|
|||||||
s=data.getData<const rst_info>();
|
s=data.getData<const rst_info>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************** AIT ***********************/
|
/*********************** AIT ***********************/
|
||||||
|
|
||||||
|
|
||||||
int AIT::getApplicationType() const {
|
int AIT::getApplicationType() const {
|
||||||
return HILO(first->application_type);
|
return HILO(first->application_type);
|
||||||
}
|
}
|
||||||
@ -321,7 +307,6 @@ void AIT::Parse() {
|
|||||||
applicationLoop.setData(data+offset, HILO(mid->application_loop_length));
|
applicationLoop.setData(data+offset, HILO(mid->application_loop_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long AIT::Application::getOrganisationId() const {
|
long AIT::Application::getOrganisationId() const {
|
||||||
return data.FourBytes(0);
|
return data.FourBytes(0);
|
||||||
}
|
}
|
||||||
@ -340,7 +325,4 @@ void AIT::Application::Parse() {
|
|||||||
applicationDescriptors.setData(data+offset, HILO(s->application_descriptors_length));
|
applicationDescriptors.setData(data+offset, HILO(s->application_descriptors_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: section.h 1.2 2003/12/13 10:42:15 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef LIBSI_SECTION_H
|
#ifndef LIBSI_SECTION_H
|
||||||
@ -50,7 +52,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PMT : public NumberedSection {
|
class PMT : public NumberedSection {
|
||||||
public:
|
public:
|
||||||
PMT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
PMT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
||||||
@ -108,7 +109,6 @@ public:
|
|||||||
int getBouquetId() const { return getNetworkId(); }
|
int getBouquetId() const { return getNetworkId(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SDT : public NumberedSection {
|
class SDT : public NumberedSection {
|
||||||
public:
|
public:
|
||||||
SDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
SDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
||||||
@ -134,8 +134,7 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
private:
|
private:
|
||||||
const sdt *s;
|
const sdt *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class EIT : public NumberedSection {
|
class EIT : public NumberedSection {
|
||||||
public:
|
public:
|
||||||
@ -146,7 +145,7 @@ public:
|
|||||||
int getEventId() const;
|
int getEventId() const;
|
||||||
time_t getStartTime() const; //UTC
|
time_t getStartTime() const; //UTC
|
||||||
time_t getDuration() const;
|
time_t getDuration() const;
|
||||||
|
|
||||||
int getMJD() const;
|
int getMJD() const;
|
||||||
int getStartTimeHour() const; //UTC
|
int getStartTimeHour() const; //UTC
|
||||||
int getStartTimeMinute() const; //UTC
|
int getStartTimeMinute() const; //UTC
|
||||||
@ -156,7 +155,7 @@ public:
|
|||||||
int getDurationSecond() const;
|
int getDurationSecond() const;
|
||||||
RunningStatus getRunningStatus() const;
|
RunningStatus getRunningStatus() const;
|
||||||
int getFreeCaMode() const;
|
int getFreeCaMode() const;
|
||||||
|
|
||||||
DescriptorLoop eventDescriptors;
|
DescriptorLoop eventDescriptors;
|
||||||
virtual int getLength() { return sizeof(eit_event)+eventDescriptors.getLength(); }
|
virtual int getLength() { return sizeof(eit_event)+eventDescriptors.getLength(); }
|
||||||
protected:
|
protected:
|
||||||
@ -168,7 +167,7 @@ public:
|
|||||||
int getTransportStreamId() const;
|
int getTransportStreamId() const;
|
||||||
int getOriginalNetworkId() const;
|
int getOriginalNetworkId() const;
|
||||||
StructureLoop<Event> eventLoop;
|
StructureLoop<Event> eventLoop;
|
||||||
|
|
||||||
//true if table conveys present/following information, false if it conveys schedule information
|
//true if table conveys present/following information, false if it conveys schedule information
|
||||||
bool isPresentFollowing() const;
|
bool isPresentFollowing() const;
|
||||||
//true if table describes TS on which it is broadcast, false if it describes other TS
|
//true if table describes TS on which it is broadcast, false if it describes other TS
|
||||||
@ -179,7 +178,6 @@ private:
|
|||||||
const eit *s;
|
const eit *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TDT : public Section {
|
class TDT : public Section {
|
||||||
public:
|
public:
|
||||||
TDT(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
|
TDT(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
|
||||||
@ -191,7 +189,6 @@ private:
|
|||||||
const tdt *s;
|
const tdt *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TOT : public CRCSection {
|
class TOT : public CRCSection {
|
||||||
public:
|
public:
|
||||||
TOT(const unsigned char *data, bool doCopy=true) : CRCSection(data, doCopy) {}
|
TOT(const unsigned char *data, bool doCopy=true) : CRCSection(data, doCopy) {}
|
||||||
@ -204,7 +201,6 @@ private:
|
|||||||
const tot *s;
|
const tot *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RST : public Section {
|
class RST : public Section {
|
||||||
public:
|
public:
|
||||||
RST(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
|
RST(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
|
||||||
@ -227,7 +223,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AIT : public NumberedSection {
|
class AIT : public NumberedSection {
|
||||||
public:
|
public:
|
||||||
AIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
AIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
|
||||||
@ -252,8 +247,6 @@ protected:
|
|||||||
virtual void Parse();
|
virtual void Parse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
#endif //LIBSI_TABLE_H
|
#endif //LIBSI_TABLE_H
|
||||||
|
40
libsi/si.c
40
libsi/si.c
@ -6,6 +6,8 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: si.c 1.2 2003/12/13 10:42:16 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -28,8 +30,6 @@ void Object::setData(CharArray &d) {
|
|||||||
data=d;
|
data=d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Section::Section(const unsigned char *data, bool doCopy) {
|
Section::Section(const unsigned char *data, bool doCopy) {
|
||||||
setData(data, getLength(data), doCopy);
|
setData(data, getLength(data), doCopy);
|
||||||
}
|
}
|
||||||
@ -43,11 +43,11 @@ int Section::getLength() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TableId Section::getTableId(const unsigned char *d) {
|
TableId Section::getTableId(const unsigned char *d) {
|
||||||
return (TableId)((const SectionHeader *)d)->table_id;
|
return (TableId)((const SectionHeader *)d)->table_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Section::getLength(const unsigned char *d) {
|
int Section::getLength(const unsigned char *d) {
|
||||||
return HILO(((const SectionHeader *)d)->section_length)+sizeof(SectionHeader);
|
return HILO(((const SectionHeader *)d)->section_length)+sizeof(SectionHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRCSection::isValid() {
|
bool CRCSection::isValid() {
|
||||||
@ -61,8 +61,6 @@ bool CRCSection::CheckCRCAndParse() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool NumberedSection::getCurrentNextIndicator() const {
|
bool NumberedSection::getCurrentNextIndicator() const {
|
||||||
return data.getData<ExtendedSectionHeader>()->current_next_indicator;
|
return data.getData<ExtendedSectionHeader>()->current_next_indicator;
|
||||||
}
|
}
|
||||||
@ -79,10 +77,6 @@ int NumberedSection::getLastSectionNumber() const {
|
|||||||
return data.getData<ExtendedSectionHeader>()->last_section_number;
|
return data.getData<ExtendedSectionHeader>()->last_section_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Descriptor::getLength() {
|
int Descriptor::getLength() {
|
||||||
return getLength(data.getData());
|
return getLength(data.getData());
|
||||||
}
|
}
|
||||||
@ -99,7 +93,6 @@ DescriptorTag Descriptor::getDescriptorTag(const unsigned char *d) {
|
|||||||
return (DescriptorTag)((const DescriptorHeader*)d)->descriptor_tag;
|
return (DescriptorTag)((const DescriptorHeader*)d)->descriptor_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Descriptor *DescriptorLoop::getNext(Iterator &it) {
|
Descriptor *DescriptorLoop::getNext(Iterator &it) {
|
||||||
if (it.i<getLength()) {
|
if (it.i<getLength()) {
|
||||||
return createDescriptor(it.i);
|
return createDescriptor(it.i);
|
||||||
@ -193,8 +186,6 @@ bool DescriptorGroup::isComplete() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *String::getText() {
|
char *String::getText() {
|
||||||
if (getLength() < 0 || getLength() >4095)
|
if (getLength() < 0 || getLength() >4095)
|
||||||
return "text error";
|
return "text error";
|
||||||
@ -216,17 +207,17 @@ char *String::getText(char *buffer) {
|
|||||||
void String::decodeText(char *buffer) {
|
void String::decodeText(char *buffer) {
|
||||||
const unsigned char *from=data.getData(0);
|
const unsigned char *from=data.getData(0);
|
||||||
char *to=buffer;
|
char *to=buffer;
|
||||||
|
|
||||||
/* Disable detection of coding tables - libdtv doesn't do it either
|
/* Disable detection of coding tables - libdtv doesn't do it either
|
||||||
if ( (0x01 <= *from) && (*from <= 0x1f) ) {
|
if ( (0x01 <= *from) && (*from <= 0x1f) ) {
|
||||||
codeTable=*from
|
codeTable=*from
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (int i = 0; i < getLength(); i++) {
|
for (int i = 0; i < getLength(); i++) {
|
||||||
if (*from == 0)
|
if (*from == 0)
|
||||||
break;
|
break;
|
||||||
if ( ((' ' <= *from) && (*from <= '~'))
|
if ( ((' ' <= *from) && (*from <= '~'))
|
||||||
|| (*from == '\n')
|
|| (*from == '\n')
|
||||||
|| ((0xA0 <= *from) && (*from <= 0xFF))
|
|| ((0xA0 <= *from) && (*from <= 0xFF))
|
||||||
)
|
)
|
||||||
@ -310,7 +301,7 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
|
|||||||
break;
|
break;
|
||||||
case CaIdentifierDescriptorTag:
|
case CaIdentifierDescriptorTag:
|
||||||
d=new CaIdentifierDescriptor();
|
d=new CaIdentifierDescriptor();
|
||||||
break;
|
break;
|
||||||
case ShortEventDescriptorTag:
|
case ShortEventDescriptorTag:
|
||||||
d=new ShortEventDescriptor();
|
d=new ShortEventDescriptor();
|
||||||
break;
|
break;
|
||||||
@ -329,10 +320,10 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
|
|||||||
case ApplicationSignallingDescriptorTag:
|
case ApplicationSignallingDescriptorTag:
|
||||||
d=new ApplicationSignallingDescriptor();
|
d=new ApplicationSignallingDescriptor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//note that it is no problem to implement one
|
//note that it is no problem to implement one
|
||||||
//of the unimplemented descriptors.
|
//of the unimplemented descriptors.
|
||||||
|
|
||||||
//defined in ISO-13818-1
|
//defined in ISO-13818-1
|
||||||
case VideoStreamDescriptorTag:
|
case VideoStreamDescriptorTag:
|
||||||
case AudioStreamDescriptorTag:
|
case AudioStreamDescriptorTag:
|
||||||
@ -350,7 +341,7 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
|
|||||||
case SmoothingBufferDescriptorTag:
|
case SmoothingBufferDescriptorTag:
|
||||||
case STDDescriptorTag:
|
case STDDescriptorTag:
|
||||||
case IBPDescriptorTag:
|
case IBPDescriptorTag:
|
||||||
|
|
||||||
//defined in ETSI EN 300 468
|
//defined in ETSI EN 300 468
|
||||||
case StuffingDescriptorTag:
|
case StuffingDescriptorTag:
|
||||||
case VBIDataDescriptorTag:
|
case VBIDataDescriptorTag:
|
||||||
@ -374,7 +365,7 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
|
|||||||
case DSNGDescriptorTag:
|
case DSNGDescriptorTag:
|
||||||
case PDCDescriptorTag:
|
case PDCDescriptorTag:
|
||||||
case AncillaryDataDescriptorTag:
|
case AncillaryDataDescriptorTag:
|
||||||
case AnnouncementSupportDescriptorTag:
|
case AnnouncementSupportDescriptorTag:
|
||||||
case AdaptationFieldDataDescriptorTag:
|
case AdaptationFieldDataDescriptorTag:
|
||||||
case TransportStreamDescriptorTag:
|
case TransportStreamDescriptorTag:
|
||||||
default:
|
default:
|
||||||
@ -421,11 +412,4 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
|
|
||||||
|
40
libsi/si.h
40
libsi/si.h
@ -6,9 +6,10 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: si.h 1.2 2003/12/13 10:42:17 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LIBSI_SI_H
|
#ifndef LIBSI_SI_H
|
||||||
#define LIBSI_SI_H
|
#define LIBSI_SI_H
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ enum TableId { TableIdPAT = 0x00, //program association section
|
|||||||
TableIdSIT = 0x7F, //service information section
|
TableIdSIT = 0x7F, //service information section
|
||||||
TableIdAIT = 0x74 //application information section
|
TableIdAIT = 0x74 //application information section
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum DescriptorTag {
|
enum DescriptorTag {
|
||||||
// defined by ISO/IEC 13818-1
|
// defined by ISO/IEC 13818-1
|
||||||
@ -65,7 +66,7 @@ enum DescriptorTag {
|
|||||||
SmoothingBufferDescriptorTag = 0x10,
|
SmoothingBufferDescriptorTag = 0x10,
|
||||||
STDDescriptorTag = 0x11,
|
STDDescriptorTag = 0x11,
|
||||||
IBPDescriptorTag = 0x12,
|
IBPDescriptorTag = 0x12,
|
||||||
// defined by ISO-13818-6 (DSM-CC)
|
// defined by ISO-13818-6 (DSM-CC)
|
||||||
CarouselIdentifierDescriptorTag = 0x13,
|
CarouselIdentifierDescriptorTag = 0x13,
|
||||||
// 0x14 - 0x3F Reserved
|
// 0x14 - 0x3F Reserved
|
||||||
// defined by ETSI (EN 300 468)
|
// defined by ETSI (EN 300 468)
|
||||||
@ -138,7 +139,7 @@ enum DescriptorTag {
|
|||||||
MHP_PrefetchDescriptorTag = 0x0C,
|
MHP_PrefetchDescriptorTag = 0x0C,
|
||||||
MHP_DelegatedApplicationDescriptorTag = 0x0E,
|
MHP_DelegatedApplicationDescriptorTag = 0x0E,
|
||||||
MHP_ApplicationStorageDescriptorTag = 0x10,
|
MHP_ApplicationStorageDescriptorTag = 0x10,
|
||||||
|
|
||||||
//a descriptor currently unimplemented in this library
|
//a descriptor currently unimplemented in this library
|
||||||
//the actual value 0xFF is "forbidden" according to the spec.
|
//the actual value 0xFF is "forbidden" according to the spec.
|
||||||
UnimplementedDescriptorTag = 0xFF
|
UnimplementedDescriptorTag = 0xFF
|
||||||
@ -153,7 +154,6 @@ enum RunningStatus { RunningStatusUndefined = 0,
|
|||||||
RunningStatusRunning = 4
|
RunningStatusRunning = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Some principles:
|
/* Some principles:
|
||||||
- Objects that return references to other objects contained in their data must make sure
|
- Objects that return references to other objects contained in their data must make sure
|
||||||
that the returned objects have been parsed.
|
that the returned objects have been parsed.
|
||||||
@ -161,7 +161,6 @@ enum RunningStatus { RunningStatusUndefined = 0,
|
|||||||
Note that this does not apply to Loops and Strings (their are never returned by reference, BTW).
|
Note that this does not apply to Loops and Strings (their are never returned by reference, BTW).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class Object : public Parsable {
|
class Object : public Parsable {
|
||||||
public:
|
public:
|
||||||
Object();
|
Object();
|
||||||
@ -183,7 +182,7 @@ public:
|
|||||||
Section() {}
|
Section() {}
|
||||||
TableId getTableId() const;
|
TableId getTableId() const;
|
||||||
virtual int getLength();
|
virtual int getLength();
|
||||||
|
|
||||||
static int getLength(const unsigned char *d);
|
static int getLength(const unsigned char *d);
|
||||||
static TableId getTableId(const unsigned char *d);
|
static TableId getTableId(const unsigned char *d);
|
||||||
};
|
};
|
||||||
@ -211,9 +210,6 @@ public:
|
|||||||
bool moreThanOneSection() const { return getLastSectionNumber()>1; }
|
bool moreThanOneSection() const { return getLastSectionNumber()>1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class VariableLengthPart : public Object {
|
class VariableLengthPart : public Object {
|
||||||
public:
|
public:
|
||||||
//never forget to call this
|
//never forget to call this
|
||||||
@ -225,12 +221,9 @@ private:
|
|||||||
int length;
|
int length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LoopElement : public Object {
|
class LoopElement : public Object {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SubStructure : public LoopElement {
|
class SubStructure : public LoopElement {
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -238,7 +231,7 @@ class Descriptor : public LoopElement {
|
|||||||
public:
|
public:
|
||||||
virtual int getLength();
|
virtual int getLength();
|
||||||
DescriptorTag getDescriptorTag() const;
|
DescriptorTag getDescriptorTag() const;
|
||||||
|
|
||||||
static int getLength(const unsigned char *d);
|
static int getLength(const unsigned char *d);
|
||||||
static DescriptorTag getDescriptorTag(const unsigned char *d);
|
static DescriptorTag getDescriptorTag(const unsigned char *d);
|
||||||
protected:
|
protected:
|
||||||
@ -250,8 +243,6 @@ protected:
|
|||||||
static Descriptor *getDescriptor(CharArray d, DescriptorTagDomain domain);
|
static Descriptor *getDescriptor(CharArray d, DescriptorTagDomain domain);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Loop : public VariableLengthPart {
|
class Loop : public VariableLengthPart {
|
||||||
public:
|
public:
|
||||||
class Iterator {
|
class Iterator {
|
||||||
@ -338,11 +329,11 @@ public:
|
|||||||
return (data.FourBytes(index) << 32) | data.FourBytes(index+4);
|
return (data.FourBytes(index) << 32) | data.FourBytes(index+4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T getNext(Iterator &it) const
|
T getNext(Iterator &it) const
|
||||||
{
|
{
|
||||||
T ret=operator[](it.i);
|
T ret=operator[](it.i);
|
||||||
it.i+=sizeof(T);
|
it.i+=sizeof(T);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
bool hasNext() const { return getLength() > it.i; }
|
bool hasNext() const { return getLength() > it.i; }
|
||||||
};
|
};
|
||||||
@ -352,7 +343,6 @@ public:
|
|||||||
MHP_DescriptorLoop() { domain=MHP; }
|
MHP_DescriptorLoop() { domain=MHP; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//The content of the ExtendedEventDescriptor may be split over several
|
//The content of the ExtendedEventDescriptor may be split over several
|
||||||
//descriptors if the text is longer than 256 bytes.
|
//descriptors if the text is longer than 256 bytes.
|
||||||
//The following classes provide base functionality to handle this case.
|
//The following classes provide base functionality to handle this case.
|
||||||
@ -367,7 +357,7 @@ public:
|
|||||||
DescriptorGroup(bool deleteOnDesctruction=true);
|
DescriptorGroup(bool deleteOnDesctruction=true);
|
||||||
~DescriptorGroup();
|
~DescriptorGroup();
|
||||||
void Add(GroupDescriptor *d);
|
void Add(GroupDescriptor *d);
|
||||||
void Delete();
|
void Delete();
|
||||||
int getLength() { return length; }
|
int getLength() { return length; }
|
||||||
GroupDescriptor **getDescriptors() { return array; }
|
GroupDescriptor **getDescriptors() { return array; }
|
||||||
bool isComplete(); //if all descriptors have been added
|
bool isComplete(); //if all descriptors have been added
|
||||||
@ -377,17 +367,15 @@ protected:
|
|||||||
bool deleteOnDesctruction;
|
bool deleteOnDesctruction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class String : public VariableLengthPart {
|
class String : public VariableLengthPart {
|
||||||
public:
|
public:
|
||||||
//A note to the length: getLength() returns the length of the raw data.
|
//A note to the length: getLength() returns the length of the raw data.
|
||||||
//The text may be shorter. Its length can be obtained with one of the
|
//The text may be shorter. Its length can be obtained with one of the
|
||||||
//above functions and strlen.
|
//above functions and strlen.
|
||||||
|
|
||||||
//returns text. Data is allocated with new and must be delete'd by the user.
|
//returns text. Data is allocated with new and must be delete'd by the user.
|
||||||
char *getText();
|
char *getText();
|
||||||
//copies text into given buffer.
|
//copies text into given buffer.
|
||||||
//a buffer of size getLength()+1 is guaranteed to be sufficiently large.
|
//a buffer of size getLength()+1 is guaranteed to be sufficiently large.
|
||||||
//In most descriptors the string length is an 8-bit field,
|
//In most descriptors the string length is an 8-bit field,
|
||||||
//so the maximum there is 256.
|
//so the maximum there is 256.
|
||||||
@ -398,8 +386,6 @@ protected:
|
|||||||
void decodeText(char *buffer);
|
void decodeText(char *buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
#endif //LIBSI_SI_H
|
#endif //LIBSI_SI_H
|
||||||
|
|
||||||
|
35
libsi/util.c
35
libsi/util.c
@ -6,6 +6,8 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: util.c 1.2 2003/12/13 10:42:18 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -13,7 +15,6 @@
|
|||||||
|
|
||||||
namespace SI {
|
namespace SI {
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------- CharArray ----------------------------*/
|
/*---------------------------- CharArray ----------------------------*/
|
||||||
|
|
||||||
CharArray::CharArray() : data_(0), off(0) {
|
CharArray::CharArray() : data_(0), off(0) {
|
||||||
@ -38,7 +39,7 @@ CharArray& CharArray::operator=(const CharArray &f) {
|
|||||||
++ f.data_->count_;
|
++ f.data_->count_;
|
||||||
}
|
}
|
||||||
if (data_) {
|
if (data_) {
|
||||||
if (--data_->count_ == 0)
|
if (--data_->count_ == 0)
|
||||||
delete data_;
|
delete data_;
|
||||||
}
|
}
|
||||||
data_ = f.data_;
|
data_ = f.data_;
|
||||||
@ -62,18 +63,18 @@ void CharArray::assign(const unsigned char*data, unsigned int size, bool doCopy)
|
|||||||
|
|
||||||
bool CharArray::operator==(const char *string) const {
|
bool CharArray::operator==(const char *string) const {
|
||||||
//here we can use strcmp, string is null-terminated.
|
//here we can use strcmp, string is null-terminated.
|
||||||
if (!data_)
|
if (!data_)
|
||||||
return false;
|
return false;
|
||||||
return data_->size ? (!strcmp((const char*)data_->data, string)) : string[0]==0;
|
return data_->size ? (!strcmp((const char*)data_->data, string)) : string[0]==0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharArray::operator==(const CharArray &other) const {
|
bool CharArray::operator==(const CharArray &other) const {
|
||||||
if (!data_ || !other.data_)
|
if (!data_ || !other.data_)
|
||||||
return !(data_ || other.data_); //true if both empty
|
return !(data_ || other.data_); //true if both empty
|
||||||
|
|
||||||
if (data_->size != other.data_->size)
|
if (data_->size != other.data_->size)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//do _not_ use strcmp! Data is not necessarily null-terminated.
|
//do _not_ use strcmp! Data is not necessarily null-terminated.
|
||||||
for (unsigned int i=0;i<data_->size;i++)
|
for (unsigned int i=0;i<data_->size;i++)
|
||||||
if (data_->data[i] != other.data_->data[i])
|
if (data_->data[i] != other.data_->data[i])
|
||||||
@ -98,7 +99,7 @@ CharArray::Data::Data() : count_(1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharArray::Data::~Data() {
|
CharArray::Data::~Data() {
|
||||||
/*
|
/*
|
||||||
if (locked)
|
if (locked)
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
pthread_mutex_destroy(&mutex);
|
pthread_mutex_destroy(&mutex);
|
||||||
@ -108,7 +109,7 @@ CharArray::Data::~Data() {
|
|||||||
/*CharArray::Data::Data(const Data& d) : count_(1) {
|
/*CharArray::Data::Data(const Data& d) : count_(1) {
|
||||||
size=0;
|
size=0;
|
||||||
data=0;
|
data=0;
|
||||||
|
|
||||||
lockingPid = 0;
|
lockingPid = 0;
|
||||||
locked = 0;
|
locked = 0;
|
||||||
pthread_mutex_init(&mutex, NULL);
|
pthread_mutex_init(&mutex, NULL);
|
||||||
@ -143,7 +144,6 @@ void CharArray::DataForeignData::Delete() {
|
|||||||
//do not delete!
|
//do not delete!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void CharArray::Data::assign(unsigned int s) {
|
void CharArray::Data::assign(unsigned int s) {
|
||||||
if (data)
|
if (data)
|
||||||
@ -184,16 +184,15 @@ void Parsable::CheckParse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//taken and adapted from libdtv, (c) Rolf Hakenes and VDR, (c) Klaus Schmidinger
|
||||||
//taken and adapted from libdtv, (c) Rolf Hakenes and VDR, (c) Klaus Schmidinger
|
|
||||||
time_t DVBTime::getTime(unsigned char date_hi, unsigned char date_lo, unsigned char time_hour, unsigned char time_minute, unsigned char time_second) {
|
time_t DVBTime::getTime(unsigned char date_hi, unsigned char date_lo, unsigned char time_hour, unsigned char time_minute, unsigned char time_second) {
|
||||||
unsigned short mjd = date_hi << 8 | date_lo;
|
unsigned short mjd = date_hi << 8 | date_lo;
|
||||||
struct tm t;
|
struct tm t;
|
||||||
|
|
||||||
t.tm_sec = bcdToDec(time_second);
|
t.tm_sec = bcdToDec(time_second);
|
||||||
t.tm_min = bcdToDec(time_minute);
|
t.tm_min = bcdToDec(time_minute);
|
||||||
t.tm_hour = bcdToDec(time_hour);
|
t.tm_hour = bcdToDec(time_hour);
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
t.tm_year = (int) ((mjd - 15078.2) / 365.25);
|
t.tm_year = (int) ((mjd - 15078.2) / 365.25);
|
||||||
t.tm_mon = (int) ((mjd - 14956.1 - (int)(t.tm_year * 365.25)) / 30.6001);
|
t.tm_mon = (int) ((mjd - 14956.1 - (int)(t.tm_year * 365.25)) / 30.6001);
|
||||||
@ -205,7 +204,7 @@ time_t DVBTime::getTime(unsigned char date_hi, unsigned char date_lo, unsigned c
|
|||||||
|
|
||||||
t.tm_isdst = -1;
|
t.tm_isdst = -1;
|
||||||
t.tm_gmtoff = 0;
|
t.tm_gmtoff = 0;
|
||||||
|
|
||||||
return timegm(&t);
|
return timegm(&t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,12 +278,4 @@ CRC32::CRC32(const char *d, int len, unsigned long CRCvalue) {
|
|||||||
value=CRCvalue;
|
value=CRCvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
36
libsi/util.h
36
libsi/util.h
@ -6,9 +6,10 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
|
* $Id: util.h 1.2 2003/12/13 10:42:20 kls Exp $
|
||||||
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LIBSI_UTIL_H
|
#ifndef LIBSI_UTIL_H
|
||||||
#define LIBSI_UTIL_H
|
#define LIBSI_UTIL_H
|
||||||
|
|
||||||
@ -23,28 +24,27 @@
|
|||||||
|
|
||||||
namespace SI {
|
namespace SI {
|
||||||
|
|
||||||
|
|
||||||
//Holds an array of unsigned char which is deleted
|
//Holds an array of unsigned char which is deleted
|
||||||
//when the last object pointing to it is deleted.
|
//when the last object pointing to it is deleted.
|
||||||
//Optimized for use in libsi.
|
//Optimized for use in libsi.
|
||||||
class CharArray {
|
class CharArray {
|
||||||
public:
|
public:
|
||||||
CharArray();
|
CharArray();
|
||||||
|
|
||||||
CharArray(const CharArray &source);
|
CharArray(const CharArray &source);
|
||||||
CharArray& operator=(const CharArray &source);
|
CharArray& operator=(const CharArray &source);
|
||||||
~CharArray();
|
~CharArray();
|
||||||
|
|
||||||
//can be called exactly once
|
//can be called exactly once
|
||||||
void assign(const unsigned char*data, unsigned int size, bool doCopy=true);
|
void assign(const unsigned char*data, unsigned int size, bool doCopy=true);
|
||||||
//compares to a null-terminated string
|
//compares to a null-terminated string
|
||||||
bool operator==(const char *string) const;
|
bool operator==(const char *string) const;
|
||||||
//compares to another CharArray (data not necessarily null-terminated)
|
//compares to another CharArray (data not necessarily null-terminated)
|
||||||
bool operator==(const CharArray &other) const;
|
bool operator==(const CharArray &other) const;
|
||||||
|
|
||||||
//returns another CharArray with its offset incremented by offset
|
//returns another CharArray with its offset incremented by offset
|
||||||
CharArray operator+(const unsigned int offset) const;
|
CharArray operator+(const unsigned int offset) const;
|
||||||
|
|
||||||
//access and convenience methods
|
//access and convenience methods
|
||||||
const unsigned char* getData() const { return data_->data+off; }
|
const unsigned char* getData() const { return data_->data+off; }
|
||||||
const unsigned char* getData(int offset) const { return data_->data+offset+off; }
|
const unsigned char* getData(int offset) const { return data_->data+offset+off; }
|
||||||
@ -56,17 +56,17 @@ public:
|
|||||||
int getLength() const { return data_->size; }
|
int getLength() const { return data_->size; }
|
||||||
unsigned short TwoBytes(const unsigned int index) const { return data_->data ? data_->TwoBytes(off+index) : 0; }
|
unsigned short TwoBytes(const unsigned int index) const { return data_->data ? data_->TwoBytes(off+index) : 0; }
|
||||||
unsigned long FourBytes(const unsigned int index) const { return data_->data ? data_->FourBytes(off+index) : 0; }
|
unsigned long FourBytes(const unsigned int index) const { return data_->data ? data_->FourBytes(off+index) : 0; }
|
||||||
|
|
||||||
void addOffset(unsigned int offset) { off+=offset; }
|
void addOffset(unsigned int offset) { off+=offset; }
|
||||||
private:
|
private:
|
||||||
class Data {
|
class Data {
|
||||||
public:
|
public:
|
||||||
Data();
|
Data();
|
||||||
virtual ~Data();
|
virtual ~Data();
|
||||||
|
|
||||||
virtual void assign(const unsigned char*data, unsigned int size) = 0;
|
virtual void assign(const unsigned char*data, unsigned int size) = 0;
|
||||||
virtual void Delete() = 0;
|
virtual void Delete() = 0;
|
||||||
|
|
||||||
unsigned short TwoBytes(const unsigned int index) const
|
unsigned short TwoBytes(const unsigned int index) const
|
||||||
{ return (data[index] << 8) | data[index+1]; }
|
{ return (data[index] << 8) | data[index+1]; }
|
||||||
unsigned long FourBytes(const unsigned int index) const
|
unsigned long FourBytes(const unsigned int index) const
|
||||||
@ -81,15 +81,15 @@ private:
|
|||||||
Data(const Data& d);
|
Data(const Data& d);
|
||||||
void assign(unsigned int size);
|
void assign(unsigned int size);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const unsigned char*data;
|
const unsigned char*data;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
unsigned count_;
|
unsigned count_;
|
||||||
// count_ is the number of CharArray objects that point at this
|
// count_ is the number of CharArray objects that point at this
|
||||||
// count_ must be initialized to 1 by all constructors
|
// count_ must be initialized to 1 by all constructors
|
||||||
// (it starts as 1 since it is pointed to by the CharArray object that created it)
|
// (it starts as 1 since it is pointed to by the CharArray object that created it)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
pid_t lockingPid;
|
pid_t lockingPid;
|
||||||
@ -114,8 +114,8 @@ private:
|
|||||||
unsigned int off;
|
unsigned int off;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//abstract base class
|
//abstract base class
|
||||||
class Parsable {
|
class Parsable {
|
||||||
public:
|
public:
|
||||||
@ -145,16 +145,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static unsigned long crc_table[256];
|
static unsigned long crc_table[256];
|
||||||
static unsigned long crc32 (const char *d, int len, unsigned long CRCvalue);
|
static unsigned long crc32 (const char *d, int len, unsigned long CRCvalue);
|
||||||
|
|
||||||
const char *data;
|
const char *data;
|
||||||
int length;
|
int length;
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user