[vlc-commits] access: dvb: scan: move and simplify parameters debug

Francois Cartegnie git at videolan.org
Sun Apr 10 13:56:11 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr  6 18:34:04 2016 +0200| [d60d933cb14d15c4b329a0312d78f3bb21cd5b35] | committer: Francois Cartegnie

access: dvb: scan: move and simplify parameters debug

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

 modules/access/dvb/scan.c |   43 ++++++++++++++++++++++---------------------
 modules/access/dvb/scan.h |    2 +-
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index 3366c8d..168f006 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -195,39 +195,38 @@ static void scan_parameter_Copy( const scan_parameter_t *p_src, scan_parameter_t
         p_dst->sat_info.psz_name = strdup( p_src->sat_info.psz_name );
 }
 
-/* */
-scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
+static void scan_Debug_Parameters( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
 {
-    if( p_parameter->type == SCAN_DVB_T )
+    const char rgc_types[3] = {'T', 'S', 'C' };
+    if( !p_parameter->type )
+        return;
+
+    msg_Dbg( p_obj, "DVB-%c scanning:", rgc_types[ p_parameter->type - 1 ] );
+
+    if( p_parameter->type != SCAN_DVB_S )
     {
-        msg_Dbg( p_obj, "DVB-T 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 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" );
+
+    if( p_parameter->type == SCAN_DVB_C )
         msg_Dbg( p_obj, " - scannin modulations %s", p_parameter->b_modulation_set ? "off" : "on" );
-    }
-    else if( p_parameter->type == SCAN_DVB_S )
-    {
-        msg_Dbg( p_obj, "DVB-S scanning:" );
+
+    if( p_parameter->type == SCAN_DVB_S )
         msg_Dbg( p_obj, " - satellite [%s]", p_parameter->sat_info.psz_name );
-    }
-    else
-    {
-        return NULL;
-    }
+
     msg_Dbg( p_obj, " - use NIT %s", p_parameter->b_use_nit ? "on" : "off" );
     msg_Dbg( p_obj, " - FTA only %s", p_parameter->b_free_only ? "on" : "off" );
+}
+
+/* */
+scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
+{
+    if( p_parameter->type == SCAN_NONE )
+        return NULL;
 
     scan_t *p_scan = malloc( sizeof( *p_scan ) );
     if( unlikely(p_scan == NULL) )
@@ -241,6 +240,8 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
     scan_parameter_Copy( p_parameter, &p_scan->parameter );
     p_scan->i_time_start = mdate();
 
+    scan_Debug_Parameters( p_obj, p_parameter );
+
     return p_scan;
 }
 
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 9c2d00b..6bd4d48 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -23,7 +23,7 @@
 
 typedef enum
 {
-    SCAN_NONE,
+    SCAN_NONE = 0,
     SCAN_DVB_T,
     SCAN_DVB_S,
     SCAN_DVB_C,



More information about the vlc-commits mailing list