[vlc-devel] [PATCH 09/12] ActiveX: switch VLCPlaylist to using vlc_player

Sergey Radionov rsatom at gmail.com
Sat Apr 21 18:07:50 CEST 2012


---
 activex/vlccontrol2.cpp |   51 ++++++++++++++--------------------------------
 1 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index 28cb940..026664c 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -538,8 +538,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
     if( NULL == count )
         return E_POINTER;
 
-    *count = 0;
-    *count = Instance()->playlist_count();
+    *count = Instance()->get_player().items_count();
+
     return S_OK;
 };
 
@@ -548,13 +548,9 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
     if( NULL == isPlaying )
         return E_POINTER;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *isPlaying = varbool( libvlc_media_player_is_playing(p_md) );
-    }
-    return hr;
+    *isPlaying = varbool( Instance()->get_player().is_playing()!=0 );
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* item)
@@ -633,65 +629,50 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite
 
 STDMETHODIMP VLCPlaylist::play()
 {
-    Instance()->playlist_play();
+    Instance()->get_player().play();
     return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::playItem(long item)
 {
-    Instance()->playlist_play_item(item);
+    Instance()->get_player().play(item);
     return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::togglePause()
 {
-    libvlc_media_player_t* p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_media_player_pause(p_md);
-    }
-    return hr;
+    Instance()->get_player().pause();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::stop()
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_media_player_stop(p_md);
-    }
-    return hr;
+    Instance()->get_player().stop();
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::next()
 {
-    Instance()->playlist_next();
+    Instance()->get_player().next();
     return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::prev()
 {
-    Instance()->playlist_prev();
+    Instance()->get_player().prev();
     return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::clear()
 {
-    Instance()->playlist_clear();
+    Instance()->get_player().clear_items();
     return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::removeItem(long item)
 {
-    libvlc_instance_t* p_libvlc;
-    HRESULT hr = getVLC(&p_libvlc);
-    if( SUCCEEDED(hr) )
-    {
-        Instance()->playlist_delete_item(item);
-    }
-    return hr;
+    Instance()->get_player().delete_item(item);
+    return S_OK;
 };
 
 STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj)
-- 
1.7.7.1.msysgit.0




More information about the vlc-devel mailing list