Added PDCDescriptor handling to 'libsi'

This commit is contained in:
Klaus Schmidinger
2004-02-22 13:08:04 +01:00
parent 1601918327
commit 45eac6d946
5 changed files with 53 additions and 9 deletions

View File

@@ -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<const descr_pdc>(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));
}

View File

@@ -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:

View File

@@ -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 */

View File

@@ -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: