[vlc-devel] How to create a field that is accessible by multiple modules
Rafaël Carré
funman at videolan.org
Sat Nov 17 13:09:49 CET 2012
Hello,
Le 17/11/2012 13:07, Thomas Brouckaert a écrit :
> Hey Peter,
>
> I used to have the same problem and found a hackish solution that ofc never
> should be used in official code, but it is perfect for lab or own usage.
>
> I wanted to extend the libVLC API with some of my own methods that needed
> to communicate with my own module. I just used the p_libvlc object's
> variable space to store this variabels.
>
> Your code should like this:
>
> //Set a var
> var_Create(stream->p_libvlc, "variabel_name_1", VLC_VAR_INTEGER);
> var_SetInteger(stream->p_libvlc, "variabel_name_1", active);
>
> //get a var
> return var_InheritInteger(stream->p_libvlc, "variabel_name_1");
>
>
> I have no idea if this solution is thread safe and stuff like that, like I
> said, it is a hacksish solution that you shouldn't use in decent code.
It should be safe as long as the object is valid. (if it's not I expect
it to crash immediately anyway)
More information about the vlc-devel
mailing list