[vlc-devel] [PATCH 1/7] npapi: added members for notification child classes about creation/destroying of media_player_t

Sergey Radionov rsatom at gmail.com
Sat Dec 24 02:15:59 CET 2011


---
 npapi/vlcplugin_base.cpp |    2 ++
 npapi/vlcplugin_base.h   |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index d1d9bc6..bd6db07 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -650,6 +650,7 @@ bool VlcPluginBase::playlist_select( int idx )
         if( playlist_isplaying() )
             playlist_stop();
         events.unhook_manager( this );
+        on_media_player_release();
         libvlc_media_player_release( libvlc_media_player );
         libvlc_media_player = NULL;
     }
@@ -657,6 +658,7 @@ bool VlcPluginBase::playlist_select( int idx )
     libvlc_media_player = libvlc_media_player_new_from_media( p_m );
     if( libvlc_media_player )
     {
+        on_media_player_new();
         set_player_window();
 
         libvlc_event_manager_t *p_em;
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index f731976..c9c8a59 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -293,6 +293,11 @@ public:
     void event_callback(const libvlc_event_t *, NPVariant *, uint32_t);
 
 protected:
+    // called after libvlc_media_player_new_from_media
+    virtual void on_media_player_new()     {};
+    // called before libvlc_media_player_release
+    virtual void on_media_player_release() {};
+
     bool playlist_select(int);
     virtual void set_player_window() = 0;
 
-- 
1.7.7.1.msysgit.0




More information about the vlc-devel mailing list