[dvblast-devel] [PATCH 10/17] mpeg/psi: Add support for descriptor 0x0B (System clock).

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


---
 dvb/si_print.h |    1 +
 mpeg/psi.h     |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/dvb/si_print.h b/dvb/si_print.h
index 46f6b39..a22765d 100644
--- a/dvb/si_print.h
+++ b/dvb/si_print.h
@@ -97,6 +97,7 @@ static inline void descs_print(uint8_t *p_descs,
         CASE_DESC(06)
         CASE_DESC(09)
         CASE_DESC(0a)
+        CASE_DESC(0b)
         CASE_DESC_ICONV(40)
         CASE_DESC(41)
         CASE_DESC(43)
diff --git a/mpeg/psi.h b/mpeg/psi.h
index a88e6f4..1a057b9 100644
--- a/mpeg/psi.h
+++ b/mpeg/psi.h
@@ -479,6 +479,44 @@ static inline void desc0a_print(uint8_t *p_desc, f_print pf_print,
 }
 
 /*****************************************************************************
+ * Descriptor 0x0B: System clock descriptor
+ *****************************************************************************/
+#define DESC0B_HEADER_SIZE      (DESC_HEADER_SIZE + 2)
+
+static inline void desc0b_init(uint8_t *p_desc)
+{
+    desc_set_tag(p_desc, 0x0b);
+    desc_set_length(p_desc, DESC0B_HEADER_SIZE - DESC_HEADER_SIZE);
+}
+
+static inline bool desc0b_validate(const uint8_t *p_desc)
+{
+    return desc_get_length(p_desc) >= DESC0B_HEADER_SIZE - DESC_HEADER_SIZE;
+}
+
+static inline void desc0b_print(const uint8_t *p_desc, f_print pf_print,
+                                void *opaque, print_type_t i_print_type)
+{
+    uint8_t external_clock_reference_indicator = (p_desc[2] & 0x80) == 0x80;
+    uint8_t clock_accuracy_integer = p_desc[2] & 0x3f; // xxx11111
+    uint8_t clock_accuracy_exponent = (p_desc[2] & 0xe0) >> 5; // 111xxxxx
+
+    switch (i_print_type) {
+    case PRINT_XML:
+        pf_print(opaque, "<SYSTEM_CLOCK_DESC external_clock_reference_indicator=\"%u\" clock_accuracy_integer=\"%u\" clock_accuracy_exponent=\"%u\"/>",
+            external_clock_reference_indicator,
+            clock_accuracy_integer,
+            clock_accuracy_exponent);
+        break;
+    default:
+        pf_print(opaque, "    - desc 0b external_clock_reference_indicator=%u clock_accuracy_integer=%u clock_accuracy_exponent=%u",
+            external_clock_reference_indicator,
+            clock_accuracy_integer,
+            clock_accuracy_exponent);
+    }
+}
+
+/*****************************************************************************
  * Descriptors list
  *****************************************************************************/
 #define DESCS_HEADER_SIZE       2
-- 
1.7.5.1



More information about the dvblast-devel mailing list