Commit 14b1e955 authored by Ilkka Ollakka's avatar Ilkka Ollakka

dvb: initial support on scanning symbolrates on dvb-c and set default symbolrate to 0

I think this should be optimised to rotate symbolrates only
when we get signal but were unable to tune channels.

This commit also causes that eta shows even more strange
times until it gets lock on some channel with correct
modulation/symbolrate.
parent b49f0555
...@@ -214,7 +214,7 @@ vlc_module_begin () ...@@ -214,7 +214,7 @@ vlc_module_begin ()
add_integer( "dvb-tone", -1, TONE_TEXT, TONE_LONGTEXT, add_integer( "dvb-tone", -1, TONE_TEXT, TONE_LONGTEXT,
true ) true )
add_integer( "dvb-fec", 9, FEC_TEXT, FEC_LONGTEXT, true ) add_integer( "dvb-fec", 9, FEC_TEXT, FEC_LONGTEXT, true )
add_integer( "dvb-srate", 27500000, SRATE_TEXT, SRATE_LONGTEXT, add_integer( "dvb-srate", 0, SRATE_TEXT, SRATE_LONGTEXT,
false ) false )
add_integer( "dvb-lnb-lof1", 0, LNB_LOF1_TEXT, add_integer( "dvb-lnb-lof1", 0, LNB_LOF1_TEXT,
LNB_LOF1_LONGTEXT, true ) LNB_LOF1_LONGTEXT, true )
...@@ -586,6 +586,9 @@ static block_t *BlockScan( access_t *p_access ) ...@@ -586,6 +586,9 @@ static block_t *BlockScan( access_t *p_access )
if ( cfg.i_modulation ) if ( cfg.i_modulation )
var_SetInteger( p_access, "dvb-modulation", cfg.i_modulation ); var_SetInteger( p_access, "dvb-modulation", cfg.i_modulation );
if ( cfg.i_symbolrate )
var_SetInteger( p_access, "dvb-srate", cfg.i_symbolrate );
/* Setting frontend parameters for tuning the hardware */ /* Setting frontend parameters for tuning the hardware */
if( FrontendSet( p_access ) < 0 ) if( FrontendSet( p_access ) < 0 )
{ {
......
...@@ -435,6 +435,12 @@ static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan ) ...@@ -435,6 +435,12 @@ static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan )
p_scan->i_modulation = 0; p_scan->i_modulation = 0;
} }
/* if user supplies symbolrate, don't scan those */
if( var_GetInteger( p_access, "dvb-srate" ) )
p_scan->b_symbolrate_set = true;
else
p_scan->b_symbolrate_set = false;
/* */ /* */
p_scan->bandwidth.i_min = 6; p_scan->bandwidth.i_min = 6;
p_scan->bandwidth.i_max = 8; p_scan->bandwidth.i_max = 8;
......
...@@ -555,22 +555,49 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -555,22 +555,49 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
} }
if( i_service == 0 && if( i_service == 0 &&
p_scan->parameter.type == SCAN_DVB_C && p_scan->parameter.type == SCAN_DVB_C )
!p_scan->parameter.b_modulation_set ) {
bool b_rotate=true;
if( !p_scan->parameter.b_modulation_set )
{ {
p_scan->parameter.i_modulation = (p_scan->parameter.i_modulation << 1 ) % 512; p_scan->parameter.i_modulation = (p_scan->parameter.i_modulation << 1 ) % 512;
/* if we iterated all modulations, move on */ /* if we iterated all modulations, move on */
if( !p_scan->parameter.i_modulation ) if( !p_scan->parameter.i_modulation )
{ {
p_scan->parameter.i_modulation = 16; p_scan->parameter.i_modulation = 16;
p_scan->i_index++; } else {
b_rotate=false;
} }
msg_Dbg( p_scan->p_obj, "modulation %d ", p_scan->parameter.i_modulation); msg_Dbg( p_scan->p_obj, "modulation %d ", p_scan->parameter.i_modulation);
}
if( !p_scan->parameter.b_symbolrate_set )
{
/* symbol rates from dvb-tools dvb-c files */
static const unsigned short symbolrates[] = {
6900, 6875, 6950, 7000, 3450, 6111,
6428, 6952, 5900, 5000 };
enum { num_symbols = (sizeof(symbolrates)/sizeof(*symbolrates)) };
/* if we rotated modulations, rotate symbolrate */
if( b_rotate )
p_scan->parameter.i_symbolrate = (++p_scan->parameter.i_symbolrate % num_symbols );
p_cfg->i_symbolrate = 1000 * (symbolrates[ p_scan->parameter.i_symbolrate ] );
msg_Dbg( p_scan->p_obj, "symbolrate %d", p_cfg->i_symbolrate );
if( p_scan->parameter.i_symbolrate )
b_rotate=false;
}
if( b_rotate )
p_scan->i_index++;
} else { } else {
p_scan->i_index++; p_scan->i_index++;
} }
if( p_scan->parameter.type == SCAN_DVB_C ) if( p_scan->parameter.type == SCAN_DVB_C )
{
p_cfg->i_modulation = p_scan->parameter.i_modulation; p_cfg->i_modulation = p_scan->parameter.i_modulation;
if( !p_cfg->i_symbolrate )
p_cfg->i_symbolrate = var_GetInteger( p_scan->p_obj, "dvb-srate" );
}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1038,7 +1065,7 @@ block_t *scan_GetM3U( scan_t *p_scan ) ...@@ -1038,7 +1065,7 @@ block_t *scan_GetM3U( scan_t *p_scan )
char *psz; char *psz;
if( asprintf( &psz, "#EXTINF:,,%s\n" if( asprintf( &psz, "#EXTINF:,,%s\n"
"#EXTVLCOPT:program=%d\n" "#EXTVLCOPT:program=%d\n"
"dvb://frequency=%d:bandwidth=%d:voltage=%d:fec=%d:modulation=%d\n" "dvb://frequency=%d:bandwidth=%d:voltage=%d:fec=%d:modulation=%d:srate=%d\n"
"\n", "\n",
s->psz_name && * s->psz_name ? s->psz_name : "Unknown", s->psz_name && * s->psz_name ? s->psz_name : "Unknown",
s->i_program, s->i_program,
...@@ -1046,7 +1073,8 @@ block_t *scan_GetM3U( scan_t *p_scan ) ...@@ -1046,7 +1073,8 @@ block_t *scan_GetM3U( scan_t *p_scan )
s->cfg.i_bandwidth, s->cfg.i_bandwidth,
s->cfg.c_polarization == 'H' ? 18 : 13, s->cfg.c_polarization == 'H' ? 18 : 13,
s->cfg.i_fec, s->cfg.i_fec,
s->cfg.i_modulation ) < 0 ) s->cfg.i_modulation,
s->cfg.i_symbolrate ) < 0 )
psz = NULL; psz = NULL;
if( psz ) if( psz )
{ {
......
...@@ -44,8 +44,10 @@ typedef struct scan_parameter_t ...@@ -44,8 +44,10 @@ typedef struct scan_parameter_t
bool b_use_nit; bool b_use_nit;
bool b_free_only; bool b_free_only;
bool b_modulation_set; bool b_modulation_set;
bool b_symbolrate_set;
int i_modulation; int i_modulation;
int i_symbolrate;
struct struct
{ {
int i_min; int i_min;
...@@ -85,6 +87,7 @@ typedef struct ...@@ -85,6 +87,7 @@ typedef struct
}; };
int i_fec; int i_fec;
int i_modulation; int i_modulation;
int i_symbolrate;
char c_polarization; char c_polarization;
} scan_configuration_t; } scan_configuration_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