From: Mauro Carvalho Chehab Date: Sun, 8 Jan 2012 23:04:50 +0000 (-0200) Subject: utils/dvb: Add frequency_list_descriptor to the parser X-Git-Tag: v4l-utils-0.9.0-test1~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d28629bd8c8743fdceb8de8a4b66a5e9d6ca77ac;p=platform%2Fupstream%2Fv4l-utils.git utils/dvb: Add frequency_list_descriptor to the parser Signed-off-by: Mauro Carvalho Chehab --- diff --git a/utils/dvb/descriptors.c b/utils/dvb/descriptors.c index f6d14d8..cc56505 100644 --- a/utils/dvb/descriptors.c +++ b/utils/dvb/descriptors.c @@ -166,7 +166,7 @@ static void parse_NIT_ISDBT(struct nit_table *nit_table, [3] = GUARD_INTERVAL_1_4, }; unsigned tmp = buf[3] >> 4 & 0x3; - int i, n = 0; + int i; nit_table->delivery_system = SYS_ISDBT; nit_table->area_code = (buf[3] & 0x0f) << 8 | buf[2]; @@ -175,13 +175,15 @@ static void parse_NIT_ISDBT(struct nit_table *nit_table, printf("Area code: %d, guard interval: %d, mode: %d\n", nit_table->area_code, tmp, buf[3] >> 6); - for (i = dlen + 3; i < dlen; i += 2, n++) { + buf += 4; + for (i = 4; i < dlen; i += 2) { *freq = realloc(*freq, (*nfreq + 1)); - nit_table->frequency[n] = buf[i + 1] << 8 | buf[i]; + nit_table->frequency[*nfreq] = buf[i + 1] << 8 | buf[i]; ; if (verbose) - printf("Frequency %d\n", nit_table->frequency[n]); + printf("Frequency %d\n", nit_table->frequency[*nfreq]); (*nfreq)++; + buf += 2; } } @@ -371,6 +373,27 @@ static void parse_NIT_DVBT(struct nit_table *nit_table, } } +static void parse_freq_list(struct nit_table *nit_table, + const unsigned char *buf, int dlen, + int verbose) +{ + int i; + uint32_t **freq = &nit_table->other_frequency; + unsigned *nfreq = &nit_table->frequency_len; + + buf += 3; + for (i = 3; i < dlen; i += 4) { + *freq = realloc(*freq, (*nfreq + 1)); + nit_table->frequency[*nfreq] = (buf[0] << 24) | + (buf[1] << 16) | + (buf[2] << 8) | buf[3]; + if (verbose) + printf("Frequency %d\n", nit_table->frequency[*nfreq]); + (*nfreq)++; + buf += 4; + } +} + void parse_descriptor(enum dvb_tables type, struct dvb_descriptors *dvb_desc, const unsigned char *buf, int len) @@ -530,6 +553,16 @@ void parse_descriptor(enum dvb_tables type, if (dvb_desc->verbose) printf("Virtual channel = %d\n", buf[2]); break; + + case frequency_list_descriptor: + if (type != NIT) { + err = 1; + break; + } + parse_freq_list(&dvb_desc->nit_table, buf, dlen, + dvb_desc->verbose); + break; + case service_descriptor: { if (type != SDT) { err = 1; @@ -607,7 +640,6 @@ void parse_descriptor(enum dvb_tables type, case private_data_specifier_descriptor: case service_move_descriptor: case short_smoothing_buffer_descriptor: - case frequency_list_descriptor: case partial_transport_stream_descriptor: case data_broadcast_descriptor: case scrambling_descriptor: diff --git a/utils/dvb/libscan.h b/utils/dvb/libscan.h index b215837..409c6f7 100644 --- a/utils/dvb/libscan.h +++ b/utils/dvb/libscan.h @@ -66,6 +66,9 @@ struct nit_table { uint32_t *frequency; unsigned frequency_len; + uint32_t *other_frequency; + unsigned other_frequency_len; + struct lcn_table *lcn; unsigned lcn_len; };