[vlc-devel] Support of events in Mozilla plugin - Beta

jpd at videolan.org jpd at videolan.org
Wed Sep 2 09:40:57 CEST 2009

On Tue, Sep 01, 2009 at 07:28:49PM +0200, y.brehon at qiplay.com wrote:
> Actually, we were not able to avoid this. We wanted to, but the problem is
> when you have a mozilla plugin, only its main thread can call a javascript
> function. However, with the VLC plugin, the main thread is (most of the
> time) not the one firing VLC events, it is the sub thread created to
> actually process video. We were able to avoid this obstacle with the new
> api, in which a sub thread of the plugin can ask the browser to call a
> specific method of the main thread of the plugin... which subsequently
> calls the javascript callback. A bit of a detour, but only way we figured
> out.

Could perhaps make the main thread catch the events and `detour' them to
js, but, well, that'd be more convoluted.

> Masks are not very "javascript-esque", but we could indeed set this up. We
> had thought of the "profile" system to give shortcuts leading to what users
> are most likely to want to monitor. Maybe we should offer all options
> ("profiles" and bitmaps)?

Probably better to either fire events for everything or take a list
of desired events from javascript to look at. No point in arbitrary
restrictions. How that's implemented at the point of firing the event
back to the requester (say, a bitmap) is, well, an implementation

Note that I just committed a way to have the cpp generate a list of all
available events. I'm not sure all possible events should be passed back
to javascript but right now I don't really see why not either. At the
very least it can provide the master list of events to choose from. Note
that such a master list could safely be a static const char *[] class

> > What is the performance penalty of (unnecessairy) calls-to-javascript?
> This penalty has not been measured, but is probably not negligible, given
> that every event triggers the above-described back and forth exchanges
> (thread->firefox->plugin->javascript)

Worth a look then as it'd save code. If you come up with numbers please

More information about the vlc-devel mailing list