From 49212a2ead9c9dd68d484891982ac3276abef68b Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Tue, 8 Oct 2013 17:27:28 +0100 Subject: [PATCH] mpegts: add new pilot option and fix defaults for DVB-S I have kept the AUTO options, but have magically translated them for DVB-S under the hood. --- src/input/mpegts/dvb.h | 3 ++ src/input/mpegts/dvb_psi.c | 1 + src/input/mpegts/dvb_support.c | 7 ++++ src/input/mpegts/linuxdvb/linuxdvb_frontend.c | 10 ++++-- src/input/mpegts/linuxdvb/linuxdvb_mux.c | 35 +++++++++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/input/mpegts/dvb.h b/src/input/mpegts/dvb.h index 00d2cdf5..cbe2e183 100644 --- a/src/input/mpegts/dvb.h +++ b/src/input/mpegts/dvb.h @@ -215,6 +215,7 @@ typedef struct dvb_mux_conf fe_modulation_t dmc_fe_modulation; fe_delivery_system_t dmc_fe_delsys; fe_rolloff_t dmc_fe_rolloff; + fe_pilot_t dmc_fe_pilot; #endif // For scan file configurations @@ -238,6 +239,7 @@ const char *dvb_guard2str ( int guard ); const char *dvb_hier2str ( int hier ); const char *dvb_pol2str ( int pol ); const char *dvb_type2str ( int type ); +const char *dvb_pilot2str ( int pilot ); #define dvb_feclo2str dvb_fec2str #define dvb_fechi2str dvb_fec2str @@ -251,6 +253,7 @@ int dvb_str2guard ( const char *str ); int dvb_str2hier ( const char *str ); int dvb_str2pol ( const char *str ); int dvb_str2type ( const char *str ); +int dvb_str2pilot ( const char *str ); #define dvb_str2feclo dvb_str2fec #define dvb_str2fechi dvb_str2fec diff --git a/src/input/mpegts/dvb_psi.c b/src/input/mpegts/dvb_psi.c index 9abbf3f5..f1170fe0 100644 --- a/src/input/mpegts/dvb_psi.c +++ b/src/input/mpegts/dvb_psi.c @@ -113,6 +113,7 @@ dvb_desc_sat_del } memset(&dmc, 0, sizeof(dmc)); + dmc.dmc_fe_pilot = PILOT_AUTO; dmc.dmc_fe_params.inversion = INVERSION_AUTO; dmc.dmc_fe_params.frequency = frequency; dmc.dmc_fe_orbital_pos = bcdtoint(ptr[4]) * 100 + bcdtoint(ptr[5]); diff --git a/src/input/mpegts/dvb_support.c b/src/input/mpegts/dvb_support.c index 3e03b5c5..e199c862 100644 --- a/src/input/mpegts/dvb_support.c +++ b/src/input/mpegts/dvb_support.c @@ -513,6 +513,13 @@ const static struct strtab typetab[] = { {"ATSC", FE_ATSC}, }; dvb_str2val(type); + +const static struct strtab pilottab[] = { + {"AUTO", PILOT_AUTO}, + {"ON", PILOT_ON}, + {"OFF", PILOT_OFF} +}; +dvb_str2val(pilot); #undef dvb_str2val /* diff --git a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c index 79a871ee..41d6574e 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c @@ -707,8 +707,14 @@ linuxdvb_frontend_tune0 } else if (lfe->lfe_info.type == FE_QPSK) { S2CMD(DTV_SYMBOL_RATE, p->u.qpsk.symbol_rate); S2CMD(DTV_INNER_FEC, p->u.qpsk.fec_inner); - S2CMD(DTV_MODULATION, dmc->dmc_fe_modulation); - S2CMD(DTV_ROLLOFF, dmc->dmc_fe_rolloff); + S2CMD(DTV_PILOT, dmc->dmc_fe_pilot); + if (lm->lm_tuning.dmc_fe_delsys == SYS_DVBS) { + S2CMD(DTV_MODULATION, QPSK); + S2CMD(DTV_ROLLOFF, ROLLOFF_35); + } else { + S2CMD(DTV_MODULATION, dmc->dmc_fe_modulation); + S2CMD(DTV_ROLLOFF, dmc->dmc_fe_rolloff); + } /* ATSC */ } else { diff --git a/src/input/mpegts/linuxdvb/linuxdvb_mux.c b/src/input/mpegts/linuxdvb/linuxdvb_mux.c index 7f7522b6..0e1b84ae 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_mux.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_mux.c @@ -369,6 +369,31 @@ linuxdvb_mux_dvbs_class_rolloff_list ( void *o ) htsmsg_add_str(list, NULL, dvb_rolloff2str(ROLLOFF_AUTO)); return list; } + +static const void * +linuxdvb_mux_dvbs_class_pilot_get ( void *o ) +{ + static const char *s; + linuxdvb_mux_t *lm = o; + s = dvb_pilot2str(lm->lm_tuning.dmc_fe_pilot); + return &s; +} +static int +linuxdvb_mux_dvbs_class_pilot_set ( void *o, const void *s ) +{ + linuxdvb_mux_t *lm = o; + lm->lm_tuning.dmc_fe_pilot = dvb_str2pilot(s); + return 1; +} +static htsmsg_t * +linuxdvb_mux_dvbs_class_pilot_list ( void *o ) +{ + htsmsg_t *list = htsmsg_create_list(); + htsmsg_add_str(list, NULL, dvb_pilot2str(PILOT_AUTO)); + htsmsg_add_str(list, NULL, dvb_pilot2str(PILOT_ON)); + htsmsg_add_str(list, NULL, dvb_pilot2str(PILOT_OFF)); + return list; +} #endif #define linuxdvb_mux_dvbs_class_delsys_get linuxdvb_mux_class_delsys_get @@ -430,6 +455,15 @@ const idclass_t linuxdvb_mux_dvbs_class = .list = linuxdvb_mux_dvbs_class_rolloff_list, .def.s = "AUTO" }, + { + .type = PT_STR, + .id = "pilot", + .name = "Pilot", + .opts = PO_ADVANCED, + .set = linuxdvb_mux_dvbs_class_pilot_set, + .get = linuxdvb_mux_dvbs_class_pilot_get, + .list = linuxdvb_mux_dvbs_class_pilot_list, + }, #endif {} } @@ -559,6 +593,7 @@ linuxdvb_mux_create0 /* Defaults */ lm->lm_tuning.dmc_fe_params.inversion = INVERSION_AUTO; + lm->lm_tuning.dmc_fe_pilot = PILOT_AUTO; /* No config */ if (!conf) return lm;