[vlc-devel] Support of events in Mozilla plugin - Beta
y.brehon at qiplay.com
Tue Sep 8 10:15:56 CEST 2009
Here is our updated version of our patch to the plugin for enabling
We have changed it in the following way:
- vlcplugin.addEventListener(callback, custom_parameter, <eventList>)
will call the "callback" function, giving it the "custom_parameter"
(which can be for instance a user-specified id). It is called:
- as soon as any event is triggered if no eventList is given
- as soon as an event of eventList is triggered. "eventList" is a
string containing a list of event names, separated by commas and/or
colons and/or semi-colons. Spaces are not separators but are ignored.
The function returns True if all goes well, or a string with the error
message otherwise. If any of the event in eventList does not exist, an
- Events in eventList must be one of: MediaPlayerOpening,
MediaPlayerBuffering, MediaPlayerPlaying, MediaPlayerPaused,
MediaPlayerStopped, MediaPlayerForward, MediaPlayerBackward,
- vlcplugin.removeEventListeners() removes all current callbacks on a
given plugin instance
- we have protected the plugin to check what version of the plugin API
is being used, so as to be still compatible with all browsers
Details of implementation are visible in the patch itself.
We hope this will satisfy the community's wishes, if you have any
feedback, please feel free!
jpd at videolan.org a écrit :
> On Wed, Sep 02, 2009 at 11:27:13AM +0200, Yannick Br?hon wrote:
>> The question is: how would you imagine settig this mask on the
> Pass a list of event( name string)s you want to be sent. The plugin
> will walk through the list at mask-setting-time and translate it into a
> bitmap. This is O(N^2) unless you have a map prepared, but since setting
> masks presumably occurs not very often compared to triggering events, I
> don't mind even N linear searches. Event triggers cause a bitmap lookup
> and a string table lookup in the master list, both by index and thus O(1).
> Like I implied: separate interface and implementation details.
> I think I would prefer clear/all/add/subtract/list over set/list, though.
> (Excercise: Why?)
>>> Worth a look then as it'd save code. If you come up with numbers please
>> OK, we just ran a few tests. Nothing complete or extremely serious, but
>> still. Machine was a dual proc @ 1.66GHz, 2GB RAM. When catching all
>> events (according to our "all" profile), proc was used at around 60%
>> (for the browser). We didn't do much processing, just a simple test on
>> the event name after catching an event. When catching only a single
>> event (begin of video play), or no events, we were running at 55%. That
>> is quite a difference, and would indeed justify the extra code...
> What are you doing that eats 55% cpu on that box without events?
> 5% cpu is not free so some filtering seems to be called for, yes.
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 15674 bytes
Desc: not available
More information about the vlc-devel