Commit 2364bfb6 authored by Jean-Baptiste Kempf's avatar 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
parent ccedfcde
......@@ -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);
......
......@@ -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,
......
......@@ -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 )
......
......@@ -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);
......
......@@ -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 );
......
......@@ -129,6 +129,10 @@ public:
{
return is_playing();
}
int playlist_currentitem()
{
return current_item();
}
int playlist_add( const char * mrl)
{
return add_item(mrl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment