Commit ef7ff281 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add playlist_CurrentId() to get the playlist item id from the currently playing item.

parent 5da255df
......@@ -127,6 +127,8 @@ VLC_DEPRECATED_API int libvlc_playlist_isplaying( libvlc_instance_t *,
VLC_DEPRECATED_API int libvlc_playlist_items_count( libvlc_instance_t *,
libvlc_exception_t * );
VLC_DEPRECATED_API int libvlc_playlist_get_current_index( libvlc_instance_t *,
libvlc_exception_t *);
/**
* Lock the playlist.
*
......
......@@ -420,6 +420,9 @@ static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file)
/** Tell the number of items in the current playing context */
#define playlist_CurrentSize( pl ) pl->current.i_size
/** Tell the current item id in current playing context */
#define playlist_CurrentId( pl ) pl->status.p_item->i_id
/** Ask the playlist to do some work */
#define playlist_Signal( p_playlist ) vlc_object_signal( p_playlist )
......
......@@ -890,21 +890,28 @@ STDMETHODIMP VLCControl::addTarget(BSTR uri, VARIANT options, enum VLCPlaylistMo
STDMETHODIMP VLCControl::get_PlaylistIndex(int *index)
{
return E_INVALIDARG;
#if 0
if( NULL == index )
return E_POINTER;
*index = 0;
libvlc_instance_t *p_libvlc;
HRESULT result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
*index = VLC_PlaylistIndex(i_vlc);
libvlc_exception_t ex;
libvlc_exception_init(&ex);
*index = libvlc_playlist_get_current_index(p_libvlc, &ex);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCControl,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return NOERROR;
}
*index = 0;
return result;
#endif
};
STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
......
......@@ -62,7 +62,7 @@ void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
int i_options, char **ppsz_options,
libvlc_exception_t *p_e )
{
VLC_UNUSED(p_e);
VLC_UNUSED(p_e); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options);
int did_lock = 0;
assert( PL );
......@@ -208,6 +208,17 @@ int libvlc_playlist_items_count( libvlc_instance_t *p_instance,
return playlist_CurrentSize( PL );
}
int libvlc_playlist_get_current_index ( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e )
{
VLC_UNUSED(p_e);
assert( PL );
if( !PL->status.p_item )
return -1;
return playlist_CurrentId( PL );
}
void libvlc_playlist_lock( libvlc_instance_t *p_instance )
{
assert( PL );
......
......@@ -148,6 +148,7 @@ libvlc_playlist_delete_item
libvlc_playlist_get_media_player
libvlc_playlist_isplaying
libvlc_playlist_items_count
libvlc_playlist_get_current_index
libvlc_playlist_lock
libvlc_playlist_loop
libvlc_playlist_next
......
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