From 45eac6d94694aa9081bdd0e06794942c49818ff1 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 22 Feb 2004 13:08:04 +0100 Subject: Added PDCDescriptor handling to 'libsi' --- libsi/descriptor.c | 23 ++++++++++++++++++++++- libsi/descriptor.h | 14 +++++++++++++- libsi/headers.h | 14 +++++++++++--- libsi/si.c | 6 ++++-- 4 files changed, 50 insertions(+), 7 deletions(-) (limited to 'libsi') diff --git a/libsi/descriptor.c b/libsi/descriptor.c index 55a6a9c0..0b0019f8 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.5 2004/01/24 14:52:41 kls Exp $ + * $Id: descriptor.c 1.6 2004/02/22 11:11:36 kls Exp $ * * ***************************************************************************/ @@ -529,6 +529,27 @@ void ISO639LanguageDescriptor::Parse() { languageCode[3]=0; } +void PDCDescriptor::Parse() { + unsigned int offset=0; + data.setPointerAndOffset(s, offset); +} + +int PDCDescriptor::getDay() const { + return ((s->pil0 & 0x0F) << 1) | ((s->pil1 & 0x80) >> 7); +} + +int PDCDescriptor::getMonth() const { + return (s->pil1 >> 3) & 0x0F; +} + +int PDCDescriptor::getHour() const { + return ((s->pil1 & 0x07) << 2) | ((s->pil2 & 0xC0) >> 6); +} + +int PDCDescriptor::getMinute() const { + return s->pil2 & 0x3F; +} + 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 5541cc41..17c81eb0 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.5 2004/01/24 14:52:05 kls Exp $ + * $Id: descriptor.h 1.6 2004/02/22 10:16:47 kls Exp $ * * ***************************************************************************/ @@ -383,6 +383,18 @@ private: const descr_iso_639_language *s; }; +class PDCDescriptor : public Descriptor { +public: + int getDay() const; + int getMonth() const; + int getHour() const; + int getMinute() const; +protected: + virtual void Parse(); +private: + const descr_pdc *s; +}; + //a descriptor currently unimplemented in this library class UnimplementedDescriptor : public Descriptor { protected: diff --git a/libsi/headers.h b/libsi/headers.h index 26fdb27c..ff3e0f95 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.3 2004/02/20 13:49:16 kls Exp $ + * $Id: headers.h 1.4 2004/02/22 11:12:46 kls Exp $ * * ***************************************************************************/ @@ -1457,11 +1457,19 @@ struct descr_dsng { /* 0x69 pdc_descriptor */ -#define DESCR_PDC_LEN XX +#define DESCR_PDC_LEN 5 struct descr_pdc { u_char descriptor_tag :8; u_char descriptor_length :8; - /* TBD */ +#if BYTE_ORDER == BIG_ENDIAN + u_char pil2 :8; + u_char pil1 :8; + u_char pil0 :8; +#else + u_char pil0 :8; + u_char pil1 :8; + u_char pil2 :8; +#endif }; /* 0x6A ac3_descriptor */ diff --git a/libsi/si.c b/libsi/si.c index b952fb51..ee648020 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.7 2004/02/20 13:46:12 kls Exp $ + * $Id: si.c 1.8 2004/02/22 10:14:12 kls Exp $ * * ***************************************************************************/ @@ -334,6 +334,9 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain) case ISO639LanguageDescriptorTag: d=new ISO639LanguageDescriptor(); break; + case PDCDescriptorTag: + d=new PDCDescriptor(); + break; //note that it is no problem to implement one //of the unimplemented descriptors. @@ -375,7 +378,6 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain) case CaSystemDescriptorTag: case AC3DescriptorTag: case DSNGDescriptorTag: - case PDCDescriptorTag: case AncillaryDataDescriptorTag: case AnnouncementSupportDescriptorTag: case AdaptationFieldDataDescriptorTag: -- cgit v1.2.3