[vlc-devel] [PATCH v2 01/11] core: move all actions handling in actions.c

Rémi Denis-Courmont remi at remlab.net
Thu Aug 10 16:59:46 CEST 2017


Le keskiviikkona 9. elokuuta 2017, 18.16.25 EEST Hugo Beauzée-Luyssen a 
écrit :
> From: Thomas Guillem <thomas at gllm.fr>
> 
> ---
>  include/vlc_actions.h     |   15 +
>  modules/control/hotkeys.c | 1261
> +------------------------------------------- src/libvlccore.sym        |   
> 1 +
>  src/misc/actions.c        | 1277
> +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1302
> insertions(+), 1252 deletions(-)
> 
> diff --git a/include/vlc_actions.h b/include/vlc_actions.h
> index 404c1662a8..0995d3db5c 100644
> --- a/include/vlc_actions.h
> +++ b/include/vlc_actions.h
> @@ -241,6 +241,7 @@ typedef enum vlc_action_id {
>      ACTIONID_VIEWPOINT_FOV_OUT,
>      ACTIONID_VIEWPOINT_ROLL_CLOCK,
>      ACTIONID_VIEWPOINT_ROLL_ANTICLOCK,
> +    ACTIONID_VIEWPOINT_UPDATE, /* Arg 1: vlc_viewpoint_t* */

The whole point (as you said yourself) of actions is to factor the calling 
code. Indeed, it enables callers to map a key code or a string to an action ID 
without knowing/caring what it actually means.

What exactly is the point of variadic actions then?

>      /* Combo Actions */
>      ACTIONID_COMBO_VOL_FOV_UP,
>      ACTIONID_COMBO_VOL_FOV_DOWN,
> @@ -272,4 +273,18 @@ VLC_API const char* const*
>  vlc_actions_get_key_names(vlc_object_t *p_obj);
>  #define vlc_actions_get_key_names(x)
> vlc_actions_get_key_names(VLC_OBJECT(x))
> 
> +/**
> + * Execute an action
> + *
> + * \param a valid vlc object
> + * \param i_action action to execute
> + * \param b_notify notify a new state via the OSD of the current vout
> + * \return VLC_SUCCESS or a VLC error
> + */
> +VLC_API int
> +vlc_actions_do(vlc_object_t *p_obj, vlc_action_id_t i_action,
> +               bool b_notify, ...);
> +#define vlc_actions_do(a,b,c,...) vlc_actions_do(VLC_OBJECT(a),b,c, \
> +    ##__VA_ARGS__)

As far as I am aware, this macro violates ISO C.

> +
>  #endif

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list