[Android] [WIP PATCH 03/11] remove MediaList.loadPlaylist

Thomas Guillem thomas at gllm.fr
Tue Dec 23 18:38:24 CET 2014


It's unused and undocumented.
---
 libvlc/jni/libvlcjni-medialist.c              | 56 ---------------------------
 libvlc/src/org/videolan/libvlc/LibVLC.java    |  1 -
 libvlc/src/org/videolan/libvlc/MediaList.java |  9 -----
 3 files changed, 66 deletions(-)

diff --git a/libvlc/jni/libvlcjni-medialist.c b/libvlc/jni/libvlcjni-medialist.c
index f5a548f..434bc5f 100644
--- a/libvlc/jni/libvlcjni-medialist.c
+++ b/libvlc/jni/libvlcjni-medialist.c
@@ -28,21 +28,6 @@
 #define LOG_TAG "VLC/JNI/MediaList"
 #include "log.h"
 
-struct stopped_monitor {
-    pthread_mutex_t doneMutex;
-    pthread_cond_t doneCondVar;
-    bool stopped;
-};
-
-static void stopped_callback(const libvlc_event_t *ev, void *data)
-{
-    struct stopped_monitor* monitor = data;
-    pthread_mutex_lock(&monitor->doneMutex);
-    monitor->stopped = true;
-    pthread_cond_signal(&monitor->doneCondVar);
-    pthread_mutex_unlock(&monitor->doneMutex);
-}
-
 static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
     if(!p_md) {
         return -1;
@@ -81,44 +66,3 @@ jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jint
         children,
         (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
 }
-
-void Java_org_videolan_libvlc_LibVLC_loadPlaylist(JNIEnv *env, jobject thiz, jstring mrl, jobject items) {
-    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, NULL);
-    libvlc_instance_t *p_instance = getLibVlcInstance(env, thiz);
-
-    libvlc_media_t *p_md = libvlc_media_new_location(p_instance, p_mrl);
-    libvlc_media_add_option(p_md, ":demux=playlist,none");
-    libvlc_media_add_option(p_md, ":run-time=1");
-
-    struct stopped_monitor* monitor = malloc(sizeof(struct stopped_monitor));
-    pthread_mutex_init(&monitor->doneMutex, NULL);
-    pthread_cond_init(&monitor->doneCondVar, NULL);
-    monitor->stopped = false;
-    pthread_mutex_lock(&monitor->doneMutex);
-
-    libvlc_media_player_t* p_mp = libvlc_media_player_new(p_instance);
-    libvlc_media_player_set_video_title_display(p_mp, libvlc_position_disable, 0);
-    libvlc_event_manager_t* ev = libvlc_media_player_event_manager(p_mp);
-    libvlc_event_attach(ev, libvlc_MediaPlayerEndReached, stopped_callback, monitor);
-    libvlc_media_player_set_media(p_mp, p_md);
-    libvlc_media_player_play(p_mp);
-
-    struct timespec deadline;
-    clock_gettime(CLOCK_REALTIME, &deadline);
-    deadline.tv_sec += 2; /* If "VLC can't open the file", return */
-    int mp_alive = 1;
-    while(!(monitor->stopped) && mp_alive) {
-        pthread_cond_timedwait(&monitor->doneCondVar, &monitor->doneMutex, &deadline);
-        mp_alive = libvlc_media_player_will_play(p_mp);
-    }
-    pthread_mutex_unlock(&monitor->doneMutex);
-    pthread_mutex_destroy(&monitor->doneMutex);
-    pthread_cond_destroy(&monitor->doneCondVar);
-    free(monitor);
-
-    libvlc_media_player_release(p_mp);
-
-    expand_media_internal(env, p_instance, items, p_md);
-
-    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
-}
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 8bac400..5340dd1 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -870,6 +870,5 @@ public class LibVLC {
     public native int setWindowSize(int width, int height);
 
     /* MediaList */
-    protected native void loadPlaylist(String mrl, ArrayList<String> items);
     protected native int expandMedia(int position, ArrayList<String> children);
 }
diff --git a/libvlc/src/org/videolan/libvlc/MediaList.java b/libvlc/src/org/videolan/libvlc/MediaList.java
index 7888f6f..97f9b72 100644
--- a/libvlc/src/org/videolan/libvlc/MediaList.java
+++ b/libvlc/src/org/videolan/libvlc/MediaList.java
@@ -115,15 +115,6 @@ public class MediaList {
         return ret;
     }
 
-    public void loadPlaylist(String mrl) {
-        ArrayList<String> items = new ArrayList<String>();
-        mLibVLC.loadPlaylist(mrl, items);
-        this.clear();
-        for(String item : items) {
-            this.add(item);
-        }
-    }
-
     public void insert(int position, String mrl) {
         insert(position, new Media(mLibVLC, mrl));
     }
-- 
2.1.3



More information about the Android mailing list