[dvblast-devel] [PATCH 16/17] dvb/si: Add support for descriptor 0x52 (Stream identifier).

Georgi Chorbadzhiyski gf at unixsol.org
Fri Sep 9 23:28:38 CEST 2011


---
 dvb/si.h       |   40 ++++++++++++++++++++++++++++++++++++++++
 dvb/si_print.h |    1 +
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/dvb/si.h b/dvb/si.h
index 5a81591..24b34c7 100644
--- a/dvb/si.h
+++ b/dvb/si.h
@@ -875,6 +875,46 @@ static inline void desc4a_print(const uint8_t *p_desc, f_print pf_print,
 }
 
 /*****************************************************************************
+ * Descriptor 0x52: Stream identifier descriptor
+ *****************************************************************************/
+#define DESC52_HEADER_SIZE      (DESC_HEADER_SIZE + 1)
+
+static inline void desc52_init(uint8_t *p_desc)
+{
+    desc_set_tag(p_desc, 0x52);
+    desc_set_length(p_desc, DESC52_HEADER_SIZE - DESC_HEADER_SIZE);
+}
+
+static inline void desc52_set_component_tag(uint8_t *p_desc, uint8_t component_tag)
+{
+    p_desc[2] = component_tag;
+}
+
+static inline uint8_t desc52_get_component_tag(const uint8_t *p_desc)
+{
+    return p_desc[2];
+}
+
+static inline bool desc52_validate(const uint8_t *p_desc)
+{
+    return desc_get_length(p_desc) >= DESC52_HEADER_SIZE - DESC_HEADER_SIZE;
+}
+
+static inline void desc52_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, "<STREAM_IDENTIFIER_DESC component_tag=\"%u\"/>",
+                 desc52_get_component_tag(p_desc));
+        break;
+    default:
+        pf_print(opaque, "    - desc 52 component_tag=%u",
+                 desc52_get_component_tag(p_desc));
+    }
+}
+
+/*****************************************************************************
  * Descriptor 0x56: Teletext descriptor
  *****************************************************************************/
 #define DESC56_HEADER_SIZE      DESC46_HEADER_SIZE
diff --git a/dvb/si_print.h b/dvb/si_print.h
index 732287b..6791830 100644
--- a/dvb/si_print.h
+++ b/dvb/si_print.h
@@ -110,6 +110,7 @@ static inline void descs_print(uint8_t *p_descs,
         CASE_DESC_ICONV(47)
         CASE_DESC_ICONV(48)
         CASE_DESC(4a)
+        CASE_DESC(52)
         CASE_DESC(56)
         CASE_DESC(59)
         CASE_DESC(5a)
-- 
1.7.5.1



More information about the dvblast-devel mailing list