From f959a522f1d600fbe62edfb66cb06fc5cd76a9dd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 8 Jan 2012 13:46:20 -0200 Subject: [PATCH] utils/dvb/descriptors.c: add a parser for DVB-C Annex A Signed-off-by: Mauro Carvalho Chehab --- utils/dvb/descriptors.c | 30 ++++++++++++++++++++++++++++++ utils/dvb/libscan.h | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/utils/dvb/descriptors.c b/utils/dvb/descriptors.c index 72243fc..ed1b673 100644 --- a/utils/dvb/descriptors.c +++ b/utils/dvb/descriptors.c @@ -261,6 +261,36 @@ static void parse_NIT_DVBC(struct nit_table *nit_table, const unsigned char *buf, int dlen, int verbose) { + uint32_t **freq = &nit_table->frequency; + static const unsigned modulation[] = { + [0] = QAM_AUTO, + [1] = QAM_16, + [2] = QAM_32, + [3] = QAM_64, + [4] = QAM_128, + [5] = QAM_256, + [6 ...255] = QAM_AUTO /* Reserved for future usage*/ + }; + + *freq = realloc(*freq, 1); + nit_table->frequency_len = 1; + nit_table->frequency[0] = bcd_to_int(&buf[2], 32) * 10; /* KHz */ + + nit_table->fec_outer = dvbc_dvbs_freq_inner[buf[7] & 0x07]; + nit_table->modulation = modulation[buf[8]]; + nit_table->symbol_rate = bcd_to_int(&buf[9], 28) * 100; /* Bauds */ + nit_table->fec_inner = dvbc_dvbs_freq_inner[buf[12] & 0x07]; + + nit_table->delivery_system = SYS_DVBC_ANNEX_A; + + if (verbose) { + printf("DVB-C freq %d, modulation %d, Symbol rate %d\n", + nit_table->frequency[0], + nit_table->modulation, + nit_table->symbol_rate); + printf("fec_inner %d, fec_inner %d\n", + nit_table->fec_inner, nit_table->fec_outer); + } } static void parse_NIT_DVBT(struct nit_table *nit_table, diff --git a/utils/dvb/libscan.h b/utils/dvb/libscan.h index 4e34c13..4700c04 100644 --- a/utils/dvb/libscan.h +++ b/utils/dvb/libscan.h @@ -45,7 +45,7 @@ struct nit_table { /* Network Parameters */ uint32_t delivery_system; uint32_t guard_interval; - uint32_t fec_inner; + uint32_t fec_inner, fec_outer; uint32_t pol; uint32_t modulation; uint32_t rolloff; -- 2.7.4