From 8c242b0834edbf53b92d04e3f6a08f2814c16c31 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 24 Nov 2013 22:43:39 -0200 Subject: [PATCH] libdvbv5: add support for DVB-S/S2 at NIT parser Add support on dvb-scan for DVB-S/S2 transponder parsing. Signed-off-by: Mauro Carvalho Chehab --- lib/include/descriptors/desc_sat.h | 5 +++++ lib/libdvbv5/descriptors/desc_sat.c | 36 ++++++++++++++++++++++++++++++++++++ lib/libdvbv5/dvb-scan.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/lib/include/descriptors/desc_sat.h b/lib/include/descriptors/desc_sat.h index 5e0b3cb..bb55319 100644 --- a/lib/include/descriptors/desc_sat.h +++ b/lib/include/descriptors/desc_sat.h @@ -55,6 +55,11 @@ extern "C" { void dvb_desc_sat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc); void dvb_desc_sat_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc); +extern const unsigned dvbs_dvbc_dvbs_freq_inner[]; +extern const unsigned dvbs_polarization[]; +extern const unsigned dvbs_rolloff[]; +extern const unsigned dvbs_modulation[]; + #ifdef __cplusplus } #endif diff --git a/lib/libdvbv5/descriptors/desc_sat.c b/lib/libdvbv5/descriptors/desc_sat.c index 557d531..d45d130 100644 --- a/lib/libdvbv5/descriptors/desc_sat.c +++ b/lib/libdvbv5/descriptors/desc_sat.c @@ -65,3 +65,39 @@ void dvb_desc_sat_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *de dvb_log("| orbit %.1f %c", (float) sat->orbit / 10.0, sat->west_east ? 'E' : 'W'); } +const unsigned dvbs_dvbc_dvbs_freq_inner[] = { + [0] = FEC_AUTO, + [1] = FEC_1_2, + [2] = FEC_2_3, + [3] = FEC_3_4, + [4] = FEC_5_6, + [5] = FEC_7_8, + [6] = FEC_8_9, + [7] = FEC_3_5, + [8] = FEC_4_5, + [9] = FEC_9_10, + [10 ...14] = FEC_AUTO, /* Currently, undefined */ + [15] = FEC_NONE, +}; + +const unsigned dvbs_polarization[] = { + [0] = POLARIZATION_H, + [1] = POLARIZATION_V, + [2] = POLARIZATION_L, + [3] = POLARIZATION_R +}; + +const unsigned dvbs_rolloff[] = { + [0] = ROLLOFF_35, + [1] = ROLLOFF_25, + [2] = ROLLOFF_20, + [3] = ROLLOFF_AUTO, /* Reserved */ +}; + +const unsigned dvbs_modulation[] = { + [0] = QAM_AUTO, + [1] = QPSK, + [2] = PSK_8, + [3] = QAM_16 +}; + diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index bcd54b1..38c8282 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -714,6 +714,37 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms, } } return; + case SYS_DVBS: + case SYS_DVBS2: + dvb_nit_transport_foreach(tran, dvb_scan_handler->nit) { + dvb_desc_find(struct dvb_desc_sat, d, + tran, satellite_delivery_system_descriptor) { + new = dvb_scan_add_entry(parms, + first_entry, entry, + d->frequency, + shift, pol); + if (!new) + return; + + /* Set NIT DVB-S props for the transponder */ + + store_entry_prop(entry, DTV_MODULATION, + dvbs_modulation[d->modulation_system]); + store_entry_prop(entry, DTV_POLARIZATION, + dvbs_polarization[d->polarization]); + store_entry_prop(entry, DTV_SYMBOL_RATE, + d->symbol_rate); + store_entry_prop(entry, DTV_INNER_FEC, + dvbs_dvbc_dvbs_freq_inner[d->fec]); + store_entry_prop(entry, DTV_ROLLOFF, + dvbs_rolloff[d->roll_off]); + if (d->roll_off != 0) + store_entry_prop(entry, DTV_DELIVERY_SYSTEM, + SYS_DVBS2); + + } + } + return; default: dvb_log("Transponders detection not implemented for this standard yet."); return; -- 2.7.4