[vlc-devel] What is the significance of the first parameter to var_Create?

Peter Tap ptrtap at yahoo.com
Wed Jan 4 09:33:25 CET 2017


Hi Steve,

Thank you very much for your help.

Your remark about common parent got me thinking. After examining vlc_object_t structure, it turns out any vlc_object_t structure always holds a member variable p_libvlc that is truly a singleton across all modules. You can simply use it to create your own global variable(s):
  

    var_Create(myobj->p_libvlc, "myvar", VARTYPE_XXX)

Hope this helps other developers.

Regards,
Peter





On Monday, January 2, 2017 11:56 PM, Steve Lhomme <robux4 at gmail.com> wrote:
On Tue, Jan 3, 2017 at 1:42 AM, Peter Tap via vlc-devel
<vlc-devel at videolan.org> wrote:
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
> ---------- Forwarded message ----------
> From: Peter Tap <ptrtap at yahoo.com>
> To: Mailing List for VLC Media Player Developers <vlc-devel at videolan.org>
> Cc:
> Date: Tue, 3 Jan 2017 00:39:01 +0000 (UTC)
> Subject: What is the significance of the first parameter to var_Create?
> Hi,
>
> I need to share a value across various custom modules.

It's possible if they have a common parent or if one module is the
parent of another.

> Looks like var_Create/var_Set/var_Get is the way to go. However, I am not sure about the first parameter to these methods. Is this parameter local to each module? To achieve truly global variable, can I simply pass NULL as the first parameter?

No, a variable is part of a vlc_object_t. There is no global variable
in VLC (or there shouldn't be). If you pass NULL it will crash. You
need to find a common parent and put your variable there.


> Thank you in advance for your help.
>
> Regards,
> Peter
>


More information about the vlc-devel mailing list