]> git.sesse.net Git - vlc/commitdiff
dvb-c scanning support (not working yet)
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 18 Jan 2009 17:40:21 +0000 (19:40 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 18 Jan 2009 23:55:46 +0000 (01:55 +0200)
modules/access/dvb/linux_dvb.c
modules/access/dvb/scan.c

index 365dc73ba064e8807606669d5d5647b5ee56d552..ae8ed7198f37cffbe374dc0323293645aea45955 100644 (file)
@@ -402,6 +402,28 @@ void FrontendGetStatus( access_t *p_access, frontend_status_t *p_status )
     p_status->b_has_carrier = (p_frontend->i_last_status & FE_HAS_CARRIER) != 0;
     p_status->b_has_lock = (p_frontend->i_last_status & FE_HAS_LOCK) != 0;
 }
+static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan )
+{
+    const frontend_t *p_frontend = p_access->p_sys->p_frontend;
+
+
+    memset( p_scan, 0, sizeof(*p_scan) );
+    p_scan->type = SCAN_DVB_C;
+    p_scan->b_exhaustive = false;
+
+    /* */
+    p_scan->frequency.i_min = p_frontend->info.frequency_min;
+    p_scan->frequency.i_max = p_frontend->info.frequency_max;
+    p_scan->frequency.i_step = p_frontend->info.frequency_stepsize;
+    p_scan->frequency.i_count = (p_scan->frequency.i_max-p_scan->frequency.i_min)/p_scan->frequency.i_step;
+
+    /* */
+    p_scan->bandwidth.i_min  = 6;
+    p_scan->bandwidth.i_max  = 8;
+    p_scan->bandwidth.i_step = 1;
+    p_scan->bandwidth.i_count = 3;
+    return VLC_SUCCESS;
+}
 static int ScanParametersDvbT( access_t *p_access, scan_parameter_t *p_scan )
 {
     const frontend_t *p_frontend = p_access->p_sys->p_frontend;
@@ -431,6 +453,8 @@ int  FrontendGetScanParameter( access_t *p_access, scan_parameter_t *p_scan )
 
     if( p_frontend->info.type == FE_OFDM )  // DVB-T
         return ScanParametersDvbT( p_access, p_scan );
+    else if( p_frontend->info.type == FE_QAM )  // DVB-C
+        return ScanParametersDvbC( p_access, p_scan );
 
     msg_Err( p_access, "Frontend type not supported for scanning" );
     return VLC_EGENERIC;
index 7736e77eb0db9e6641df1c0abef96f3110c138b0..4083837431ab80959fd954491bec9e37d972b00a 100644 (file)
@@ -110,6 +110,15 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
                  p_parameter->bandwidth.i_min, p_parameter->bandwidth.i_max );
         msg_Dbg( p_obj, " - exhaustive mode %s", p_parameter->b_exhaustive ? "on" : "off" );
     }
+    else if( p_parameter->type == SCAN_DVB_C )
+    {
+        msg_Dbg( p_obj, "DVB-C scanning:" );
+        msg_Dbg( p_obj, " - frequency [%d, %d]",
+                 p_parameter->frequency.i_min, p_parameter->frequency.i_max );
+        msg_Dbg( p_obj, " - bandwidth [%d,%d]",
+                 p_parameter->bandwidth.i_min, p_parameter->bandwidth.i_max );
+        msg_Dbg( p_obj, " - exhaustive mode %s", p_parameter->b_exhaustive ? "on" : "off" );
+    }
     else
     {
         return VLC_EGENERIC;
@@ -134,6 +143,33 @@ void scan_Clean( scan_t *p_scan )
     TAB_CLEAN( p_scan->i_service, p_scan->pp_service );
 }
 
+static int ScanDvbCNextFast( scan_t *p_scan, scan_configuration_t *p_cfg, double *pf_pos )
+{
+    msg_Dbg( p_scan->p_obj, "Scan index %d", p_scan->i_index );
+    if( p_scan->i_index <= ( 10 ) )
+    {
+        p_cfg->i_frequency = 100500000 + ( ( p_scan->i_index ) * 700000);
+    } 
+    else if ( p_scan->i_index <= (10 + 9  ) )
+    {
+        p_cfg->i_frequency = 97000000 + ( ( p_scan->i_index - 20 ) * 800000);
+    }
+    else if ( p_scan->i_index <= (38 + 17 ) )
+    {
+        p_cfg->i_frequency = 14250000 + ( ( p_scan->i_index - 33 ) * 700000);
+    }
+    else if ( p_scan->i_index <= (72 + (90-21) ) )
+    {
+        p_cfg->i_frequency = 13800000 + ( ( p_scan->i_index - (72 + 21 ) )  * 800000);
+    }
+    else
+    {
+        return VLC_EGENERIC;
+    }
+    *pf_pos = (double)p_scan->i_index / ( (90-21+22-5+10+9));
+    return VLC_SUCCESS;
+
+}
 
 static int ScanDvbTNextExhaustive( scan_t *p_scan, scan_configuration_t *p_cfg, double *pf_pos )
 {
@@ -222,6 +258,14 @@ 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 )
+{
+    if( p_scan->parameter.b_exhaustive )
+        return ScanDvbTNextExhaustive( p_scan, p_cfg, pf_pos );
+    else
+        return ScanDvbCNextFast( p_scan, p_cfg, pf_pos );
+}
+
 static int ScanDvbTNext( scan_t *p_scan, scan_configuration_t *p_cfg, double *pf_pos )
 {
     if( p_scan->parameter.b_exhaustive )
@@ -244,6 +288,9 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
     case SCAN_DVB_T:
         i_ret = ScanDvbTNext( p_scan, p_cfg, &f_position );
         break;
+    case SCAN_DVB_C:
+        i_ret = ScanDvbCNext( p_scan, p_cfg, &f_position );
+        break;
     default:
         i_ret = VLC_EGENERIC;
         break;