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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Aug 10 17:35:59 CEST 2017



On Thu, Aug 10, 2017, at 04:59 PM, Rémi Denis-Courmont wrote:
> 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?

To specify a context. It is also safe to pass none, and a default one
will be inferred (also granted, this is done in next patch, but I'll
gladly merge the 2)
Since the context differs from action to action, I'm not sure how to do
this without a variadic function, or N functions with different
prototype per action category. A variadic function also eases the user
from not providing a context when the default one is enough.

> 
> >      /* 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.
> 

I suppose you are referring to the fact that the macro is one multiple
lines? I'm genuinely interested in the source for this, as this is not
how I understand §6.10.3.5

> > +
> >  #endif
> 
> -- 
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list