[vlc-devel] Proposal for a new hotkeys design (follow-up)

brezhoneg1 brezhoneg1 at yahoo.fr
Wed Nov 5 03:28:30 CET 2008



> There is a few problems in its current form but should be easy to fix.
>
> There is code that does add callback on p_libvlc key-pressed and
key-action
>and depends on them correctly be called.
> So I would propose to:
> - forward key-pressed and key-action (not sure if both should be
forwarded,
> maybe only key-pressed no ?) to p_libvlc when you are a hotkey module
attached
> to a vout.
> - to process vout dependant actions when and only when attached to a
vout .
> - to process *non* vout dependant actions when and only when *not
attached to
> a vout.
>
>Do you see any problem with such modifications ?
>
>-- 
>fenrir


I see your point. Yet, forwarding key-pressed (key-action are not
important, as they can be computed from key-pressed) would add some
complexity and maintenance might become a nightmare. I wrote this patch
as a workaround, but if more programming needs to be done, a better
solution may be the following:

In VLC, key-pressed can be issued by different entities (QT4 GUI, vout
for video, vout for audio-visual, vout for display in a sout chain). The
only problem today is that we lose track of the origin of key- pressed.
If key-pressed + origin were kept together, everything would become
simple. One single hotkeys thread or multiple hotkeys threads wouldn't
be a matter any more.

Why not change the type of "key-pressed" from an integer to a structure
like :

   { key-pressed, p_obj } with p_obj = p_intf (for QT4 GUI) and p_vout
(for vout plugins.)

This done, the hotkeys module could be used almost as it is right now
(just needs a bit of cleaning up).
Any piece of code that registers for a callback would get the full
picture (key+origin) and should perform more relevant deeds.

One thing to make sure, retrieving p_input from p_vout has to be easy.
vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT) seems the right
solution, but I was said it was deprecated .. is that true ?

vlc_value_t could become 

typedef union
{
    int             i_int;
    bool            b_bool;
    float           f_float;
    char *          psz_string;
    void *          p_address;
    vlc_object_t *  p_object;
    vlc_list_t *    p_list;
    mtime_t         i_time;

    struct { char *psz_name; int i_object_id; } var;
    struct { int key ; int i_object_id; }       key-pressed;

   /* Make sure the structure is at least 64bits */
    struct { char a, b, c, d, e, f, g, h; } padding;

} vlc_value_t;

   Comments welcomed ....

Erwan10






More information about the vlc-devel mailing list