[vlc-commits] dvb: add ability to scann modulation from dvb-c

Ilkka Ollakka git at videolan.org
Wed Mar 9 10:29:38 CET 2011


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Mar  9 11:21:54 2011 +0200| [e70d1f5c18aca253dd61897d5b8d843123e0247d] | committer: Ilkka Ollakka

dvb: add ability to scann modulation from dvb-c

Basicly code loops over all modulation before moving to
next frequency position untill we find some channels.

Side effect is that estimate-timer shows funky values.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e70d1f5c18aca253dd61897d5b8d843123e0247d
---

 modules/access/dvb/access.c    |    3 +++
 modules/access/dvb/linux_dvb.c |   11 +++++++++++
 modules/access/dvb/scan.c      |   28 +++++++++++++++++++++++-----
 modules/access/dvb/scan.h      |    3 +++
 4 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 816eb74..7f32098 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -583,6 +583,9 @@ static block_t *BlockScan( access_t *p_access )
     if ( cfg.c_polarization )
         var_SetInteger( p_access, "dvb-voltage", cfg.c_polarization == 'H' ? 18 : 13 );
 
+    if ( cfg.i_modulation )
+        var_SetInteger( p_access, "dvb-modulation", cfg.i_modulation );
+
     /* Setting frontend parameters for tuning the hardware */
     if( FrontendSet( p_access ) < 0 )
     {
diff --git a/modules/access/dvb/linux_dvb.c b/modules/access/dvb/linux_dvb.c
index 4ba4220..690a4c7 100644
--- a/modules/access/dvb/linux_dvb.c
+++ b/modules/access/dvb/linux_dvb.c
@@ -424,6 +424,17 @@ static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan )
         ? p_frontend->info.frequency_stepsize : 166667;
     p_scan->frequency.i_count = (p_scan->frequency.i_max-p_scan->frequency.i_min)/p_scan->frequency.i_step;
 
+    /* if user supplies modulation or frontend can do auto, dont scan them */
+    if( var_GetInteger( p_access, "dvb-modulation" ) ||
+        p_frontend->info.caps & FE_CAN_QAM_AUTO )
+    {
+        p_scan->b_modulation_set = true;
+    } else {
+        p_scan->b_modulation_set = false;
+        /* our scanning code flips modulation from 16..256 automaticly*/
+        p_scan->i_modulation = 0;
+    }
+
     /* */
     p_scan->bandwidth.i_min  = 6;
     p_scan->bandwidth.i_max  = 8;
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index c0d9b47..3921999 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -165,6 +165,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
         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" );
+        msg_Dbg( p_obj, " - scannin modulations %s", p_parameter->b_modulation_set ? "off" : "on" );
     }
     else if( p_parameter->type == SCAN_DVB_S )
     {
@@ -553,7 +554,23 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
         free( psz_text );
     }
 
-    p_scan->i_index++;
+    if( i_service == 0 &&
+        p_scan->parameter.type == SCAN_DVB_C &&
+        !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_cfg->i_modulation )
+        {
+            p_scan->parameter.i_modulation = 16;
+            p_scan->i_index++;
+        }
+        msg_Dbg( p_scan->p_obj, "modulation %d ", p_cfg->i_modulation );
+    } else {
+       p_scan->i_index++;
+    }
+    if( p_scan->parameter.type == SCAN_DVB_C )
+       p_cfg->i_modulation = p_scan->parameter.i_modulation;
     return VLC_SUCCESS;
 }
 
@@ -1010,10 +1027,10 @@ block_t *scan_GetM3U( scan_t *p_scan )
             psz_type = "Unknown";
             break;
         }
-        msg_Warn( p_obj, "scan_GetM3U: service number %d type '%s' name '%s' channel %d cypted=%d| network_id %d (nit:%d sdt:%d)| f=%d bw=%d snr=%d",
+        msg_Warn( p_obj, "scan_GetM3U: service number %d type '%s' name '%s' channel %d cypted=%d| network_id %d (nit:%d sdt:%d)| f=%d bw=%d snr=%d modulation=%d",
                   s->i_program, psz_type, s->psz_name, s->i_channel, s->b_crypted,
                   s->i_network_id, s->i_nit_version, s->i_sdt_version,
-                  s->cfg.i_frequency, s->cfg.i_bandwidth, s->i_snr );
+                  s->cfg.i_frequency, s->cfg.i_bandwidth, s->i_snr, s->cfg.i_modulation );
 
         if( !s->cfg.i_fec )
             s->cfg.i_fec = 9;   /* FEC_AUTO */
@@ -1021,14 +1038,15 @@ block_t *scan_GetM3U( scan_t *p_scan )
         char *psz;
         if( asprintf( &psz, "#EXTINF:,,%s\n"
                         "#EXTVLCOPT:program=%d\n"
-                        "dvb://frequency=%d:bandwidth=%d:voltage=%d:fec=%d\n"
+                        "dvb://frequency=%d:bandwidth=%d:voltage=%d:fec=%d:modulation=%d\n"
                         "\n",
                       s->psz_name && * s->psz_name ? s->psz_name : "Unknown",
                       s->i_program,
                       s->cfg.i_frequency,
                       s->cfg.i_bandwidth,
                       s->cfg.c_polarization == 'H' ? 18 : 13,
-                      s->cfg.i_fec ) < 0 )
+                      s->cfg.i_fec,
+                      s->cfg.i_modulation ) < 0 )
             psz = NULL;
         if( psz )
         {
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 1dd67b6..ea4cc36 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -43,7 +43,9 @@ typedef struct scan_parameter_t
     bool b_exhaustive;
     bool b_use_nit;
     bool b_free_only;
+    bool b_modulation_set;
 
+    int i_modulation;
     struct
     {
         int i_min;
@@ -82,6 +84,7 @@ typedef struct
         int i_symbol_rate;
     };
     int i_fec;
+    int i_modulation;
     char c_polarization;
 } scan_configuration_t;
 



More information about the vlc-commits mailing list