[vlc-commits] input: poll signal level through demux (refs #8456)

Rémi Denis-Courmont git at videolan.org
Mon Aug 26 19:29:00 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 26 20:21:14 2013 +0300| [d2cd2e5d3645c0dd9026bfaaaf357bb2921d2258] | committer: Rémi Denis-Courmont

input: poll signal level through demux (refs #8456)

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

 include/vlc_demux.h         |    2 ++
 include/vlc_input.h         |    1 -
 modules/access/dtv/access.c |   10 +++++-----
 modules/demux/ts.c          |    5 +++--
 src/input/input.c           |   19 +++++++------------
 5 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 2492914..1d56db0 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -138,6 +138,8 @@ enum demux_query_e
     DEMUX_CAN_RECORD,           /* arg1=bool*   res=can fail(assume false) */
     DEMUX_SET_RECORD_STATE,     /* arg1=bool    res=can fail */
 
+    DEMUX_GET_SIGNAL, /* arg1=double *pf_quality, arg2=double *pf_strength
+                         res=can fail */
 
     /* II. Specific access_demux queries */
     /* PAUSE you are ensured that it is never called twice with the same state */
diff --git a/include/vlc_input.h b/include/vlc_input.h
index b48a256..491c329 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -206,7 +206,6 @@ static inline void vlc_input_attachment_Delete( input_attachment_t *a )
 #define INPUT_UPDATE_TITLE      0x0010
 #define INPUT_UPDATE_SEEKPOINT  0x0020
 #define INPUT_UPDATE_META       0x0040
-#define INPUT_UPDATE_SIGNAL     0x0080
 #define INPUT_UPDATE_TITLE_LIST 0x0100
 
 /**
diff --git a/modules/access/dtv/access.c b/modules/access/dtv/access.c
index d4f00c2..77b2f40 100644
--- a/modules/access/dtv/access.c
+++ b/modules/access/dtv/access.c
@@ -521,11 +521,6 @@ static block_t *Read (access_t *access)
 
     block->i_buffer = val;
 
-    /* Fetch the signal levels every so often. Some devices do not like this
-     * to be requested too frequently, e.g. due to low bandwidth I²C bus. */
-    if ((sys->signal_poll++) == 0)
-        access->info.i_update |= INPUT_UPDATE_SIGNAL;
-
     return block;
 }
 
@@ -555,6 +550,11 @@ static int Control (access_t *access, int query, va_list args)
             break;
 
         case ACCESS_GET_SIGNAL:
+            /* Fetch the signal levels only every so often to avoid stressing
+             * the device bus. */
+            if ((sys->signal_poll++))
+                return VLC_EGENERIC;
+
             *va_arg (args, double *) = dvb_get_snr (dev);
             *va_arg (args, double *) = dvb_get_signal_strength (dev);
             return VLC_SUCCESS;
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 4c279f7..c9a6dd9 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1202,8 +1202,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         p_sys->b_start_record = b_bool;
         return VLC_SUCCESS;
 
-    case DEMUX_GET_FPS:
-    case DEMUX_SET_TIME:
+    case DEMUX_GET_SIGNAL:
+        return stream_Control( p_demux->s, STREAM_GET_SIGNAL, args );
+
     default:
         return VLC_EGENERIC;
     }
diff --git a/src/input/input.c b/src/input/input.c
index 1ab327f..5153b68 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2212,6 +2212,13 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
         }
         p_demux->info.i_update &= ~INPUT_UPDATE_META;
     }
+    {
+        double quality;
+        double strength;
+
+        if( !demux_Control( p_demux, DEMUX_GET_SIGNAL, &quality, &strength ) )
+            input_SendEventSignal( p_input, quality, strength );
+    }
 }
 
 static void UpdateTitleListfromDemux( input_thread_t *p_input )
@@ -2284,18 +2291,6 @@ static void UpdateGenericFromAccess( input_thread_t *p_input )
         }
         p_access->info.i_update &= ~INPUT_UPDATE_META;
     }
-    if( p_access->info.i_update & INPUT_UPDATE_SIGNAL )
-    {
-        double f_quality;
-        double f_strength;
-
-        if( stream_Control( p_stream, STREAM_GET_SIGNAL, &f_quality, &f_strength ) )
-            f_quality = f_strength = -1;
-
-        input_SendEventSignal( p_input, f_quality, f_strength );
-
-        p_access->info.i_update &= ~INPUT_UPDATE_SIGNAL;
-    }
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list