[vlc-commits] input: return a status from input_ControlPush

Thomas Guillem git at videolan.org
Mon Sep 23 13:36:22 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Aug  9 16:33:55 2019 +0200| [14f262ae91e2b088a88431cd19de78f98f5da2ac] | committer: Thomas Guillem

input: return a status from input_ControlPush

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

 src/input/input.c          |  9 ++++++---
 src/input/input_internal.h | 14 +++++++-------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index d403d8d346..c1e39277a1 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1418,8 +1418,8 @@ static void End( input_thread_t * p_input )
 /*****************************************************************************
  * Control
  *****************************************************************************/
-void input_ControlPush( input_thread_t *p_input,
-                        int i_type, const input_control_param_t *p_param )
+int input_ControlPush( input_thread_t *p_input,
+                       int i_type, const input_control_param_t *p_param )
 {
     input_thread_private_t *sys = input_priv(p_input);
 
@@ -1434,6 +1434,8 @@ void input_ControlPush( input_thread_t *p_input,
                      i_type );
         if( p_param )
             ControlRelease( i_type, p_param );
+        vlc_mutex_unlock( &sys->lock_control );
+        return VLC_EGENERIC;
     }
     else
     {
@@ -1447,8 +1449,9 @@ void input_ControlPush( input_thread_t *p_input,
         sys->control[sys->i_control++] = c;
 
         vlc_cond_signal( &sys->wait_control );
+        vlc_mutex_unlock( &sys->lock_control );
+        return VLC_SUCCESS;
     }
-    vlc_mutex_unlock( &sys->lock_control );
 }
 
 static size_t ControlGetReducedIndexLocked( input_thread_t *p_input )
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 916a8e9e0f..e69d76b381 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -590,30 +590,30 @@ enum input_control_e
 
 /* Internal helpers */
 
-void input_ControlPush( input_thread_t *, int, const input_control_param_t * );
+int input_ControlPush( input_thread_t *, int, const input_control_param_t * );
 
 /* XXX for string value you have to allocate it before calling
  * input_ControlPushHelper
  */
-static inline void input_ControlPushHelper( input_thread_t *p_input, int i_type, vlc_value_t *val )
+static inline int input_ControlPushHelper( input_thread_t *p_input, int i_type, vlc_value_t *val )
 {
     if( val != NULL )
     {
         input_control_param_t param = { .val = *val };
-        input_ControlPush( p_input, i_type, &param );
+        return input_ControlPush( p_input, i_type, &param );
     }
     else
     {
-        input_ControlPush( p_input, i_type, NULL );
+        return input_ControlPush( p_input, i_type, NULL );
     }
 }
 
-static inline void input_ControlPushEsHelper( input_thread_t *p_input, int i_type,
-                                              vlc_es_id_t *id )
+static inline int input_ControlPushEsHelper( input_thread_t *p_input, int i_type,
+                                             vlc_es_id_t *id )
 {
     assert( i_type == INPUT_CONTROL_SET_ES || i_type == INPUT_CONTROL_UNSET_ES ||
             i_type == INPUT_CONTROL_RESTART_ES );
-    input_ControlPush( p_input, i_type, &(input_control_param_t) {
+    return input_ControlPush( p_input, i_type, &(input_control_param_t) {
         .id = vlc_es_id_Hold( id ),
     } );
 }



More information about the vlc-commits mailing list