[vlc-devel] [PATCH] GSoC: lua services discovery, first try

Fabio Ritrovato exsephiroth87 at gmail.com
Thu Jul 23 19:05:23 CEST 2009

> I just don't see the point. By the time "another" thread can access your item,
> it ought to have all parameters set for good. Otherwise, you'll get really
> weird side effects, if you did not add all parameters yet, but someone else
> tries to use the item anyway.

If the list is a bit long, it can happen that the interface access it
before the SD is done setting it...
With the lock, there should not be weird effects, if the interface
tries to read, it waits till it's done...

>> The point of the SD is to add items, but from the code, the user can't
>> interact with them...
> First it's called Services Discovery, not Services Announce. Second, if you
> really want to extend them to support addition, you should use synchronous
> (and optional) pf_add/pf_delete callbacks into the structure as with every
> other plugin types, or whatever fits.

Well, it's not like I really want for some strange motif, it was the
point of this year and last year too to expand them in that way...
 Actually, it used to be like you suggested, with the callbacks, but
there was "something" about them last year, but I can't remeber what,
and I had to change the, and the only way i found was using events...
If you say it's ok with the callbacks, it's fine with me, I'll put
them back in...

> vlc_thread_t can be an aggregate type.

Ok, I think i found a way...

> It does not make sense to use module_get_name() on your own self. When a
> module wants to know its own name for aliasing purpose, we add it in the
> object typedef (e.g. access_t.psz_access, demux_t.psz_demux...) and set it
> before calling module_need(). It's just that SD never needed it this far.
> Using event handlers seems backward.

I agree that it usually it does not make very sense, but in this case,
the module it's a generic one, that's copied for every script you put
in the folder (see lua/vlc.c code), and so, the module has no way to
know it's name until after it's been set by module_need...
Another way could be to save the module name in p_sd before the module
is started, if that's better...

More information about the vlc-devel mailing list