[vlc-commits] dvb: initial support on scanning symbolrates on dvb-c and set default symbolrate to 0

Ilkka Ollakka git at videolan.org
Thu Mar 10 12:33:15 CET 2011


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Mar 10 10:58:56 2011 +0200| [14b1e95598dbeb827b5512b61c6860a2f8a5dfa7] | committer: 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.

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

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

diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 7f32098..5653e68 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -214,7 +214,7 @@ vlc_module_begin ()
     add_integer( "dvb-tone", -1, TONE_TEXT, TONE_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 )
     add_integer( "dvb-lnb-lof1", 0, LNB_LOF1_TEXT,
                  LNB_LOF1_LONGTEXT, true )
@@ -586,6 +586,9 @@ static block_t *BlockScan( access_t *p_access )
     if ( 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 */
     if( FrontendSet( p_access ) < 0 )
     {
diff --git a/modules/access/dvb/linux_dvb.c b/modules/access/dvb/linux_dvb.c
index 690a4c7..608b9ea 100644
--- a/modules/access/dvb/linux_dvb.c
+++ b/modules/access/dvb/linux_dvb.c
@@ -435,6 +435,12 @@ static int ScanParametersDvbC( access_t *p_access, scan_parameter_t *p_scan )
         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_max  = 8;
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index aa09528..a1bd3f9 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -555,22 +555,49 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
     }
 
     if( i_service == 0 &&
-        p_scan->parameter.type == SCAN_DVB_C &&
-        !p_scan->parameter.b_modulation_set )
+        p_scan->parameter.type == SCAN_DVB_C )
     {
-        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 )
+        bool b_rotate=true;
+        if( !p_scan->parameter.b_modulation_set )
         {
-            p_scan->parameter.i_modulation = 16;
-            p_scan->i_index++;
+            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;
         }
-        msg_Dbg( p_scan->p_obj, "modulation %d ", p_scan->parameter.i_modulation);
+        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;
 }
 
@@ -1038,7 +1065,7 @@ 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:modulation=%d\n"
+                        "dvb://frequency=%d:bandwidth=%d:voltage=%d:fec=%d:modulation=%d:srate=%d\n"
                         "\n",
                       s->psz_name && * s->psz_name ? s->psz_name : "Unknown",
                       s->i_program,
@@ -1046,7 +1073,8 @@ block_t *scan_GetM3U( scan_t *p_scan )
                       s->cfg.i_bandwidth,
                       s->cfg.c_polarization == 'H' ? 18 : 13,
                       s->cfg.i_fec,
-                      s->cfg.i_modulation ) < 0 )
+                      s->cfg.i_modulation,
+                      s->cfg.i_symbolrate ) < 0 )
             psz = NULL;
         if( psz )
         {
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index ea4cc36..6c8aef6 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -44,8 +44,10 @@ typedef struct scan_parameter_t
     bool b_use_nit;
     bool b_free_only;
     bool b_modulation_set;
+    bool b_symbolrate_set;
 
     int i_modulation;
+    int i_symbolrate;
     struct
     {
         int i_min;
@@ -85,6 +87,7 @@ typedef struct
     };
     int i_fec;
     int i_modulation;
+    int i_symbolrate;
     char c_polarization;
 } scan_configuration_t;
 



More information about the vlc-commits mailing list