Commit 486f8a3c authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski

mpeg/psi/descriptors: Show length and value for unknown descs in TEXT printer.

Inspired by XML descriptor printer that already does the same.
parent f1982b08
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <bitstream/common.h> #include <bitstream/common.h>
#include <stdio.h> /* sprintf */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
...@@ -115,12 +117,22 @@ static inline void desc_print_error(const uint8_t *p_desc, f_print pf_print, ...@@ -115,12 +117,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, static inline void desc_print(const uint8_t *p_desc, f_print pf_print,
void *opaque, print_type_t i_print_type) void *opaque, print_type_t i_print_type)
{ {
uint8_t i, i_length;
char psz_value[2 * 255 + 1];
switch (i_print_type) { switch (i_print_type) {
case PRINT_XML: case PRINT_XML:
pf_print(opaque, "<UNKNOWN_DESC />"); pf_print(opaque, "<UNKNOWN_DESC />");
break; break;
default: 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, "%02x", p_desc[2 + i]);
psz_value[2 * i] = '\0';
pf_print(opaque, " - desc %02x unknown length=%u value=%s",
desc_get_tag(p_desc), i_length, psz_value);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment