[vlc-commits] ActiveX: attach to vlc_player events

Sergey Radionov git at videolan.org
Wed Jun 6 22:37:19 CEST 2012


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Sun Mar 18 20:25:17 2012 +0700| [a80757cc0f4442d7dfe1f349795160071ab44bd9] | committer: Jean-Baptiste Kempf

ActiveX: attach to vlc_player events

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=a80757cc0f4442d7dfe1f349795160071ab44bd9
---

 activex/plugin.cpp     |   19 ++++++++++++++++++-
 activex/plugin.h       |    1 +
 activex/vlccontrol.cpp |    7 ++-----
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/activex/plugin.cpp b/activex/plugin.cpp
index 02d9735..9a8fc65 100644
--- a/activex/plugin.cpp
+++ b/activex/plugin.cpp
@@ -753,7 +753,6 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG, HWND hwndParent, LPCRECT lprcPosRect
         if( get_autoplay() )
         {
             vlc_player::play(0);
-            fireOnPlayEvent();
         }
     }
 
@@ -1243,6 +1242,24 @@ void VLCPlugin::set_player_window()
     _WindowsManager.LibVlcAttach(vlc_player::get_mp());
 }
 
+void VLCPlugin::on_player_action(vlc_player_action_e pa)
+{
+    switch(pa){
+    case pa_play:
+        fireOnPlayEvent();
+        break;
+    case pa_pause:
+        fireOnPauseEvent();
+        break;
+    case pa_stop:
+        fireOnStopEvent();
+        break;
+    case pa_next:
+    case pa_prev:
+        break;
+    }
+}
+
 void VLCPlugin::player_register_events()
 {
     libvlc_event_manager_t *eventManager = NULL;
diff --git a/activex/plugin.h b/activex/plugin.h
index 6d503ba..e1ed102 100644
--- a/activex/plugin.h
+++ b/activex/plugin.h
@@ -328,6 +328,7 @@ public:
     }
 
 protected:
+    void on_player_action(vlc_player_action_e);
 
     virtual ~VLCPlugin();
 
diff --git a/activex/vlccontrol.cpp b/activex/vlccontrol.cpp
index 7145f4a..fa0c09c 100644
--- a/activex/vlccontrol.cpp
+++ b/activex/vlccontrol.cpp
@@ -125,7 +125,6 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible)
 STDMETHODIMP VLCControl::play(void)
 {
     _p_instance->playlist_play();
-    _p_instance->fireOnPlayEvent();
     return S_OK;
 };
 
@@ -135,8 +134,7 @@ STDMETHODIMP VLCControl::pause(void)
     HRESULT result = _p_instance->getMD(&p_md);
     if( SUCCEEDED(result) )
     {
-        libvlc_media_player_pause(p_md);
-        _p_instance->fireOnPauseEvent();
+        _p_instance->playlist_pause();
     }
     return result;
 };
@@ -147,8 +145,7 @@ STDMETHODIMP VLCControl::stop(void)
     HRESULT result = _p_instance->getMD(&p_md);
     if( SUCCEEDED(result) )
     {
-        libvlc_media_player_stop(p_md);
-        _p_instance->fireOnStopEvent();
+        _p_instance->playlist_stop();
     }
     return result;
 };



More information about the vlc-commits mailing list