[dvblast-devel] [PATCH 09/17] mpeg/psi: Add support for descriptor 0x06 (Data stream alignment).
Georgi Chorbadzhiyski
gf at unixsol.org
Fri Sep 9 23:28:31 CEST 2011
---
dvb/si_print.h | 1 +
mpeg/psi.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/dvb/si_print.h b/dvb/si_print.h
index 1361923..46f6b39 100644
--- a/dvb/si_print.h
+++ b/dvb/si_print.h
@@ -94,6 +94,7 @@ static inline void descs_print(uint8_t *p_descs,
CASE_DESC(02)
CASE_DESC(03)
CASE_DESC(05)
+ CASE_DESC(06)
CASE_DESC(09)
CASE_DESC(0a)
CASE_DESC_ICONV(40)
diff --git a/mpeg/psi.h b/mpeg/psi.h
index fe49180..a88e6f4 100644
--- a/mpeg/psi.h
+++ b/mpeg/psi.h
@@ -327,6 +327,55 @@ static inline void desc05_print(const uint8_t *p_desc, f_print pf_print,
}
/*****************************************************************************
+ * Descriptor 0x06: Data stream alignment descriptor
+ *****************************************************************************/
+#define DESC06_HEADER_SIZE (DESC_HEADER_SIZE + 1)
+
+static inline void desc06_init(uint8_t *p_desc)
+{
+ desc_set_tag(p_desc, 0x06);
+ desc_set_length(p_desc, DESC06_HEADER_SIZE - DESC_HEADER_SIZE);
+}
+
+static inline void desc06_set_alignment(uint8_t *p_desc, uint8_t alignment)
+{
+ p_desc[2] = alignment;
+}
+
+static inline uint8_t desc06_get_alignment(const uint8_t *p_desc)
+{
+ return p_desc[2];
+}
+
+static inline const char *desc06_get_alignment_txt(uint8_t alignment)
+{
+ return alignment == 0x00 ? "Reserved" :
+ alignment == 0x01 ? "Slice, or video access unit or syncword" :
+ alignment == 0x02 ? "Video access unit" :
+ alignment == 0x03 ? "GOP, or SEQ" :
+ alignment == 0x04 ? "SEQ" : "Reserved";
+}
+
+static inline bool desc06_validate(const uint8_t *p_desc)
+{
+ return desc_get_length(p_desc) >= DESC06_HEADER_SIZE - DESC_HEADER_SIZE;
+}
+
+static inline void desc06_print(const uint8_t *p_desc, f_print pf_print,
+ void *opaque, print_type_t i_print_type)
+{
+ switch (i_print_type) {
+ case PRINT_XML:
+ pf_print(opaque, "<DATA_STREAM_ALIGNMENT_DESC alignment=\"%s\"/>",
+ desc06_get_alignment_txt(desc06_get_alignment(p_desc)));
+ break;
+ default:
+ pf_print(opaque, " - desc 06 alignment=%s",
+ desc06_get_alignment_txt(desc06_get_alignment(p_desc)));
+ }
+}
+
+/*****************************************************************************
* Descriptor 0x09: Conditional access descriptor
*****************************************************************************/
#define DESC09_HEADER_SIZE (DESC_HEADER_SIZE + 4)
--
1.7.5.1
More information about the dvblast-devel
mailing list