[vlc-devel] How to create a field that is accessible by multiple modules

Peter Tap ptrtap at yahoo.com
Thu Nov 15 09:47:12 CET 2012


Folks,

I am trying to understand how to create a field in one module and use it in another module. For example, in my module X, I have the following code

#define CFG_PREFIX "mytest-"

vlc_module_begin ()
    ...
    set_callbacks (MyOpen, MyClose)


vlc_module_end ()



static int MyOpen (vlc_object_t *obj) {
   int mode = var_CreateGetIntegerCommand(obj, CFG_PREFIX "mode");

   ...
}

Basically, I am registering a field called "mytest-mode" with the VLC engine.

What I am not clear on is how can I access this field from another module.

static int MyOtherModuleOpen(vlc_object *obj) {
   vlc_object_t* pMyTestObj = SomehowObtainTheOtherModule(obj);

   int mode = var_GetInteger(pMyTestObj, "mytest-mode");
   ...
}


Can someone please help me understand how I can share the field between two different modules?

Thank you in advance for your help.


Regards,
Peter




More information about the vlc-devel mailing list