Commit d22d955d authored by Ilkka Ollakka's avatar Ilkka Ollakka

dvb: refactor dvb-c scanning code out from scan_Next()

parent 2095481e
......@@ -479,6 +479,52 @@ static int ScanDvbTNextFast( scan_t *p_scan, scan_configuration_t *p_cfg, double
static int ScanDvbCNext( scan_t *p_scan, scan_configuration_t *p_cfg, double *pf_pos )
{
bool b_servicefound = false;
for( int i = 0; i < p_scan->i_service; i++ )
{
b_servicefound = (p_scan->pp_service[i]->type != SERVICE_UNKNOWN);
if( b_servicefound )
break;
}
if( !b_servicefound )
{
bool b_rotate=true;
if( !p_scan->parameter.b_modulation_set )
{
p_scan->parameter.i_modulation = (p_scan->parameter.i_modulation << 1 ) % 512;
/* if we iterated all modulations, move on */
if( !p_scan->parameter.i_modulation )
{
p_scan->parameter.i_modulation = 16;
} else {
b_rotate=false;
}
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 )
p_scan->i_index--;
}
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" );
if( p_scan->parameter.b_exhaustive )
return ScanDvbNextExhaustive( p_scan, p_cfg, pf_pos );
else
......@@ -554,50 +600,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
free( psz_text );
}
if( i_service == 0 &&
p_scan->parameter.type == SCAN_DVB_C )
{
bool b_rotate=true;
if( !p_scan->parameter.b_modulation_set )
{
p_scan->parameter.i_modulation = (p_scan->parameter.i_modulation << 1 ) % 512;
/* if we iterated all modulations, move on */
if( !p_scan->parameter.i_modulation )
{
p_scan->parameter.i_modulation = 16;
} else {
b_rotate=false;
}
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 {
p_scan->i_index++;
}
if( p_scan->parameter.type == SCAN_DVB_C )
{
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;
}
......
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