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

Jean-Paul Saman jpsaman at gmail.com
Thu Nov 12 11:30:07 CET 2009


On Wed, Nov 11, 2009 at 11:44 AM, <y.brehon at qiplay.com> wrote:

> Please find attached a corrected version, following your recommendations.
> Please feel free to comment.
>

Thansk for following advise and help of the videolan developers. I hope you
will continue to do so, because the works is not yet finished for this
feature. Here are my comments:

1) use function names that tell what they do

+
+// Make a copy of an NPVariant.
+NPVariant saveNPVariant(const NPVariant& original)

Use a more instructive name. It is meant to copy a NPVariant, then name it
eg: copyNPVariant() iso saveNPVariant(). 'save' indicates more permanent
storage and not making a copy.

+void eventFct(const libvlc_event_t* event, void *param)
+{

Use eg; event_callback() iso eventFct(). Callback is more descriptive.

2) use ID_event_* names here iso ID_root_*. You are extending API's for
eventObj not for rootObj.

+enum LibvlcEventNPObjectMethodIds
+{
+    ID_root_addListener,
+    ID_root_removeListeners,
+};

3) You methods/lists of type vector, but nowhere in the code you use that
fact to your benefit.

 class VlcPlugin
 {
 public:
@@ -197,6 +305,15 @@ public:

     bool  player_has_vout( libvlc_exception_t * );

+
+    // Events related members
+    std::vector<EventListener*> eventListeners; // List of registered
listerners.
+    std::vector<const NPUTF8*> eventList; // List of event sent by
VLC that must be returned to JS.
+    eventtypes_bitmap_t eventToCatch;
+    pthread_mutex_t mutex;
+
+    static bool canUseEventListener();
+
 private:
     bool playlist_select(int,libvlc_exception_t *);
     void set_player_window( libvlc_exception_t * );


Kind regards,

Jean-Paul Saman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20091112/1ff107de/attachment.html>


More information about the vlc-devel mailing list