summaryrefslogtreecommitdiff
path: root/libsi
diff options
context:
space:
mode:
Diffstat (limited to 'libsi')
-rw-r--r--libsi/descriptor.c23
-rw-r--r--libsi/descriptor.h14
-rw-r--r--libsi/headers.h59
-rw-r--r--libsi/section.c18
-rw-r--r--libsi/section.h15
-rw-r--r--libsi/si.c14
-rw-r--r--libsi/si.h7
7 files changed, 137 insertions, 13 deletions
diff --git a/libsi/descriptor.c b/libsi/descriptor.c
index 55a6a9c..0b0019f 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<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));
}
diff --git a/libsi/descriptor.h b/libsi/descriptor.h
index 5541cc4..17c81eb 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 d5c1199..ff3e0f9 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.2 2003/12/13 10:43:26 kls Exp $
+ * $Id: headers.h 1.4 2004/02/22 11:12:46 kls Exp $
* *
***************************************************************************/
@@ -257,7 +257,48 @@ struct pmt_info {
/*
*
- * 4) Network Information Table (NIT):
+ * 4) Transport Stream Description Table (TSDT):
+ *
+ * - The TSDT carries a loop of descriptors that apply to
+ * the whole transport stream. The syntax and semantics
+ * of the TSDT are defined in newer versions of ISO/IEC 13818-1.
+ *
+ */
+
+#define TSDT_LEN 8
+
+struct tsdt {
+ u_char table_id :8;
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char section_syntax_indicator :1;
+ u_char dummy :1; // has to be 0
+ u_char :2;
+ u_char section_length_hi :4;
+#else
+ u_char section_length_hi :4;
+ u_char :2;
+ u_char dummy :1; // has to be 0
+ u_char section_syntax_indicator :1;
+#endif
+ u_char section_length_lo :8;
+ u_char :8;
+ u_char :8;
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char :2;
+ u_char version_number :5;
+ u_char current_next_indicator :1;
+#else
+ u_char current_next_indicator :1;
+ u_char version_number :5;
+ u_char :2;
+#endif
+ u_char section_number :8;
+ u_char last_section_number :8;
+};
+
+/*
+ *
+ * 5) Network Information Table (NIT):
*
* - the NIT is intended to provide information about the physical
* network. The syntax and semantics of the NIT are defined in
@@ -468,7 +509,7 @@ struct eit {
u_char original_network_id_hi :8;
u_char original_network_id_lo :8;
u_char segment_last_section_number :8;
- u_char segment_last_table_id :8;
+ u_char last_table_id :8;
};
#define EIT_EVENT_LEN 12
@@ -1416,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/section.c b/libsi/section.c
index 0de2a57..2cac809 100644
--- a/libsi/section.c
+++ b/libsi/section.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: section.c 1.2 2003/12/13 10:42:14 kls Exp $
+ * $Id: section.c 1.3 2004/02/20 13:44:59 kls Exp $
* *
***************************************************************************/
@@ -76,6 +76,14 @@ void PMT::Stream::Parse() {
streamDescriptors.setData(data+offset, HILO(s->ES_info_length));
}
+/*********************** TSDT ***********************/
+
+void TSDT::Parse() {
+ unsigned int offset=0;
+ data.setPointerAndOffset<const tsdt>(s, offset);
+ transportStreamDescriptors.setDataAndOffset(data+offset, getLength()-offset-4, offset);
+}
+
/*********************** NIT ***********************/
int NIT::getNetworkId() const {
@@ -161,6 +169,14 @@ int EIT::getOriginalNetworkId() const {
return HILO(s->original_network_id);
}
+int EIT::getSegmentLastSectionNumber() const {
+ return s->segment_last_section_number;
+}
+
+int EIT::getLastTableId() const {
+ return s->last_table_id;
+}
+
bool EIT::isPresentFollowing() const {
return getTableId() == TableIdEIT_presentFollowing || getTableId() == TableIdEIT_presentFollowing_other;
}
diff --git a/libsi/section.h b/libsi/section.h
index efca9bb..5b43f05 100644
--- a/libsi/section.h
+++ b/libsi/section.h
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: section.h 1.2 2003/12/13 10:42:15 kls Exp $
+ * $Id: section.h 1.3 2004/02/20 13:45:45 kls Exp $
* *
***************************************************************************/
@@ -77,6 +77,17 @@ private:
const pmt *s;
};
+class TSDT : public NumberedSection {
+public:
+ TSDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
+ TSDT() {}
+ DescriptorLoop transportStreamDescriptors;
+protected:
+ virtual void Parse();
+private:
+ const tsdt *s;
+};
+
class NIT : public NumberedSection {
public:
NIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
@@ -166,6 +177,8 @@ public:
int getServiceId() const;
int getTransportStreamId() const;
int getOriginalNetworkId() const;
+ int getSegmentLastSectionNumber() const;
+ int getLastTableId() const;
StructureLoop<Event> eventLoop;
//true if table conveys present/following information, false if it conveys schedule information
diff --git a/libsi/si.c b/libsi/si.c
index 4264feb..ee64802 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.6 2004/01/23 14:27:45 kls Exp $
+ * $Id: si.c 1.8 2004/02/22 10:14:12 kls Exp $
* *
***************************************************************************/
@@ -61,6 +61,14 @@ bool CRCSection::CheckCRCAndParse() {
return true;
}
+int NumberedSection::getTableIdExtension() const {
+ return getTableIdExtension(data.getData());
+}
+
+int NumberedSection::getTableIdExtension(const unsigned char *d) {
+ return HILO(((const ExtendedSectionHeader *)d)->table_id_extension);
+}
+
bool NumberedSection::getCurrentNextIndicator() const {
return data.getData<ExtendedSectionHeader>()->current_next_indicator;
}
@@ -326,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.
@@ -367,7 +378,6 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain)
case CaSystemDescriptorTag:
case AC3DescriptorTag:
case DSNGDescriptorTag:
- case PDCDescriptorTag:
case AncillaryDataDescriptorTag:
case AnnouncementSupportDescriptorTag:
case AdaptationFieldDataDescriptorTag:
diff --git a/libsi/si.h b/libsi/si.h
index 4666c2d..befff85 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.6 2004/01/12 16:19:11 kls Exp $
+ * $Id: si.h 1.8 2004/02/23 17:02:33 kls Exp $
* *
***************************************************************************/
@@ -36,7 +36,7 @@ enum TableId { TableIdPAT = 0x00, //program association section
TableIdEIT_schedule_last = 0x5F,
//range from 0x60 to 0x6F
TableIdEIT_schedule_Other_first = 0x60,
- TableIdEIT_schedule_Other_fast = 0x6F,
+ TableIdEIT_schedule_Other_last = 0x6F,
TableIdTDT = 0x70, //time date section
TableIdRST = 0x71, //running status section
TableIdST = 0x72, //stuffing section
@@ -216,11 +216,14 @@ class NumberedSection : public CRCSection {
public:
NumberedSection(const unsigned char *data, bool doCopy=true) : CRCSection(data, doCopy) {}
NumberedSection() {}
+ int getTableIdExtension() const;
bool getCurrentNextIndicator() const;
int getVersionNumber() const;
int getSectionNumber() const;
int getLastSectionNumber() const;
bool moreThanOneSection() const { return getLastSectionNumber()>0; }
+
+ static int getTableIdExtension(const unsigned char *d);
};
class VariableLengthPart : public Object {