Commit 9502edb7 authored by Christophe Massiot's avatar Christophe Massiot

* modules/access/dvb: Support frequencies for the C and S satellite bands.

parent 4c535ac8
......@@ -84,19 +84,10 @@ static void Close( vlc_object_t *p_this );
#define PROBE_TEXT N_("Probe DVB card for capabilities")
#define PROBE_LONGTEXT N_("Some DVB cards do not like to be probed for their capabilities.")
#define LNB_LOF1_TEXT N_("Antenna lnb_lof1 (kHz)")
#define LNB_LOF1_LONGTEXT ""
#define LNB_LOF2_TEXT N_("Antenna lnb_lof2 (kHz)")
#define LNB_LOF2_LONGTEXT ""
#define LNB_SLOF_TEXT N_("Antenna lnb_slof (kHz)")
#define LNB_SLOF_LONGTEXT ""
/* Satellite */
#define BUDGET_TEXT N_("Budget mode")
#define BUDGET_LONGTEXT N_("This allows you to stream an entire transponder with a budget card.")
/* Satellite */
#define SATNO_TEXT N_("Satellite number in the Diseqc system")
#define SATNO_LONGTEXT N_("[0=no diseqc, 1-4=satellite number]")
......@@ -116,6 +107,15 @@ static void Close( vlc_object_t *p_this );
#define SRATE_TEXT N_("Transponder symbol rate in kHz")
#define SRATE_LONGTEXT ""
#define LNB_LOF1_TEXT N_("Antenna lnb_lof1 (kHz)")
#define LNB_LOF1_LONGTEXT ""
#define LNB_LOF2_TEXT N_("Antenna lnb_lof2 (kHz)")
#define LNB_LOF2_LONGTEXT ""
#define LNB_SLOF_TEXT N_("Antenna lnb_slof (kHz)")
#define LNB_SLOF_LONGTEXT ""
/* Cable */
#define MODULATION_TEXT N_("Modulation type")
#define MODULATION_LONGTEXT N_("Modulation type for front-end device.")
......@@ -156,15 +156,9 @@ vlc_module_begin();
add_integer( "dvb-inversion", 2, NULL, INVERSION_TEXT, INVERSION_LONGTEXT,
VLC_TRUE );
add_bool( "dvb-probe", 1, NULL, PROBE_TEXT, PROBE_LONGTEXT, VLC_TRUE );
add_integer( "dvb-lnb-lof1", 9750000, NULL, LNB_LOF1_TEXT,
LNB_LOF1_LONGTEXT, VLC_TRUE );
add_integer( "dvb-lnb-lof2", 10600000, NULL, LNB_LOF2_TEXT,
LNB_LOF2_LONGTEXT, VLC_TRUE );
add_integer( "dvb-lnb-slof", 11700000, NULL, LNB_SLOF_TEXT,
LNB_SLOF_LONGTEXT, VLC_TRUE );
/* DVB-S (satellite) */
add_bool( "dvb-budget-mode", 0, NULL, BUDGET_TEXT, BUDGET_LONGTEXT,
VLC_TRUE );
/* DVB-S (satellite) */
add_integer( "dvb-satno", 0, NULL, SATNO_TEXT, SATNO_LONGTEXT,
VLC_TRUE );
add_integer( "dvb-voltage", 13, NULL, VOLTAGE_TEXT, VOLTAGE_LONGTEXT,
......@@ -176,7 +170,13 @@ vlc_module_begin();
add_integer( "dvb-fec", 9, NULL, FEC_TEXT, FEC_LONGTEXT, VLC_TRUE );
add_integer( "dvb-srate", 27500000, NULL, SRATE_TEXT, SRATE_LONGTEXT,
VLC_FALSE );
/* DVB-T (terrestrial) */
add_integer( "dvb-lnb-lof1", 0, NULL, LNB_LOF1_TEXT,
LNB_LOF1_LONGTEXT, VLC_TRUE );
add_integer( "dvb-lnb-lof2", 0, NULL, LNB_LOF2_TEXT,
LNB_LOF2_LONGTEXT, VLC_TRUE );
add_integer( "dvb-lnb-slof", 0, NULL, LNB_SLOF_TEXT,
LNB_SLOF_LONGTEXT, VLC_TRUE );
/* DVB-C (cable) */
add_integer( "dvb-modulation", 0, NULL, MODULATION_TEXT,
MODULATION_LONGTEXT, VLC_TRUE );
/* DVB-T (terrestrial) */
......@@ -554,18 +554,18 @@ static void VarInit( access_t *p_access )
var_Create( p_access, "dvb-frequency", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-inversion", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-probe", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-lof1", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-lof2", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-slof", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-budget-mode", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* */
var_Create( p_access, "dvb-budget-mode", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-satno", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-voltage", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-high-voltage", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-tone", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-fec", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-srate", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-lof1", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-lof2", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_access, "dvb-lnb-slof", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
/* */
var_Create( p_access, "dvb-modulation", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
......@@ -620,17 +620,17 @@ static int ParseMRL( access_t *p_access )
else GET_OPTION_INT("frequency")
else GET_OPTION_INT("inversion")
else GET_OPTION_BOOL("probe")
else GET_OPTION_INT("lnb-lof1")
else GET_OPTION_INT("lnb-lof2")
else GET_OPTION_INT("lnb-slof")
else GET_OPTION_BOOL("budget-mode")
else GET_OPTION_INT("voltage")
else GET_OPTION_BOOL("high-voltage")
else GET_OPTION_INT("tone")
else GET_OPTION_INT("satno")
else GET_OPTION_INT("fec")
else GET_OPTION_INT("srate")
else GET_OPTION_INT("lnb-lof1")
else GET_OPTION_INT("lnb-lof2")
else GET_OPTION_INT("lnb-slof")
else GET_OPTION_INT("modulation")
......
......@@ -690,19 +690,77 @@ static int FrontendSetQPSK( access_t *p_access )
struct dvb_frontend_parameters fep;
int i_ret;
vlc_value_t val;
int i_frequency, i_lnb_slof;
int i_frequency, i_lnb_slof, i_lnb_lof1, i_lnb_lof2 = 0;
/* Prepare the fep structure */
var_Get( p_access, "dvb-frequency", &val );
i_frequency = val.i_int;
var_Get( p_access, "dvb-lnb-slof", &val );
i_lnb_slof = val.i_int;
if( i_frequency >= i_lnb_slof )
var_Get( p_access, "dvb-lnb-lof1", &val );
if ( val.i_int == 0 )
{
/* Automatic mode. */
if ( i_frequency >= 2500000 && i_frequency <= 2700000 )
{
msg_Dbg( p_access, "frequency %d is in S-band", i_frequency );
i_lnb_lof1 = 3650000;
i_lnb_slof = 0;
}
else if ( i_frequency >= 3400000 && i_frequency <= 4200000 )
{
msg_Dbg( p_access, "frequency %d is in C-band (lower)",
i_frequency );
i_lnb_lof1 = 5150000;
i_lnb_slof = 0;
}
else if ( i_frequency >= 4500000 && i_frequency <= 4800000 )
{
msg_Dbg( p_access, "frequency %d is in C-band (higher)",
i_frequency );
i_lnb_lof1 = 5950000;
i_lnb_slof = 0;
}
else if ( i_frequency >= 10700000 && i_frequency <= 13250000 )
{
msg_Dbg( p_access, "frequency %d is in Ku-band",
i_frequency );
i_lnb_lof1 = 9750000;
i_lnb_lof2 = 10600000;
i_lnb_slof = 11700000;
}
else
{
msg_Err( p_access, "frequency %d is out of any known band",
i_frequency );
msg_Err( p_access, "specify dvb-lnb-lof1 manually for the local "
"oscillator frequency" );
return VLC_EGENERIC;
}
val.i_int = i_lnb_lof1;
var_Set( p_access, "dvb-lnb-lof1", val );
val.i_int = i_lnb_lof2;
var_Set( p_access, "dvb-lnb-lof2", val );
val.i_int = i_lnb_slof;
var_Set( p_access, "dvb-lnb-slof", val );
}
else
{
i_lnb_lof1 = val.i_int;
var_Get( p_access, "dvb-lnb-lof2", &val );
i_lnb_lof2 = val.i_int;
var_Get( p_access, "dvb-lnb-slof", &val );
i_lnb_slof = val.i_int;
}
if( i_lnb_slof && i_frequency >= i_lnb_slof )
{
i_frequency -= i_lnb_lof2;
}
else
var_Get( p_access, "dvb-lnb-lof1", &val );
fep.frequency = i_frequency - val.i_int;
{
i_frequency -= i_lnb_lof1;
}
fep.frequency = i_frequency >= 0 ? i_frequency : -i_frequency;
fep.inversion = DecodeInversion( p_access );
......@@ -1157,8 +1215,8 @@ int E_(CAMOpen)( access_t *p_access )
msg_Dbg( p_access, "Opening device %s", ca );
if( (p_sys->i_ca_handle = open(ca, O_RDWR | O_NONBLOCK)) < 0 )
{
msg_Err( p_access, "CAMInit: opening device failed (%s)",
strerror(errno) );
msg_Warn( p_access, "CAMInit: opening CAM device failed (%s)",
strerror(errno) );
p_sys->i_ca_handle = 0;
return VLC_EGENERIC;
}
......
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