Commit 39cc0ea0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

DTV: DVB-S and DVB-S2 tuning

This is untested. Frequency offsets and diseqc are not done yet.
parent 001cbdee
...@@ -81,8 +81,8 @@ static const char *const modulation_user[] = { N_("Undefined"), ...@@ -81,8 +81,8 @@ static const char *const modulation_user[] = { N_("Undefined"),
#define INVERSION_LONGTEXT N_( \ #define INVERSION_LONGTEXT N_( \
"If the demodulator cannot detect spectral inversion correctly, " \ "If the demodulator cannot detect spectral inversion correctly, " \
"it needs to be configured manually.") "it needs to be configured manually.")
const int inversion_vlc[] = { -1, 0, 1 }; const int auto_off_on_vlc[] = { -1, 0, 1 };
static const char *const auto_off_on[] = { N_("Automatic"), static const char *const auto_off_on_user[] = { N_("Automatic"),
N_("Off"), N_("On") }; N_("Off"), N_("On") };
#define CODE_RATE_TEXT N_("FEC code rate") #define CODE_RATE_TEXT N_("FEC code rate")
...@@ -131,6 +131,15 @@ static const char *const hierarchy_user[] = { N_("Automatic"), ...@@ -131,6 +131,15 @@ static const char *const hierarchy_user[] = { N_("Automatic"),
N_("None"), "1", "2", "4", N_("None"), "1", "2", "4",
}; };
#define PILOT_TEXT N_("Pilot")
#define ROLLOFF_TEXT N_("Roll-off factor")
const int rolloff_vlc[] = { -1,
35, 20, 25,
};
static const char *const rolloff_user[] = { N_("Automatic"),
N_("0.35 (same as DVB-S)"), N_("0.20"), N_("0.25"),
};
static int Open (vlc_object_t *); static int Open (vlc_object_t *);
static void Close (vlc_object_t *); static void Close (vlc_object_t *);
...@@ -165,7 +174,7 @@ vlc_module_begin () ...@@ -165,7 +174,7 @@ vlc_module_begin ()
change_integer_range (0, UINT64_C(0xffffffff) * 1000) change_integer_range (0, UINT64_C(0xffffffff) * 1000)
change_safe () change_safe ()
add_integer ("dvb-inversion", -1, INVERSION_TEXT, INVERSION_LONGTEXT, true) add_integer ("dvb-inversion", -1, INVERSION_TEXT, INVERSION_LONGTEXT, true)
change_integer_list (inversion_vlc, auto_off_on) change_integer_list (auto_off_on_vlc, auto_off_on_user)
change_safe () change_safe ()
set_section (N_("Terrestrial reception parameters"), NULL) set_section (N_("Terrestrial reception parameters"), NULL)
...@@ -229,6 +238,13 @@ vlc_module_begin () ...@@ -229,6 +238,13 @@ vlc_module_begin ()
change_integer_range (0, 0x7fffffff) change_integer_range (0, 0x7fffffff)
change_safe () change_safe ()
#endif #endif
set_section (N_("DVB-S2 parameters"), NULL)
add_integer ("dvb-pilot", -1, PILOT_TEXT, PILOT_TEXT, true)
change_integer_list (auto_off_on_vlc, auto_off_on_user)
change_safe ()
add_integer ("dvb-rolloff", -1, ROLLOFF_TEXT, ROLLOFF_TEXT, true)
change_integer_list (rolloff_vlc, rolloff_user)
change_safe ()
vlc_module_end () vlc_module_end ()
struct access_sys_t struct access_sys_t
...@@ -535,16 +551,30 @@ const delsys_t dvbc = { .setup = dvbc_setup }; ...@@ -535,16 +551,30 @@ const delsys_t dvbc = { .setup = dvbc_setup };
/*** DVB-S ***/ /*** DVB-S ***/
static int dvbs_setup (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq) static int dvbs_setup (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq)
{ {
(void) dev; (void) freq; char *fec = var_InheritCodeRate (obj);
msg_Err (obj, "DVB-S not implemented"); uint32_t srate = var_InheritInteger (obj, "dvb-srate");
return -1;
/* FIXME: adjust frequency (offset) */
int ret = dvb_set_dvbs (dev, freq, srate, fec);
free (fec);
/* TODO: setup SEC */
return ret;
} }
static int dvbs2_setup (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq) static int dvbs2_setup (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq)
{ {
(void) dev; (void) freq; char *mod = var_InheritModulation (obj);
msg_Err (obj, "DVB-S2 not implemented"); char *fec = var_InheritCodeRate (obj);
return -1; uint32_t srate = var_InheritInteger (obj, "dvb-srate");
int pilot = var_InheritInteger (obj, "dvb-pilot");
int rolloff = var_InheritInteger (obj, "dvb-rolloff");
/* FIXME: adjust frequency (offset)? SEC? */
int ret = dvb_set_dvbs2 (dev, freq, mod, srate, fec, pilot, rolloff);
free (fec);
free (mod);
return ret;
} }
const delsys_t dvbs = { .setup = dvbs_setup }; const delsys_t dvbs = { .setup = dvbs_setup };
......
...@@ -536,7 +536,44 @@ int dvb_set_dvbc (dvb_device_t *d, uint32_t freq, const char *modstr, ...@@ -536,7 +536,44 @@ int dvb_set_dvbc (dvb_device_t *d, uint32_t freq, const char *modstr,
/*** DVB-S ***/ /*** DVB-S ***/
/* TODO */ int dvb_set_dvbs (dvb_device_t *d, uint64_t freq,
uint32_t srate, const char *fecstr)
{
unsigned f = freq / 1000;
unsigned fec = dvb_parse_fec (fecstr);
return dvb_set_props (d, 5, DTV_CLEAR, 0, DTV_DELIVERY_SYSTEM, SYS_DVBS,
DTV_FREQUENCY, f, DTV_SYMBOL_RATE, srate,
DTV_INNER_FEC, fec);
}
int dvb_set_dvbs2 (dvb_device_t *d, uint64_t freq, const char *modstr,
uint32_t srate, const char *fecstr, int pilot, int rolloff)
{
unsigned f = freq / 1000;
unsigned mod = dvb_parse_modulation (modstr, QPSK);
unsigned fec = dvb_parse_fec (fecstr);
switch (pilot)
{
case 0: pilot = PILOT_OFF; break;
case 1: pilot = PILOT_ON; break;
default: pilot = PILOT_AUTO; break;
}
switch (rolloff)
{
case 20: rolloff = ROLLOFF_20; break;
case 25: rolloff = ROLLOFF_25; break;
case 35: rolloff = ROLLOFF_35; break;
default: rolloff = PILOT_AUTO; break;
}
return dvb_set_props (d, 8, DTV_CLEAR, 0, DTV_DELIVERY_SYSTEM, SYS_DVBS2,
DTV_FREQUENCY, f, DTV_MODULATION, mod,
DTV_SYMBOL_RATE, srate, DTV_INNER_FEC, fec,
DTV_PILOT, pilot, DTV_ROLLOFF, rolloff);
}
/*** DVB-T ***/ /*** DVB-T ***/
......
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