[vlc-devel] [PATCH 2/3] input: return a status from input_ControlPush

Rémi Denis-Courmont remi at remlab.net
Mon Aug 26 17:14:22 CEST 2019


Hello,

Most if not all controls can be reduced to constant size state because they either cancel previous controls or accumulate. There are no reasons why queueing them should be allowed to fail.

What control actually can fail to be requested?

Le 26 août 2019 16:10:28 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>---
> 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 2473cae292..02513ed21b 100644
>--- a/src/input/input.c
>+++ b/src/input/input.c
>@@ -1412,8 +1412,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);
> 
>@@ -1428,6 +1428,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
>     {
>@@ -1441,8 +1443,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 67ee8a03ae..688fd56b19 100644
>--- a/src/input/input_internal.h
>+++ b/src/input/input_internal.h
>@@ -587,30 +587,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 ),
>     } );
> }
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190826/bbf0d670/attachment.html>


More information about the vlc-devel mailing list