From f3bc8d1988c265c4bf99c27826c3a9e985bfa31d Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 3 Feb 2007 12:13:08 +0100 Subject: [PATCH] Adapted 'libsi' to DVB-S2 --- CONTRIBUTORS | 1 + HISTORY | 1 + libsi/descriptor.c | 61 ++++++++++++- libsi/descriptor.h | 33 ++++++- libsi/headers.h | 209 +++++++++++++++++++++++++++++++++++++++++++-- libsi/si.c | 21 ++++- libsi/si.h | 17 +++- 7 files changed, 326 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 39b1237a..fc4a42e5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1390,6 +1390,7 @@ Marco Schl for reporting a problem with displaying the replay mode symbol in case of "Multi speed mode" for removing 'assert(0)' from cDvbSpuDecoder::setTime() + for adapting 'libsi' to DVB-S2 Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 1b077217..51f94c83 100644 --- a/HISTORY +++ b/HISTORY @@ -5105,3 +5105,4 @@ Video Disk Recorder Revision History with open file handles when starting background commands (thanks to Reinhard Nissl). - Removed 'assert(0)' from cDvbSpuDecoder::setTime() (thanks to Marco Schlüßler). +- Adapted 'libsi' to DVB-S2 (thanks to Marco Schlüßler). diff --git a/libsi/descriptor.c b/libsi/descriptor.c index 1654a33b..f3bb3442 100644 --- a/libsi/descriptor.c +++ b/libsi/descriptor.c @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: descriptor.c 1.21 2006/05/28 14:25:30 kls Exp $ + * $Id: descriptor.c 1.22 2007/02/03 11:45:58 kls Exp $ * * ***************************************************************************/ @@ -418,8 +418,16 @@ int SatelliteDeliverySystemDescriptor::getPolarization() const { return s->polarization; } -int SatelliteDeliverySystemDescriptor::getModulation() const { - return s->modulation; +int SatelliteDeliverySystemDescriptor::getModulationSystem() const { + return s->modulation_system; +} + +int SatelliteDeliverySystemDescriptor::getModulationType() const { + return s->modulation_type; +} + +int SatelliteDeliverySystemDescriptor::getRollOff() const { + return s->roll_off; } int SatelliteDeliverySystemDescriptor::getSymbolRate() const { @@ -462,6 +470,18 @@ int TerrestrialDeliverySystemDescriptor::getFrequency() const { return (HILO(s->frequency_hi) << 16) | HILO(s->frequency_lo); } +int TerrestrialDeliverySystemDescriptor::getPriority() const { + return s->priority; +} + +int TerrestrialDeliverySystemDescriptor::getTimeSlicingIndicator() const { + return s->time_slicing_indicator; +} + +int TerrestrialDeliverySystemDescriptor::getMpeFecIndicator() const { + return s->mpe_fec_indicator; +} + int TerrestrialDeliverySystemDescriptor::getBandwidth() const { return s->bandwidth; } @@ -794,6 +814,41 @@ int AncillaryDataDescriptor::getAncillaryDataIdentifier() const { return s->ancillary_data_identifier; } +void S2SatelliteDeliverySystemDescriptor::Parse() { + int offset=0; + input_stream_identifier=0; + data.setPointerAndOffset(s, offset); + if (s->scrambling_sequence_selector) + data.setPointerAndOffset(sss, offset); + if (s->multiple_input_stream_flag) + input_stream_identifier = *data.getData(offset++); +} + +int S2SatelliteDeliverySystemDescriptor::getScramblingSequenceSelector() const { + return s->scrambling_sequence_selector; +} + +int S2SatelliteDeliverySystemDescriptor::getMultipleInputStreamFlag() const { + return s->multiple_input_stream_flag; +} + +int S2SatelliteDeliverySystemDescriptor::getBackwardsCompatibilityIndicator() const { + return s->backwards_compatibility_indicator; +} + +int S2SatelliteDeliverySystemDescriptor::getScramblingSequenceIndex() const { + return sss == NULL ? 0 : (sss->scrambling_sequence_index_hi_lo << 16) | HILO(sss->scrambling_sequence_index_lo); +} + +void ExtensionDescriptor::Parse() { + int offset=0; + data.setPointerAndOffset(s, offset); +} + +int ExtensionDescriptor::getExtensionDescriptorTag() const { + return s->descriptor_tag_extension; +} + int PremiereContentTransmissionDescriptor::getOriginalNetworkId() const { return HILO(s->original_network_id); } diff --git a/libsi/descriptor.h b/libsi/descriptor.h index c0c884fd..161793e5 100644 --- a/libsi/descriptor.h +++ b/libsi/descriptor.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: descriptor.h 1.15 2006/05/28 14:25:30 kls Exp $ + * $Id: descriptor.h 1.16 2007/02/03 11:45:58 kls Exp $ * * ***************************************************************************/ @@ -210,7 +210,9 @@ public: int getOrbitalPosition() const; int getWestEastFlag() const; int getPolarization() const; - int getModulation() const; + int getModulationSystem() const; + int getModulationType() const; + int getRollOff() const; int getSymbolRate() const; int getFecInner() const; protected: @@ -236,6 +238,9 @@ class TerrestrialDeliverySystemDescriptor : public Descriptor { public: int getFrequency() const; int getBandwidth() const; + int getPriority() const; + int getTimeSlicingIndicator() const; + int getMpeFecIndicator() const; int getConstellation() const; int getHierarchy() const; int getCodeRateHP() const; @@ -484,6 +489,30 @@ private: const descr_ancillary_data *s; }; +class S2SatelliteDeliverySystemDescriptor : public Descriptor { +public: + int getScramblingSequenceSelector() const; + int getMultipleInputStreamFlag() const; + int getBackwardsCompatibilityIndicator() const; + int getScramblingSequenceIndex() const; + int getInputStreamIdentifier() const { return input_stream_identifier; } +protected: + virtual void Parse(); +private: + const descr_s2_satellite_delivery_system *s; + const descr_scrambling_sequence_selector *sss; + int input_stream_identifier; +}; + +class ExtensionDescriptor : public Descriptor { +public: + int getExtensionDescriptorTag() const; +protected: + virtual void Parse(); +private: + const descr_extension *s; +}; + // Private DVB Descriptor Premiere.de // 0xF2 Content Transmission Descriptor // http://dvbsnoop.sourceforge.net/examples/example-private-section.html diff --git a/libsi/headers.h b/libsi/headers.h index ea7824bc..db1e261e 100644 --- a/libsi/headers.h +++ b/libsi/headers.h @@ -10,7 +10,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: headers.h 1.8 2006/09/02 20:25:16 kls Exp $ + * $Id: headers.h 1.9 2007/02/03 11:45:58 kls Exp $ * * ***************************************************************************/ @@ -942,9 +942,13 @@ struct descr_satellite_delivery_system { #if BYTE_ORDER == BIG_ENDIAN u_char west_east_flag :1; u_char polarization :2; - u_char modulation :5; + u_char roll_off :2; + u_char modulation_system :1; + u_char modulation_type :2; #else - u_char modulation :5; + u_char modulation_type :2; + u_char modulation_system :1; + u_char roll_off :2; u_char polarization :2; u_char west_east_flag :1; #endif @@ -1349,9 +1353,15 @@ struct descr_terrestrial_delivery { u_char frequency_lo_lo :8; #if BYTE_ORDER == BIG_ENDIAN u_char bandwidth :3; - u_char reserved1 :5; + u_char priority :1; + u_char time_slicing_indicator :1; + u_char mpe_fec_indicator :1; + u_char reserved1 :2; #else - u_char reserved1 :5; + u_char reserved1 :2; + u_char mpe_fec_indicator :1; + u_char time_slicing_indicator :1; + u_char priority :1; u_char bandwidth :3; #endif #if BYTE_ORDER == BIG_ENDIAN @@ -1492,10 +1502,10 @@ struct descr_data_broadcast { /* TBD */ }; -/* 0x65 ca_system_descriptor */ +/* 0x65 scrambling_descriptor */ -#define DESCR_CA_SYSTEM_LEN XX -struct descr_ca_system { +#define DESCR_SCRAMBLING_LEN XX +struct descr_scrambling { u_char descriptor_tag :8; u_char descriptor_length :8; /* TBD */ @@ -1628,6 +1638,189 @@ struct descr_service_identifier { u_char descriptor_length :8; }; +/* 0x72 service_availbility_descriptor */ + +struct descr_service_availbility { + u_char descriptor_tag :8; + u_char descriptor_length :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char availability_flag :1; + u_char reserved :7; +#else + u_char reserved :7; + u_char availability_flag :1; +#endif +}; + +/* 0x73 default_authority_descriptor (ETSI TS 102 323) */ + +struct descr_default_authority { + u_char descriptor_tag :8; + u_char descriptor_length :8; +}; + +/* 0x74 related_content_descriptor (ETSI TS 102 323) */ + +struct descr_related_content { + u_char descriptor_tag :8; + u_char descriptor_length :8; +}; + +/* 0x75 tva_id_descriptor (ETSI TS 102 323) */ + +struct descr_tva_id { + u_char descriptor_tag :8; + u_char descriptor_length :8; +}; + +/* 0x76 content_identifier_descriptor (ETSI TS 102 323) */ + +struct descr_content_identifier { + u_char descriptor_tag :8; + u_char descriptor_length :8; +}; + +/* 0x77 time_slice_fec_identifier_descriptor (ETSI EN 301 192) */ + +struct descr_time_slice_fec_identifier { + u_char descriptor_tag :8; + u_char descriptor_length :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char time_slicing :1; + u_char mpe_fec :2; + u_char reserved :2; + u_char frame_size :3; +#else + u_char frame_size :3; + u_char reserved :2; + u_char mpe_fec :2; + u_char time_slicing :1; +#endif + u_char max_burst_duration :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char max_average_rate :4; + u_char time_slice_fec_id :4; +#else + u_char time_slice_fec_id :4; + u_char max_average_rate :4; +#endif +}; + +/* 0x78 ecm_repetition_rate_descriptor (ETSI EN 301 192) */ + +struct descr_ecm_repetition_rate { + u_char descriptor_tag :8; + u_char descriptor_length :8; + u_char ca_system_id_hi :8; + u_char ca_system_id_lo :8; + u_char ecm_repetition_rate_hi :8; + u_char ecm_repetition_rate_lo :8; +}; + +/* 0x79 s2_satellite_delivery_system_descriptor */ + +struct descr_s2_satellite_delivery_system { + u_char descriptor_tag :8; + u_char descriptor_length :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char scrambling_sequence_selector :1; + u_char multiple_input_stream_flag :1; + u_char backwards_compatibility_indicator :1; + u_char reserved :5; +#else + u_char reserved :5; + u_char backwards_compatibility_indicator :1; + u_char multiple_input_stream_flag :1; + u_char scrambling_sequence_selector :1; +#endif +}; + +struct descr_scrambling_sequence_selector { +#if BYTE_ORDER == BIG_ENDIAN + u_char reserved :6; + u_char scrambling_sequence_index_hi_lo :2; +#else + u_char scrambling_sequence_index_hi_lo :2; + u_char reserved :6; +#endif + u_char scrambling_sequence_index_lo_hi :8; + u_char scrambling_sequence_index_lo_lo :8; +}; + +/* 0x7A enhanced_ac3_descriptor */ + +struct descr_enhanced_ac3 { + u_char descriptor_tag :8; + u_char descriptor_length :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char component_type_flag :1; + u_char bsid_flag :1; + u_char mainid_flag :1; + u_char asvc_flag :1; + u_char mixinfoexists :1; + u_char substream1_flag :1; + u_char substream2_flag :1; + u_char substream3_flag :1; +#else + u_char substream3_flag :1; + u_char substream2_flag :1; + u_char substream1_flag :1; + u_char mixinfoexists :1; + u_char asvc_flag :1; + u_char mainid_flag :1; + u_char bsid_flag :1; + u_char component_type_flag :1; +#endif +}; + +/* 0x7B dts_descriptor */ + +struct descr_dts { + u_char descriptor_tag :8; + u_char descriptor_length :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char sample_rate_code :4; + u_char bit_rate_code :6; + u_char nblks :7; + u_char fsize_hi :6; + u_char fsize_lo :8; + u_char surround_mode :6; + u_char lfe_flag :1; + u_char extended_surround_flag :2; +#else + u_char extended_surround_flag :2; + u_char lfe_flag :1; + u_char surround_mode :6; + u_char fsize_lo :8; + u_char fsize_hi :6; + u_char nblks :7; + u_char bit_rate_code :6; + u_char sample_rate_code :4; +#endif +}; + +/* 0x7C aac_descriptor */ + +struct descr_aac { + u_char descriptor_tag :8; + u_char descriptor_length :8; + u_char profile_and_level :8; +#if BYTE_ORDER == BIG_ENDIAN + u_char aac_type_flag :1; + u_char reserved :7; +#else + u_char reserved :7; + u_char aac_type_flag :1; +#endif +}; +/* 0x7F extension_descriptor */ + +struct descr_extension { + u_char descriptor_tag :8; + u_char descriptor_length :8; + u_char descriptor_tag_extension :8; +}; + /* MHP 0x00 application_descriptor */ #define DESCR_APPLICATION_LEN 3 diff --git a/libsi/si.c b/libsi/si.c index c7f23e88..a16000de 100644 --- a/libsi/si.c +++ b/libsi/si.c @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: si.c 1.16 2006/04/14 10:53:44 kls Exp $ + * $Id: si.c 1.17 2007/02/03 11:45:58 kls Exp $ * * ***************************************************************************/ @@ -425,6 +425,12 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain, case AncillaryDataDescriptorTag: d=new AncillaryDataDescriptor(); break; + case S2SatelliteDeliverySystemDescriptorTag: + d=new S2SatelliteDeliverySystemDescriptor(); + break; + case ExtensionDescriptorTag: + d=new ExtensionDescriptor(); + break; //note that it is no problem to implement one //of the unimplemented descriptors. @@ -459,12 +465,23 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain, case PartialTransportStreamDescriptorTag: case DataBroadcastDescriptorTag: case DataBroadcastIdDescriptorTag: - case CaSystemDescriptorTag: + case ScramblingDescriptorTag: case AC3DescriptorTag: case DSNGDescriptorTag: case AnnouncementSupportDescriptorTag: case AdaptationFieldDataDescriptorTag: case TransportStreamDescriptorTag: + + //defined in ETSI EN 300 468 v 1.7.1 + case DefaultAuthorityDescriptorTag: + case RelatedContentDescriptorTag: + case TVAIdDescriptorTag: + case ContentIdentifierDescriptorTag: + case TimeSliceFecIdentifierDescriptorTag: + case ECMRepetitionRateDescriptorTag: + case EnhancedAC3DescriptorTag: + case DTSDescriptorTag: + case AACDescriptorTag: default: if (!returnUnimplemetedDescriptor) return 0; diff --git a/libsi/si.h b/libsi/si.h index a4877169..eb016094 100644 --- a/libsi/si.h +++ b/libsi/si.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: si.h 1.15 2006/05/27 13:07:20 kls Exp $ + * $Id: si.h 1.16 2007/02/03 11:47:25 kls Exp $ * * ***************************************************************************/ @@ -108,7 +108,7 @@ enum DescriptorTag { FrequencyListDescriptorTag = 0x62, PartialTransportStreamDescriptorTag = 0x63, DataBroadcastDescriptorTag = 0x64, - CaSystemDescriptorTag = 0x65, + ScramblingDescriptorTag = 0x65, DataBroadcastIdDescriptorTag = 0x66, TransportStreamDescriptorTag = 0x67, DSNGDescriptorTag = 0x68, @@ -122,6 +122,19 @@ enum DescriptorTag { AdaptationFieldDataDescriptorTag = 0x70, ServiceIdentifierDescriptorTag = 0x71, ServiceAvailabilityDescriptorTag = 0x72, + // defined by ETSI (EN 300 468) v 1.7.1 + DefaultAuthorityDescriptorTag = 0x73, + RelatedContentDescriptorTag = 0x74, + TVAIdDescriptorTag = 0x75, + ContentIdentifierDescriptorTag = 0x76, + TimeSliceFecIdentifierDescriptorTag = 0x77, + ECMRepetitionRateDescriptorTag = 0x78, + S2SatelliteDeliverySystemDescriptorTag = 0x79, + EnhancedAC3DescriptorTag = 0x7A, + DTSDescriptorTag = 0x7B, + AACDescriptorTag = 0x7C, + ExtensionDescriptorTag = 0x7F, + // Defined by ETSI TS 102 812 (MHP) // They once again start with 0x00 (see page 234, MHP specification) MHP_ApplicationDescriptorTag = 0x00,