[vlc-commits] New Property: vlc.playlist.currentItem
Jean-Baptiste Kempf
git at videolan.org
Sat Dec 13 16:22:01 CET 2014
npapi-vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Dec 13 16:20:22 2014 +0100| [2364bfb6fd6f1c339125d10740ee782c11a7e3b6] | committer: Jean-Baptiste Kempf
New Property: vlc.playlist.currentItem
New property named currentItem, which returns the current playlist item.
The core for this property already exists in the plugin, therefore it
was easy to create the property for activex v2 and mozilla.i
activex v1 already knows this property, but with an other name,
"PlaylistIndex"
Close #12797
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=2364bfb6fd6f1c339125d10740ee782c11a7e3b6
---
activex/axvlc.idl | 3 +++
activex/axvlc_idl.h | 16 ++++++++++++++++
activex/vlccontrol2.cpp | 10 ++++++++++
activex/vlccontrol2.h | 1 +
npapi/npruntime/npolibvlc.cpp | 8 ++++++++
npapi/vlcplugin_base.h | 4 ++++
6 files changed, 42 insertions(+)
diff --git a/activex/axvlc.idl b/activex/axvlc.idl
index 3a0b9c1..d2b1ee5 100644
--- a/activex/axvlc.idl
+++ b/activex/axvlc.idl
@@ -342,6 +342,9 @@ library AXVLC
[propget, helpstring("Returns whether playback displays video.")]
HRESULT isPlaying([out, retval] VARIANT_BOOL* playing);
+ [propget, helpstring("Returns index of current item in playlist.")]
+ HRESULT currentItem([out, retval] int* index);
+
[helpstring("Add a playlist item.")]
HRESULT add([in] BSTR uri, [in, optional] VARIANT name, [in, optional] VARIANT options, [out, retval] long* itemId);
diff --git a/activex/axvlc_idl.h b/activex/axvlc_idl.h
index efda0df..a24d853 100644
--- a/activex/axvlc_idl.h
+++ b/activex/axvlc_idl.h
@@ -1581,6 +1581,9 @@ IVLCPlaylist : public IDispatch
virtual HRESULT STDMETHODCALLTYPE get_isPlaying(
VARIANT_BOOL *playing) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_currentItem(
+ LONG *index) = 0;
+
virtual HRESULT STDMETHODCALLTYPE add(
BSTR uri,
VARIANT name,
@@ -1676,6 +1679,10 @@ typedef struct IVLCPlaylistVtbl {
IVLCPlaylist* This,
VARIANT_BOOL *playing);
+ HRESULT (STDMETHODCALLTYPE *get_currentItem)(
+ IVLCPlaylist* This,
+ LONG *index);
+
HRESULT (STDMETHODCALLTYPE *add)(
IVLCPlaylist* This,
BSTR uri,
@@ -1735,6 +1742,7 @@ interface IVLCPlaylist {
/*** IVLCPlaylist methods ***/
#define IVLCPlaylist_get_itemCount(This,count) (This)->lpVtbl->get_itemCount(This,count)
#define IVLCPlaylist_get_isPlaying(This,playing) (This)->lpVtbl->get_isPlaying(This,playing)
+#define IVLCPlaylist_get_currentItem(This,index) (This)->lpVtbl->get_currentItem(This,index)
#define IVLCPlaylist_add(This,uri,name,options,itemId) (This)->lpVtbl->add(This,uri,name,options,itemId)
#define IVLCPlaylist_play(This) (This)->lpVtbl->play(This)
#define IVLCPlaylist_playItem(This,itemId) (This)->lpVtbl->playItem(This,itemId)
@@ -1766,6 +1774,14 @@ void __RPC_STUB IVLCPlaylist_get_isPlaying_Stub(
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
+HRESULT STDMETHODCALLTYPE IVLCPlaylist_get_currentItem_Proxy(
+ IVLCPlaylist* This,
+ LONG *index);
+void __RPC_STUB IVLCPlaylist_get_currentItem_Stub(
+ IRpcStubBuffer* This,
+ IRpcChannelBuffer* pRpcChannelBuffer,
+ PRPC_MESSAGE pRpcMessage,
+ DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IVLCPlaylist_add_Proxy(
IVLCPlaylist* This,
BSTR uri,
diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index ab88cd8..936d03c 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -471,6 +471,16 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
return S_OK;
};
+STDMETHODIMP VLCPlaylist::get_currentItem(long* index)
+{
+ if( NULL == index )
+ return E_POINTER;
+
+ *index = Instance()->get_player().current_item();
+
+ return S_OK;
+};
+
STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* item)
{
if( NULL == item )
diff --git a/activex/vlccontrol2.h b/activex/vlccontrol2.h
index f89d4b7..a01d344 100644
--- a/activex/vlccontrol2.h
+++ b/activex/vlccontrol2.h
@@ -268,6 +268,7 @@ public:
// IVLCPlaylist methods
STDMETHODIMP get_itemCount(long*);
STDMETHODIMP get_isPlaying(VARIANT_BOOL*);
+ STDMETHODIMP get_currentItem(long*);
STDMETHODIMP add(BSTR, VARIANT, VARIANT, long*);
STDMETHODIMP play();
STDMETHODIMP playItem(long);
diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index d628eb8..c5b6b91 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -860,6 +860,7 @@ const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
{
"itemCount", /* deprecated */
"isPlaying",
+ "currentItem",
"items",
};
COUNTNAMES(LibvlcPlaylistNPObject,propertyCount,propertyNames);
@@ -868,6 +869,7 @@ enum LibvlcPlaylistNPObjectPropertyIds
{
ID_playlist_itemcount,
ID_playlist_isplaying,
+ ID_playlist_currentitem,
ID_playlist_items,
};
@@ -893,6 +895,12 @@ LibvlcPlaylistNPObject::getProperty(int index, NPVariant &result)
BOOLEAN_TO_NPVARIANT(val, result);
return INVOKERESULT_NO_ERROR;
}
+ case ID_playlist_currentitem:
+ {
+ int val = p_plugin->playlist_currentitem();
+ INT32_TO_NPVARIANT(val, result);
+ return INVOKERESULT_NO_ERROR;
+ }
case ID_playlist_items:
{
InstantObj<LibvlcPlaylistItemsNPObject>( playlistItemsObj );
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index 674997c..c7b6a5c 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -129,6 +129,10 @@ public:
{
return is_playing();
}
+ int playlist_currentitem()
+ {
+ return current_item();
+ }
int playlist_add( const char * mrl)
{
return add_item(mrl);
More information about the vlc-commits
mailing list