[Android] MediaList: add clear()
Edward Wang
git at videolan.org
Wed Aug 28 17:23:20 CEST 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Aug 28 17:03:54 2013 +0200| [591757d0e9f69948570b5f7b9b378eea70f63027] | committer: Edward Wang
MediaList: add clear()
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=591757d0e9f69948570b5f7b9b378eea70f63027
---
vlc-android/jni/libvlcjni-medialist.c | 9 +++++++++
vlc-android/src/org/videolan/libvlc/MediaList.java | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/vlc-android/jni/libvlcjni-medialist.c b/vlc-android/jni/libvlcjni-medialist.c
index cf2d084..e9e7121 100644
--- a/vlc-android/jni/libvlcjni-medialist.c
+++ b/vlc-android/jni/libvlcjni-medialist.c
@@ -181,6 +181,15 @@ void Java_org_videolan_libvlc_MediaList_nativeDestroy(JNIEnv *env, jobject thiz)
(*env)->DeleteGlobalRef(env, (jobject)(intptr_t)getLong(env, thiz, "mEventHanderGlobalRef"));
}
+void Java_org_videolan_libvlc_MediaList_clear(JNIEnv *env, jobject thiz) {
+ libvlc_media_list_t* p_ml = getMediaListFromJava(env, thiz);
+ libvlc_media_list_lock(p_ml);
+ for(int i = 0; i < libvlc_media_list_count(p_ml); i++) {
+ libvlc_media_list_remove_index(p_ml, i);
+ }
+ libvlc_media_list_unlock(p_ml);
+}
+
jint Java_org_videolan_libvlc_MediaList_expandMedia(JNIEnv *env, jobject thiz, jint position) {
libvlc_media_list_t* p_ml = getMediaListFromJava(env, thiz);
libvlc_media_list_lock(p_ml);
diff --git a/vlc-android/src/org/videolan/libvlc/MediaList.java b/vlc-android/src/org/videolan/libvlc/MediaList.java
index 2405e2d..94e394e 100644
--- a/vlc-android/src/org/videolan/libvlc/MediaList.java
+++ b/vlc-android/src/org/videolan/libvlc/MediaList.java
@@ -64,6 +64,11 @@ public class MediaList {
private native void add(LibVLC libvlc_instance, String mrl);
/**
+ * Clear the media list. (remove all media)
+ */
+ public native void clear();
+
+ /**
* This function checks the currently playing media for subitems at the given
* position, and if any exist, it will expand them at the same position
* and replace the current media.
More information about the Android
mailing list