From 2a11c183b5cd6700edb89cf94515b8390a5f8a7a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 12 Jan 2004 22:19:34 +0100 Subject: Added LinkageDescriptor handling to 'libsi' --- libsi/descriptor.c | 24 +++++++++++++++++++++++- libsi/descriptor.h | 15 ++++++++++++++- libsi/si.c | 6 ++++-- libsi/si.h | 18 ++++++++++++++---- 4 files changed, 55 insertions(+), 8 deletions(-) (limited to 'libsi') diff --git a/libsi/descriptor.c b/libsi/descriptor.c index 433d6802..4f4ef341 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.2 2003/12/13 10:42:05 kls Exp $ + * $Id: descriptor.c 1.3 2004/01/12 16:17:20 kls Exp $ * * ***************************************************************************/ @@ -492,6 +492,28 @@ void MultilingualServiceNameDescriptor::Name::Parse() { name.setData(data+offset, mid->service_name_length); } +void LinkageDescriptor::Parse() { + unsigned int offset=0; + data.setPointerAndOffset(s, offset); + privateData.assign(data.getData(offset), getLength()-offset); +} + +int LinkageDescriptor::getTransportStreamId() const { + return HILO(s->transport_stream_id); +} + +int LinkageDescriptor::getOriginalNetworkId() const { + return HILO(s->original_network_id); +} + +int LinkageDescriptor::getServiceId() const { + return HILO(s->service_id); +} + +LinkageType LinkageDescriptor::getLinkageType() const { + return (LinkageType)s->linkage_type; +} + void ApplicationSignallingDescriptor::Parse() { entryLoop.setData(data+sizeof(descr_application_signalling), getLength()-sizeof(descr_application_signalling)); } diff --git a/libsi/descriptor.h b/libsi/descriptor.h index 9abe1f01..3eb90fa2 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.2 2003/12/13 10:42:08 kls Exp $ + * $Id: descriptor.h 1.3 2004/01/12 16:17:47 kls Exp $ * * ***************************************************************************/ @@ -361,6 +361,19 @@ protected: virtual void Parse(); }; +class LinkageDescriptor : public Descriptor { +public: + int getTransportStreamId() const; + int getOriginalNetworkId() const; + int getServiceId() const; + LinkageType getLinkageType() const; + CharArray privateData; +protected: + virtual void Parse(); +private: + const descr_linkage *s; +}; + //a descriptor currently unimplemented in this library class UnimplementedDescriptor : public Descriptor { protected: diff --git a/libsi/si.c b/libsi/si.c index ac2e26ff..4342097f 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.4 2004/01/05 11:04:17 kls Exp $ + * $Id: si.c 1.5 2004/01/12 22:19:34 kls Exp $ * * ***************************************************************************/ @@ -320,6 +320,9 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain) case ApplicationSignallingDescriptorTag: d=new ApplicationSignallingDescriptor(); break; + case LinkageDescriptorTag: + d=new LinkageDescriptor(); + break; //note that it is no problem to implement one //of the unimplemented descriptors. @@ -348,7 +351,6 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain) case VBITeletextDescriptorTag: case CountryAvailabilityDescriptorTag: case MocaicDescriptorTag: - case LinkageDescriptorTag: case TeletextDescriptorTag: case TelephoneDescriptorTag: case LocalTimeOffsetDescriptorTag: diff --git a/libsi/si.h b/libsi/si.h index d2ac417c..4666c2d4 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.5 2004/01/09 15:59:53 kls Exp $ + * $Id: si.h 1.6 2004/01/12 16:19:11 kls Exp $ * * ***************************************************************************/ @@ -154,6 +154,18 @@ enum RunningStatus { RunningStatusUndefined = 0, RunningStatusRunning = 4 }; +enum LinkageType { LinkageTypeInformationService = 0x01, + LinkageTypeEPGService = 0x02, + LinkageTypeCaReplacementService = 0x03, + LinkageTypeTSContainingCompleteNetworkBouquetSi = 0x04, + LinkageTypeServiceReplacementService = 0x05, + LinkageTypeDataBroadcastService = 0x06, + LinkageTypeRCSMap = 0x07, + LinkageTypeMobileHandover = 0x08, + LinkageTypeSystemSoftwareUpdateService = 0x09, + LinkageTypeTSContainingSsuBatOrNit = 0x0A + }; + /* Some principles: - Objects that return references to other objects contained in their data must make sure that the returned objects have been parsed. @@ -167,6 +179,7 @@ public: Object(CharArray &d); //can only be called once since data is immutable void setData(const unsigned char*data, unsigned int size, bool doCopy=true); + CharArray getData() { return data; } virtual int getLength() = 0; protected: CharArray data; @@ -224,9 +237,6 @@ private: class LoopElement : public Object { }; -class SubStructure : public LoopElement { -}; - class Descriptor : public LoopElement { public: virtual int getLength(); -- cgit v1.2.3