Commit 0403c639 authored by Christophe Massiot's avatar Christophe Massiot

* mpeg/psi.h: Fix a bug with descriptor 0x05. * mpeg/psi.h, dvb/si.h: Cosmetic...

* mpeg/psi.h: Fix a bug with descriptor 0x05. * mpeg/psi.h, dvb/si.h: Cosmetic changes in print functions. * examples/dvb_print_si.c: New example file to print DVB tables in a TS stream.
parent 088e84d9
...@@ -166,7 +166,7 @@ static inline void desc56_print(uint8_t *p_desc, f_print pf_print, ...@@ -166,7 +166,7 @@ static inline void desc56_print(uint8_t *p_desc, f_print pf_print,
while ((p_desc_n = desc56_get_language(p_desc, j)) != NULL) { while ((p_desc_n = desc56_get_language(p_desc, j)) != NULL) {
j++; j++;
pf_print(opaque, pf_print(opaque,
" - desc 56 telx language=%3.3s type=%hhu mag=%hhu page=%hhu", " - desc 56 telx language=%3.3s type=0x%hhx mag=%hhu page=%hhu",
(const char *)desc56n_get_code(p_desc_n), (const char *)desc56n_get_code(p_desc_n),
desc56n_get_teletexttype(p_desc_n), desc56n_get_teletexttype(p_desc_n),
desc56n_get_teletextmagazine(p_desc_n), desc56n_get_teletextmagazine(p_desc_n),
...@@ -239,7 +239,7 @@ static inline void desc59_print(uint8_t *p_desc, f_print pf_print, ...@@ -239,7 +239,7 @@ static inline void desc59_print(uint8_t *p_desc, f_print pf_print,
while ((p_desc_n = desc59_get_language(p_desc, j)) != NULL) { while ((p_desc_n = desc59_get_language(p_desc, j)) != NULL) {
j++; j++;
pf_print(opaque, pf_print(opaque,
" - desc 59 dvbs language=%3.3s type=%hhu composition=%hu ancillary=%hu", " - desc 59 dvbs language=%3.3s type=0x%hhx composition=%hu ancillary=%hu",
(const char *)desc59n_get_code(p_desc_n), (const char *)desc59n_get_code(p_desc_n),
desc59n_get_subtitlingtype(p_desc_n), desc59n_get_subtitlingtype(p_desc_n),
desc59n_get_compositionpage(p_desc_n), desc59n_get_compositionpage(p_desc_n),
......
# $Id$
CFLAGS = -Wall -O2
LDFLAGS =
OBJ = dvb_print_si
all: $(OBJ)
%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
-rm $(OBJ)
This diff is collapsed.
...@@ -73,7 +73,7 @@ static inline void desc_print(const uint8_t *p_desc, f_print pf_print, ...@@ -73,7 +73,7 @@ static inline void desc_print(const uint8_t *p_desc, f_print pf_print,
static inline void desc05_init(uint8_t *p_desc) static inline void desc05_init(uint8_t *p_desc)
{ {
desc_set_tag(p_desc, 0x05); desc_set_tag(p_desc, 0x05);
desc_set_length(p_desc, DESC05_HEADER_SIZE); desc_set_length(p_desc, DESC05_HEADER_SIZE - DESC_HEADER_SIZE);
} }
static inline void desc05_set_identifier(uint8_t *p_desc, uint8_t p_id[4]) static inline void desc05_set_identifier(uint8_t *p_desc, uint8_t p_id[4])
...@@ -114,7 +114,7 @@ static inline uint16_t desc09_get_pid(const uint8_t *p_desc) ...@@ -114,7 +114,7 @@ static inline uint16_t desc09_get_pid(const uint8_t *p_desc)
static inline void desc09_print(const uint8_t *p_desc, f_print pf_print, static inline void desc09_print(const uint8_t *p_desc, f_print pf_print,
void *opaque) void *opaque)
{ {
pf_print(opaque, " - desc 09 sysid=%hx pid=%hu", pf_print(opaque, " - desc 09 sysid=0x%hx pid=%hu",
desc09_get_sysid(p_desc), desc09_get_pid(p_desc)); desc09_get_sysid(p_desc), desc09_get_pid(p_desc));
} }
...@@ -168,7 +168,7 @@ static inline void desc0a_print(uint8_t *p_desc, f_print pf_print, ...@@ -168,7 +168,7 @@ static inline void desc0a_print(uint8_t *p_desc, f_print pf_print,
while ((p_desc_n = desc0a_get_language(p_desc, j)) != NULL) { while ((p_desc_n = desc0a_get_language(p_desc, j)) != NULL) {
j++; j++;
pf_print(opaque, " - desc 0a language=%3.3s audiotype=%hhu", pf_print(opaque, " - desc 0a language=%3.3s audiotype=0x%hhx",
(const char *)desc0an_get_code(p_desc_n), (const char *)desc0an_get_code(p_desc_n),
desc0an_get_audiotype(p_desc_n)); desc0an_get_audiotype(p_desc_n));
} }
...@@ -648,6 +648,8 @@ static inline void psi_table_copy(uint8_t **pp_dest, uint8_t **pp_src) ...@@ -648,6 +648,8 @@ static inline void psi_table_copy(uint8_t **pp_dest, uint8_t **pp_src)
psi_get_tableid(pp_sections[0]) psi_get_tableid(pp_sections[0])
#define psi_table_get_version(pp_sections) \ #define psi_table_get_version(pp_sections) \
psi_get_version(pp_sections[0]) psi_get_version(pp_sections[0])
#define psi_table_get_current(pp_sections) \
psi_get_current(pp_sections[0])
#define psi_table_get_lastsection(pp_sections) \ #define psi_table_get_lastsection(pp_sections) \
psi_get_lastsection(pp_sections[0]) psi_get_lastsection(pp_sections[0])
#define psi_table_get_tableidext(pp_sections) \ #define psi_table_get_tableidext(pp_sections) \
...@@ -830,9 +832,10 @@ static inline void pat_table_print(uint8_t **pp_sections, f_print pf_print, ...@@ -830,9 +832,10 @@ static inline void pat_table_print(uint8_t **pp_sections, f_print pf_print,
uint8_t i_last_section = psi_table_get_lastsection(pp_sections); uint8_t i_last_section = psi_table_get_lastsection(pp_sections);
uint8_t i; uint8_t i;
pf_print(opaque, "new PAT tsid=%hu version=%hhu", pf_print(opaque, "new PAT tsid=%hu version=%hhu%s",
psi_table_get_tableidext(pp_sections), psi_table_get_tableidext(pp_sections),
psi_table_get_version(pp_sections)); psi_table_get_version(pp_sections),
!psi_table_get_current(pp_sections) ? " (next)" : "");
for (i = 0; i <= i_last_section; i++) { for (i = 0; i <= i_last_section; i++) {
uint8_t *p_section = psi_table_get_section(pp_sections, i); uint8_t *p_section = psi_table_get_section(pp_sections, i);
...@@ -840,10 +843,14 @@ static inline void pat_table_print(uint8_t **pp_sections, f_print pf_print, ...@@ -840,10 +843,14 @@ static inline void pat_table_print(uint8_t **pp_sections, f_print pf_print,
int j = 0; int j = 0;
while ((p_program = pat_get_program(p_section, j)) != NULL) { while ((p_program = pat_get_program(p_section, j)) != NULL) {
uint16_t i_program = patn_get_program(p_program);
uint16_t i_pid = patn_get_pid(p_program);
j++; j++;
if (i_program == 0)
pf_print(opaque, " * NIT pid=%hu", i_pid);
else
pf_print(opaque, " * program number=%hu pid=%hu", pf_print(opaque, " * program number=%hu pid=%hu",
patn_get_program(p_program), i_program, i_pid);
patn_get_pid(p_program));
} }
} }
......
...@@ -81,8 +81,9 @@ static inline void pmt_print(uint8_t *p_pmt, f_print pf_print, void *opaque) ...@@ -81,8 +81,9 @@ static inline void pmt_print(uint8_t *p_pmt, f_print pf_print, void *opaque)
uint8_t *p_es; uint8_t *p_es;
uint8_t j = 0; uint8_t j = 0;
pf_print(opaque, "new PMT program=%hu version=%hhu pcrpid=%hu", pf_print(opaque, "new PMT program=%hu version=%hhu%s pcrpid=%hu",
pmt_get_program(p_pmt), psi_get_version(p_pmt), pmt_get_program(p_pmt), psi_get_version(p_pmt),
!psi_get_current(p_pmt) ? " (next)" : "",
pmt_get_pcrpid(p_pmt)); pmt_get_pcrpid(p_pmt));
descs_print(pmt_get_descs(p_pmt), pf_print, opaque); descs_print(pmt_get_descs(p_pmt), pf_print, opaque);
...@@ -105,17 +106,18 @@ static inline void nit_table_print(uint8_t **pp_sections, f_print pf_print, ...@@ -105,17 +106,18 @@ static inline void nit_table_print(uint8_t **pp_sections, f_print pf_print,
uint8_t i_last_section = psi_table_get_lastsection(pp_sections); uint8_t i_last_section = psi_table_get_lastsection(pp_sections);
uint8_t i; uint8_t i;
pf_print(opaque, "new NIT %s networkid=%hu version=%hhu", pf_print(opaque, "new NIT %s networkid=%hu version=%hhu%s",
psi_table_get_tableid(pp_sections) == NIT_TABLE_ID_ACTUAL ? psi_table_get_tableid(pp_sections) == NIT_TABLE_ID_ACTUAL ?
"actual" : "other", "actual" : "other",
psi_table_get_tableidext(pp_sections), psi_table_get_tableidext(pp_sections),
psi_table_get_version(pp_sections)); psi_table_get_version(pp_sections),
!psi_table_get_current(pp_sections) ? " (next)" : "");
descs_print(nit_get_descs(psi_table_get_section(pp_sections, 0)), descs_print(nit_get_descs(psi_table_get_section(pp_sections, 0)),
pf_print, opaque); pf_print, opaque);
for (i = 0; i <= i_last_section; i++) { for (i = 0; i <= i_last_section; i++) {
uint8_t *p_section = psi_table_get_section(pp_sections, i); uint8_t *p_section = psi_table_get_section(pp_sections, i);
const uint8_t *p_ts; uint8_t *p_ts;
int j = 0; int j = 0;
while ((p_ts = nit_get_ts(p_section, j)) != NULL) { while ((p_ts = nit_get_ts(p_section, j)) != NULL) {
...@@ -138,16 +140,17 @@ static inline void sdt_table_print(uint8_t **pp_sections, f_print pf_print, ...@@ -138,16 +140,17 @@ static inline void sdt_table_print(uint8_t **pp_sections, f_print pf_print,
uint8_t i_last_section = psi_table_get_lastsection(pp_sections); uint8_t i_last_section = psi_table_get_lastsection(pp_sections);
uint8_t i; uint8_t i;
pf_print(opaque, "new SDT %s tsid=%hu version=%hhu onid=%hu", pf_print(opaque, "new SDT %s tsid=%hu version=%hhu%s onid=%hu",
psi_table_get_tableid(pp_sections) == SDT_TABLE_ID_ACTUAL ? psi_table_get_tableid(pp_sections) == SDT_TABLE_ID_ACTUAL ?
"actual" : "other", "actual" : "other",
psi_table_get_tableidext(pp_sections), psi_table_get_tableidext(pp_sections),
psi_table_get_version(pp_sections), psi_table_get_version(pp_sections),
!psi_table_get_current(pp_sections) ? " (next)" : "",
sdt_get_onid(psi_table_get_section(pp_sections, 0))); sdt_get_onid(psi_table_get_section(pp_sections, 0)));
for (i = 0; i <= i_last_section; i++) { for (i = 0; i <= i_last_section; i++) {
uint8_t *p_section = psi_table_get_section(pp_sections, i); uint8_t *p_section = psi_table_get_section(pp_sections, i);
const uint8_t *p_service; uint8_t *p_service;
int j = 0; int j = 0;
while ((p_service = sdt_get_service(p_section, j)) != NULL) { while ((p_service = sdt_get_service(p_section, j)) != NULL) {
......
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