[dvblast-devel] [PATCH-bitstream 2/2] mpeg/psi: Add length and value to unknown descriptors printed as text.

Georgi Chorbadzhiyski gf at unixsol.org
Sat Sep 10 22:07:51 CEST 2011


Inspired by XML descriptor printer that already does the same.
---
 mpeg/psi.h |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/mpeg/psi.h b/mpeg/psi.h
index eda3c45..e980662 100644
--- a/mpeg/psi.h
+++ b/mpeg/psi.h
@@ -104,12 +104,22 @@ static inline void desc_print_error(const uint8_t *p_desc, f_print pf_print,
 static inline void desc_print(const uint8_t *p_desc, f_print pf_print,
                               void *opaque, print_type_t i_print_type)
 {
+    uint8_t i, i_length;
+    char psz_value[2 * 255 + 1];
+
     switch (i_print_type) {
     case PRINT_XML:
         pf_print(opaque, "<UNKNOWN_DESC />");
         break;
     default:
-        pf_print(opaque, "    - desc %2.2hhx unknown", desc_get_tag(p_desc));
+        i_length = desc_get_length(p_desc);
+
+        for (i = 0; i < i_length; i++)
+            sprintf(psz_value + 2 * i, "%2.2hhx", p_desc[2 + i]);
+        psz_value[2 * i] = '\0';
+
+        pf_print(opaque, "    - desc %2.2hhx unknown length=%u value=%s",
+            desc_get_tag(p_desc), i_length, psz_value);
     }
 }
 
-- 
1.7.5.1



More information about the dvblast-devel mailing list