[vlc-devel] [PATCH] Modified the API to allow Javascript to access the index of the currently playing playlist item.
Andrew Armstrong
andrewa at cadonix.com
Thu Apr 24 16:47:49 CEST 2014
---
npapi/npruntime/npolibvlc.cpp | 8 ++++++++
npapi/vlcplugin_base.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index a930f9e..05c26c9 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -835,6 +835,7 @@ const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
"itemCount", /* deprecated */
"isPlaying",
"items",
+ "currentItem",
};
COUNTNAMES(LibvlcPlaylistNPObject,propertyCount,propertyNames);
@@ -843,6 +844,7 @@ enum LibvlcPlaylistNPObjectPropertyIds
ID_playlist_itemcount,
ID_playlist_isplaying,
ID_playlist_items,
+ ID_playlist_currentItem,
};
RuntimeNPObject::InvokeResult
@@ -873,6 +875,12 @@ LibvlcPlaylistNPObject::getProperty(int index, NPVariant &result)
OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj), result);
return INVOKERESULT_NO_ERROR;
}
+ case ID_playlist_currentItem:
+ {
+ int val = p_plugin->playlist_current_item();
+ INT32_TO_NPVARIANT(val, result);
+ return INVOKERESULT_NO_ERROR;
+ }
default:
;
}
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index c066b93..a75ff57 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -152,6 +152,10 @@ public:
{
return get_player().items_count();
}
+ int playlist_current_item()
+ {
+ return get_player().current_item();
+ }
bool playlist_select(int);
void control_handler(vlc_toolbar_clicked_t);
--
1.7.9.5
More information about the vlc-devel
mailing list