Page 1 of 1

Help with Getting Pointer to Objects from Anywhere

Posted: 15 Sep 2010 06:38
by GEFORCEXTREME
Hi, I would like to collect statistics from VLC and use those statistics for a purpose.
You can get what I mean by going to Tools -> Codec Information -> Statistics tab.

How do I get the values of these statistics and use it in a module, for etc, x264 (/vlc/modules/codecs/x264.c)?

I tried to edit the stats (/vlc/src/misc/stats.c) file such that every time the stats changes, the values are assigned to global variables that I defined in stat.c. Then I tried to access the values from x264.c (inside a separate thread that I created that runs whenever the x264 module is open).

However when I try to do the above, the x264 module simply would not open. I've tried using the global variables from other modules that vlc loads by default (for etc, hotkeys) but the same thing happened, the module hotkey simply would not load/can't be open when I did that.

Since vlc contains lots of objects and/or modules, how do I do what I want to do above? I found a thread in this forum regarding global variables and I should use var_Get / var_Set but how do I use these?

LIBVLC_USED
static inline int var_GetInteger( vlc_object_t *p_obj, const char *psz_name )
{
vlc_value_t val;
if( !var_GetChecked( p_obj, psz_name, VLC_VAR_INTEGER, &val ) )
return val.i_int;
else
return 0;
}

An example use of is
psz_val = var_GetString( p_enc, SOUT_CFG_PREFIX "deblock" );

Notice the p_enc, in source files that didn't really have p_enc declared, how or where do I get it? How do I link all these? Thanks!

Re: Help with Getting Pointer to Objects from Anywhere

Posted: 16 Sep 2010 03:04
by RĂ©mi Denis-Courmont
You don't. You can't access random objects at random memory locations from random threads.

Re: Help with Getting Pointer to Objects from Anywhere

Posted: 16 Sep 2010 04:13
by GEFORCEXTREME
Thanks, is there anyway out of this?

Re: Help with Getting Pointer to Objects from Anywhere

Posted: 16 Sep 2010 04:15
by GEFORCEXTREME
viewtopic.php?f=32&t=54675&p=180887

Would this work? Thanks.