[vlc-devel] Re: Passing/setting variables across threads/modules?

Marius Kjeldahl marius at kjeldahl.net
Fri Oct 29 21:32:48 CEST 2004


Thanks for trying to help out. I'm still struggling though. In the http module 
I typically have a httpd_file_sys_t pointer (p_args) and in the video_output 
module I have a vout_thread_t pointer (p_vout). I'm struggling to get to the 
common input instance they share to set a variable. What I'm trying is 
typically (disregard hardcoded constants and my confusion about var_Set / 
var_Change):

In the http module (module/control/http.c in MacroDo):

		      p_input = vlc_object_find (p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE);
		      if (p_input) {
			val.i_int = 500;
			if (!(var_Get (p_input, "video-y", &val) == VLC_SUCCESS)) {
			  var_Create (p_input, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
			}
			var_Set (p_input, "video-y", val);
			var_Change (p_input, "video-y", VLC_VAR_SETVALUE, &val, 0);
		      }

and then in the video_output module (module/video_output/directx/events.c in 
DirectXCreateWindow):

    p_input = vlc_object_find (p_vout, VLC_OBJECT_INPUT, FIND_ANYWHERE);
    if (p_input) {
      if (var_Get (p_input, "video-y", &val) == VLC_SUCCESS) {
	p_vout->p_sys->i_window_y = val.i_int;
      } else {
	vlc_object_release( p_input );
      }
    }

But in my code (which include debug output for the various if clauses so I can 
see what actually gets executed), it seems the variable can not be found. 
Naming it something that already exists ("video-y") might also be a bad idea, 
but I figured if it reused that name, then I'm fine with it.

Anyway, I'm kind of guessing trying to get this to work. Am I barking up the 
wrong tree here, or am I getting hot?

If anybody with a clue have some pointers on how I should proceed, I would be 
thankful.

Thanks,

Marius Kjeldahl

On Friday 29 October 2004 12:24, Derk-Jan Hartman wrote:
> variable values are usually inherited from higher level objects if they
> are set at higher level objects
>
> for intance
> playlist->input->codec->vout.
>
> so if you want to inherit a input specific value  (changes every
> input), and you want to set that before the window is created in the
> vout object, you can set that best on the p_input object instead of the
> p_vout object.
>
> DJ
>
> On 29 okt 2004, at 16:28, Marius Kjeldahl wrote:
> > I'm trying to add more window positioning control to vlc. Typically,
> > the http
> > interface would receive a http request saying you want to put a window
> > at
> > posiiton x,y size w,h. This would then need to be communicated to the
> > modules
> > controlling window stuff (directx.c/events.c on Windows).
> >
> > I've been trying to understand the usage of variables (the
> > var_Get/Set/Change
> > kind) across various threads, but the hierarchy of thread instances
> > makes
> > this hard to do with my limited knowledge of how it all fits together.
> >
> > I have already managed to introduce a new variable (see the "nodeco"
> > patch I
> > submitted earlier) in the vout modules, and that works fine. The
> > problem now,
> > however, is that for window positioning PRIOR to creating the window,
> > I need
> > to store/modify those coordinates somewhere else until the video_output
> > module actually need them.
> >
> > So for instance, if they are stored in the http module, what would be
> > the
> > easiest way to access that module from within the video_ouput module?
> > Are
> > there approaches that would be better, e.g. storing those "run-time"
> > variables somewhere central, and if so, how could I access this
> > "central
> > place" from the different modules?
> >
> > Thanks in advance,
> >
> > Marius Kjeldahl
> >
> > --
> > This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
> > To unsubscribe, please read http://developers.videolan.org/lists.html
>
> ---
> Universiteit Twente
> Derk-Jan Hartman (d.hartman at student.utwente dot nl)
> http://home.student.utwente.nl/d.hartman

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list