[vlc-devel] commit: Added signal-quality/ strength input variables for access signal report. (Laurent Aimar )

git version control git at videolan.org
Sun Sep 28 13:35:56 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 23 22:11:01 2008 +0200| [813a45953e8b7a3ceb214d320d0ff8130d38a46f] | committer: Laurent Aimar 

Added signal-quality/strength input variables for access signal report.

They are set to -1 if not specified.

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

 include/vlc_access.h |   26 +++++++++++---------------
 include/vlc_input.h  |    1 +
 src/input/input.c    |   13 +++++++++++++
 src/input/var.c      |    6 ++++++
 4 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 9ddc64a..acfc87f 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -48,12 +48,18 @@ enum access_query_e
     ACCESS_GET_MTU,         /* arg1= int*           cannot fail(0 if no sense)*/
     ACCESS_GET_PTS_DELAY,   /* arg1= int64_t*       cannot fail */
     /* */
-    ACCESS_GET_TITLE_INFO,  /* arg1=input_title_t*** arg2=int* can fail */
+    ACCESS_GET_TITLE_INFO,  /* arg1=input_title_t*** arg2=int*      res=can fail */
     /* Meta data */
-    ACCESS_GET_META,        /* arg1= vlc_meta_t **  res=can fail    */
+    ACCESS_GET_META,        /* arg1= vlc_meta_t **                  res=can fail */
 
     /* */
-    ACCESS_SET_PAUSE_STATE, /* arg1= bool     can fail */
+    ACCESS_GET_CONTENT_TYPE,/* arg1=char **ppsz_content_type                       res=can fail */
+
+    /* */
+    ACCESS_GET_SIGNAL,      /* arg1=double *pf_quality, arg2=double *pf_strength   res=can fail */
+
+    /* */
+    ACCESS_SET_PAUSE_STATE, /* arg1= bool           can fail */
 
     /* */
     ACCESS_SET_TITLE,       /* arg1= int            can fail */
@@ -61,11 +67,9 @@ enum access_query_e
 
     /* Special mode for access/demux communication
      * XXX: avoid to use it unless you can't */
-    ACCESS_SET_PRIVATE_ID_STATE,    /* arg1= int i_private_data, bool b_selected can fail */
+    ACCESS_SET_PRIVATE_ID_STATE, /* arg1= int i_private_data, bool b_selected    res=can fail */
     ACCESS_SET_PRIVATE_ID_CA,    /* arg1= int i_program_number, uint16_t i_vpid, uint16_t i_apid1, uint16_t i_apid2, uint16_t i_apid3, uint8_t i_length, uint8_t *p_data */
-    ACCESS_GET_PRIVATE_ID_STATE,    /* arg1=int i_private_data arg2=bool *  res=can fail */
-
-    ACCESS_GET_CONTENT_TYPE, /* arg1=char **ppsz_content_type */
+    ACCESS_GET_PRIVATE_ID_STATE, /* arg1=int i_private_data arg2=bool *          res=can fail */
 };
 
 struct access_t
@@ -135,14 +139,6 @@ static inline int access_Control( access_t *p_access, int i_query, ... )
     return i_result;
 }
 
-static inline char *access_GetContentType( access_t *p_access )
-{
-    char *res;
-    if( access_Control( p_access, ACCESS_GET_CONTENT_TYPE, &res ) )
-        return NULL;
-    return res;
-}
-
 static inline void access_InitFields( access_t *p_a )
 {
     p_a->info.i_update = 0;
diff --git a/include/vlc_input.h b/include/vlc_input.h
index b4010d3..cf8b4b9 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -418,6 +418,7 @@ typedef enum input_state_e
 #define INPUT_UPDATE_TITLE      0x0010
 #define INPUT_UPDATE_SEEKPOINT  0x0020
 #define INPUT_UPDATE_META       0x0040
+#define INPUT_UPDATE_SIGNAL     0x0080
 
 /* Input control XXX: internal */
 #define INPUT_CONTROL_FIFO_SIZE    100
diff --git a/src/input/input.c b/src/input/input.c
index 9083d0f..ff9770a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2090,6 +2090,19 @@ static int UpdateFromAccess( input_thread_t *p_input )
         InputUpdateMeta( p_input, p_meta );
         p_access->info.i_update &= ~INPUT_UPDATE_META;
     }
+    if( p_access->info.i_update & INPUT_UPDATE_SIGNAL )
+    {
+        double f_quality;
+        double f_strength;
+
+        if( access_Control( p_access, ACCESS_GET_SIGNAL, &f_quality, &f_strength ) )
+            f_quality = f_strength = -1;
+
+        var_SetFloat( p_input, "signal-quality", f_quality );
+        var_SetFloat( p_input, "signal-strength", f_strength );
+
+        p_access->info.i_update &= ~INPUT_UPDATE_SIGNAL;
+    }
 
     p_access->info.i_update &= ~INPUT_UPDATE_SIZE;
 
diff --git a/src/input/var.c b/src/input/var.c
index e2092fc..22ad2ad 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -482,6 +482,12 @@ void input_ConfigVarInit ( input_thread_t *p_input )
     var_Create( p_input, "teletext-es", VLC_VAR_INTEGER );
     var_SetInteger( p_input, "teletext-es", -1 );
 
+    var_Create( p_input, "signal-quality", VLC_VAR_FLOAT );
+    var_SetFloat( p_input, "signal-quality", -1 );
+
+    var_Create( p_input, "signal-strength", VLC_VAR_FLOAT );
+    var_SetFloat( p_input, "signal-strength", -1 );
+
     /* */
     var_Create( p_input, "access-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Create( p_input, "access", VLC_VAR_STRING | VLC_VAR_DOINHERIT );




More information about the vlc-devel mailing list