[Android] [WIP PATCH 05/11] libvlc: move MediaList to CustomMediaList

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


Since it's not a wrapper to libvlc_media_list_t structure.
---
 libvlc/jni/Android.mk                              |   2 +-
 libvlc/jni/libvlcjni-medialist.c                   |  68 -------
 libvlc/jni/libvlcjni.c                             |  39 ++++
 .../src/org/videolan/libvlc/CustomMediaList.java   | 222 ++++++++++++++++++++
 libvlc/src/org/videolan/libvlc/LibVLC.java         |  13 +-
 libvlc/src/org/videolan/libvlc/MediaList.java      | 225 ---------------------
 .../src/org/videolan/vlc/audio/AudioService.java   |   4 +-
 7 files changed, 270 insertions(+), 303 deletions(-)
 delete mode 100644 libvlc/jni/libvlcjni-medialist.c
 create mode 100644 libvlc/src/org/videolan/libvlc/CustomMediaList.java
 delete mode 100644 libvlc/src/org/videolan/libvlc/MediaList.java

diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
index dd7975b..e6308d1 100644
--- a/libvlc/jni/Android.mk
+++ b/libvlc/jni/Android.mk
@@ -4,7 +4,7 @@ include $(CLEAR_VARS)
 LOCAL_MODULE    := libvlcjni
 
 LOCAL_SRC_FILES := libvlcjni.c libvlcjni-util.c libvlcjni-track.c
-LOCAL_SRC_FILES += libvlcjni-medialist.c libvlcjni-equalizer.c
+LOCAL_SRC_FILES += libvlcjni-equalizer.c
 LOCAL_SRC_FILES += aout.c vout.c native_crash_handler.c thumbnailer.c
 ifneq ($(ANDROID_API),android-21)
 # compat functions not needed after android-21
diff --git a/libvlc/jni/libvlcjni-medialist.c b/libvlc/jni/libvlcjni-medialist.c
deleted file mode 100644
index 434bc5f..0000000
--- a/libvlc/jni/libvlcjni-medialist.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * libvlcjni-medialist.c
- *****************************************************************************
- * Copyright © 2013 VLC authors and VideoLAN
- * Copyright © 2013 Edward Wang
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-#include <jni.h>
-#include <vlc/vlc.h>
-#include <vlc/libvlc_media_list.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "utils.h"
-#define LOG_TAG "VLC/JNI/MediaList"
-#include "log.h"
-
-static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
-    if(!p_md) {
-        return -1;
-    }
-    libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
-    libvlc_media_release(p_md);
-    if(p_subitems) {
-        // Expand any subitems if needed
-        int subitem_count = libvlc_media_list_count(p_subitems);
-        if(subitem_count > 0) {
-            LOGD("Found %d subitems, expanding", subitem_count);
-            jclass arrayListClass; jmethodID methodAdd;
-            arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
-
-            for(int i = subitem_count - 1; i >= 0; i--) {
-                libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
-                char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
-                arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
-                free(p_subitem_uri);
-            }
-        }
-        libvlc_media_list_release(p_subitems);
-        if(subitem_count > 0) {
-            return 0;
-        } else {
-            return -1;
-        }
-    } else {
-        return -1;
-    }
-}
-
-jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jint position, jobject children) {
-    return (jint)expand_media_internal(env,
-        getLibVlcInstance(env, thiz),
-        children,
-        (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
-}
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 1242e3b..3678175 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -662,6 +662,45 @@ void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, j
         libvlc_media_player_navigate(mp, (unsigned) nav);
 }
 
+static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
+    if(!p_md) {
+        return -1;
+    }
+    libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
+    libvlc_media_release(p_md);
+    if(p_subitems) {
+        // Expand any subitems if needed
+        int subitem_count = libvlc_media_list_count(p_subitems);
+        if(subitem_count > 0) {
+            LOGD("Found %d subitems, expanding", subitem_count);
+            jclass arrayListClass; jmethodID methodAdd;
+            arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
+
+            for(int i = subitem_count - 1; i >= 0; i--) {
+                libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
+                char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
+                arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
+                free(p_subitem_uri);
+            }
+        }
+        libvlc_media_list_release(p_subitems);
+        if(subitem_count > 0) {
+            return 0;
+        } else {
+            return -1;
+        }
+    } else {
+        return -1;
+    }
+}
+
+jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jint position, jobject children) {
+    return (jint)expand_media_internal(env,
+        getLibVlcInstance(env, thiz),
+        children,
+        (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
+}
+
 // TODO: remove static variables
 static int i_window_width = 0;
 static int i_window_height = 0;
diff --git a/libvlc/src/org/videolan/libvlc/CustomMediaList.java b/libvlc/src/org/videolan/libvlc/CustomMediaList.java
new file mode 100644
index 0000000..39bff71
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/CustomMediaList.java
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * MediaList.java
+ *****************************************************************************
+ * Copyright © 2013 VLC authors and VideoLAN
+ * Copyright © 2013 Edward Wang
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+package org.videolan.libvlc;
+
+import java.util.ArrayList;
+
+import android.os.Bundle;
+
+public class CustomMediaList {
+    private static final String TAG = "VLC/LibVLC/MediaList";
+
+    /* Since the libvlc_media_t is not created until the media plays, we have
+     * to cache them here. */
+    private static class MediaHolder {
+        Media m;
+        boolean noVideo; // default false
+        boolean noHardwareAcceleration; // default false
+
+        public MediaHolder(Media media) {
+            m = media; noVideo = false; noHardwareAcceleration = false;
+        }
+        public MediaHolder(Media m_, boolean noVideo_, boolean noHardwareAcceleration_) {
+            m = m_; noVideo = noVideo_; noHardwareAcceleration = noHardwareAcceleration_;
+        }
+    }
+
+    /* TODO: add locking */
+    private ArrayList<MediaHolder> mInternalList;
+    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
+    private EventHandler mEventHandler;
+
+    public CustomMediaList(LibVLC libVLC) {
+        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
+        mInternalList = new ArrayList<MediaHolder>();
+        mLibVLC = libVLC;
+    }
+
+    /**
+     * Adds a media URI to the media list.
+     *
+     * @param mrl
+     *            The MRL to add. Must be a location and not a path.
+     *            {@link LibVLC#PathToURI(String)} can be used to convert a path
+     *            to a MRL.
+     */
+    public void add(String mrl) {
+        add(new Media(mLibVLC, mrl));
+    }
+    public void add(Media media) {
+        add(media, false, false);
+    }
+    public void add(Media media, boolean noVideo) {
+        add(media, noVideo, false);
+    }
+    public void add(Media media, boolean noVideo, boolean noHardwareAcceleration) {
+        mInternalList.add(new MediaHolder(media, noVideo, noHardwareAcceleration));
+        signal_list_event(EventHandler.CustomMediaListItemAdded, mInternalList.size() - 1, media.getLocation());
+    }
+
+    /**
+     * Clear the media list. (remove all media)
+     */
+    public void clear() {
+        // Signal to observers of media being deleted.
+        for(int i = 0; i < mInternalList.size(); i++) {
+            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).m.getLocation());
+        }
+        mInternalList.clear();
+    }
+
+    private boolean isValid(int position) {
+        return position >= 0 && position < mInternalList.size();
+    }
+
+    /**
+     * 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.
+     *
+     * @param position The position to expand
+     * @return -1 if no subitems were found, 0 if subitems were expanded
+     */
+    public int expandMedia(int position) {
+        ArrayList<String> children = new ArrayList<String>();
+        int ret = mLibVLC.expandMedia(position, children);
+        if(ret == 0) {
+            mEventHandler.callback(EventHandler.CustomMediaListExpanding, new Bundle());
+            this.remove(position);
+            for(String mrl : children) {
+                this.insert(position, mrl);
+            }
+            mEventHandler.callback(EventHandler.CustomMediaListExpandingEnd, new Bundle());
+        }
+        return ret;
+    }
+
+    public void insert(int position, String mrl) {
+        insert(position, new Media(mLibVLC, mrl));
+    }
+    public void insert(int position, Media media) {
+        mInternalList.add(position, new MediaHolder(media));
+        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
+    }
+
+    /**
+     * Move a media from one position to another
+     *
+     * @param startPosition start position
+     * @param endPosition end position
+     * @throws IndexOutOfBoundsException
+     */
+    public void move(int startPosition, int endPosition) {
+        if (!(isValid(startPosition)
+              && endPosition >= 0 && endPosition <= mInternalList.size()))
+            throw new IndexOutOfBoundsException("Indexes out of range");
+
+        MediaHolder toMove = mInternalList.get(startPosition);
+        mInternalList.remove(startPosition);
+        if (startPosition >= endPosition)
+            mInternalList.add(endPosition, toMove);
+        else
+            mInternalList.add(endPosition - 1, toMove);
+        Bundle b = new Bundle();
+        b.putInt("index_before", startPosition);
+        b.putInt("index_after", endPosition);
+        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
+    }
+
+    public void remove(int position) {
+        if (!isValid(position))
+            return;
+        String uri = mInternalList.get(position).m.getLocation();
+        mInternalList.remove(position);
+        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
+    }
+
+    public void remove(String location) {
+        for (int i = 0; i < mInternalList.size(); ++i) {
+            String uri = mInternalList.get(i).m.getLocation();
+            if (uri.equals(location)) {
+                mInternalList.remove(i);
+                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
+                i--;
+            }
+        }
+    }
+
+    public int size() {
+        return mInternalList.size();
+    }
+
+    public Media getMedia(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position).m;
+    }
+
+    /**
+     * @param position The index of the media in the list
+     * @return null if not found
+     */
+    public String getMRL(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position).m.getLocation();
+    }
+
+    public String[] getMediaOptions(int position) {
+        boolean noHardwareAcceleration = false;
+        boolean noVideo = false;
+        if (isValid(position))
+        {
+            noHardwareAcceleration = mInternalList.get(position).noHardwareAcceleration;
+            noVideo = mInternalList.get(position).noVideo;
+        }
+
+        return mLibVLC.getMediaOptions(noHardwareAcceleration, noVideo);
+    }
+
+    public EventHandler getEventHandler() {
+        return mEventHandler;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("LibVLC Media List: {");
+        for(int i = 0; i < size(); i++) {
+            sb.append(((Integer)i).toString());
+            sb.append(": ");
+            sb.append(getMRL(i));
+            sb.append(", ");
+        }
+        sb.append("}");
+        return sb.toString();
+    }
+
+    private void signal_list_event(int event, int position, String uri) {
+        Bundle b = new Bundle();
+        b.putString("item_uri", uri);
+        b.putInt("item_index", position);
+        mEventHandler.callback(event, b);
+    }
+}
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 2d03283..8c4be6f 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -67,8 +67,8 @@ public class LibVLC {
     private int mInternalMediaPlayerIndex = 0; // Read-only, reserved for JNI
     private long mInternalMediaPlayerInstance = 0; // Read-only, reserved for JNI
 
-    private MediaList mMediaList; // Pointer to media list being followed
-    private MediaList mPrimaryList; // Primary/default media list; see getPrimaryMediaList()
+    private CustomMediaList mMediaList; // Pointer to media list being followed
+    private CustomMediaList mPrimaryList; // Primary/default media list; see getPrimaryMediaList()
 
     /** Buffer for VLC messages */
     private StringBuffer mDebugLogBuffer;
@@ -217,7 +217,7 @@ public class LibVLC {
      *
      * @return The media list object being followed
      */
-    public MediaList getMediaList() {
+    public CustomMediaList getMediaList() {
         return mMediaList;
     }
 
@@ -226,7 +226,7 @@ public class LibVLC {
      *
      * @param mediaList The media list object to follow
      */
-    public void setMediaList(MediaList mediaList) {
+    public void setMediaList(CustomMediaList mediaList) {
         mMediaList = mediaList;
     }
 
@@ -251,7 +251,7 @@ public class LibVLC {
      *
      * @return The primary media list
      */
-    public MediaList getPrimaryMediaList() {
+    public CustomMediaList getPrimaryMediaList() {
         return mPrimaryList;
     }
 
@@ -539,7 +539,7 @@ public class LibVLC {
             File cacheDir = context.getCacheDir();
             mCachePath = (cacheDir != null) ? cacheDir.getAbsolutePath() : null;
             nativeInit();
-            mMediaList = mPrimaryList = new MediaList(this);
+            mMediaList = mPrimaryList = new CustomMediaList(this);
             setEventHandler(EventHandler.getInstance());
             mIsInitialized = true;
         }
@@ -867,6 +867,5 @@ public class LibVLC {
 
     public native int setWindowSize(int width, int height);
 
-    /* MediaList */
     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
deleted file mode 100644
index 97f9b72..0000000
--- a/libvlc/src/org/videolan/libvlc/MediaList.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*****************************************************************************
- * MediaList.java
- *****************************************************************************
- * Copyright © 2013 VLC authors and VideoLAN
- * Copyright © 2013 Edward Wang
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-package org.videolan.libvlc;
-
-import java.util.ArrayList;
-
-import android.os.Bundle;
-
-/**
- * Java/JNI wrapper for the libvlc_media_list_t structure.
- */
-public class MediaList {
-    private static final String TAG = "VLC/LibVLC/MediaList";
-
-    /* Since the libvlc_media_t is not created until the media plays, we have
-     * to cache them here. */
-    private static class MediaHolder {
-        Media m;
-        boolean noVideo; // default false
-        boolean noHardwareAcceleration; // default false
-
-        public MediaHolder(Media media) {
-            m = media; noVideo = false; noHardwareAcceleration = false;
-        }
-        public MediaHolder(Media m_, boolean noVideo_, boolean noHardwareAcceleration_) {
-            m = m_; noVideo = noVideo_; noHardwareAcceleration = noHardwareAcceleration_;
-        }
-    }
-
-    /* TODO: add locking */
-    private ArrayList<MediaHolder> mInternalList;
-    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
-    private EventHandler mEventHandler;
-
-    public MediaList(LibVLC libVLC) {
-        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
-        mInternalList = new ArrayList<MediaHolder>();
-        mLibVLC = libVLC;
-    }
-
-    /**
-     * Adds a media URI to the media list.
-     *
-     * @param mrl
-     *            The MRL to add. Must be a location and not a path.
-     *            {@link LibVLC#PathToURI(String)} can be used to convert a path
-     *            to a MRL.
-     */
-    public void add(String mrl) {
-        add(new Media(mLibVLC, mrl));
-    }
-    public void add(Media media) {
-        add(media, false, false);
-    }
-    public void add(Media media, boolean noVideo) {
-        add(media, noVideo, false);
-    }
-    public void add(Media media, boolean noVideo, boolean noHardwareAcceleration) {
-        mInternalList.add(new MediaHolder(media, noVideo, noHardwareAcceleration));
-        signal_list_event(EventHandler.CustomMediaListItemAdded, mInternalList.size() - 1, media.getLocation());
-    }
-
-    /**
-     * Clear the media list. (remove all media)
-     */
-    public void clear() {
-        // Signal to observers of media being deleted.
-        for(int i = 0; i < mInternalList.size(); i++) {
-            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).m.getLocation());
-        }
-        mInternalList.clear();
-    }
-
-    private boolean isValid(int position) {
-        return position >= 0 && position < mInternalList.size();
-    }
-
-    /**
-     * 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.
-     *
-     * @param position The position to expand
-     * @return -1 if no subitems were found, 0 if subitems were expanded
-     */
-    public int expandMedia(int position) {
-        ArrayList<String> children = new ArrayList<String>();
-        int ret = mLibVLC.expandMedia(position, children);
-        if(ret == 0) {
-            mEventHandler.callback(EventHandler.CustomMediaListExpanding, new Bundle());
-            this.remove(position);
-            for(String mrl : children) {
-                this.insert(position, mrl);
-            }
-            mEventHandler.callback(EventHandler.CustomMediaListExpandingEnd, new Bundle());
-        }
-        return ret;
-    }
-
-    public void insert(int position, String mrl) {
-        insert(position, new Media(mLibVLC, mrl));
-    }
-    public void insert(int position, Media media) {
-        mInternalList.add(position, new MediaHolder(media));
-        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
-    }
-
-    /**
-     * Move a media from one position to another
-     *
-     * @param startPosition start position
-     * @param endPosition end position
-     * @throws IndexOutOfBoundsException
-     */
-    public void move(int startPosition, int endPosition) {
-        if (!(isValid(startPosition)
-              && endPosition >= 0 && endPosition <= mInternalList.size()))
-            throw new IndexOutOfBoundsException("Indexes out of range");
-
-        MediaHolder toMove = mInternalList.get(startPosition);
-        mInternalList.remove(startPosition);
-        if (startPosition >= endPosition)
-            mInternalList.add(endPosition, toMove);
-        else
-            mInternalList.add(endPosition - 1, toMove);
-        Bundle b = new Bundle();
-        b.putInt("index_before", startPosition);
-        b.putInt("index_after", endPosition);
-        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
-    }
-
-    public void remove(int position) {
-        if (!isValid(position))
-            return;
-        String uri = mInternalList.get(position).m.getLocation();
-        mInternalList.remove(position);
-        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
-    }
-
-    public void remove(String location) {
-        for (int i = 0; i < mInternalList.size(); ++i) {
-            String uri = mInternalList.get(i).m.getLocation();
-            if (uri.equals(location)) {
-                mInternalList.remove(i);
-                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
-                i--;
-            }
-        }
-    }
-
-    public int size() {
-        return mInternalList.size();
-    }
-
-    public Media getMedia(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position).m;
-    }
-
-    /**
-     * @param position The index of the media in the list
-     * @return null if not found
-     */
-    public String getMRL(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position).m.getLocation();
-    }
-
-    public String[] getMediaOptions(int position) {
-        boolean noHardwareAcceleration = false;
-        boolean noVideo = false;
-        if (isValid(position))
-        {
-            noHardwareAcceleration = mInternalList.get(position).noHardwareAcceleration;
-            noVideo = mInternalList.get(position).noVideo;
-        }
-
-        return mLibVLC.getMediaOptions(noHardwareAcceleration, noVideo);
-    }
-
-    public EventHandler getEventHandler() {
-        return mEventHandler;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("LibVLC Media List: {");
-        for(int i = 0; i < size(); i++) {
-            sb.append(((Integer)i).toString());
-            sb.append(": ");
-            sb.append(getMRL(i));
-            sb.append(", ");
-        }
-        sb.append("}");
-        return sb.toString();
-    }
-
-    private void signal_list_event(int event, int position, String uri) {
-        Bundle b = new Bundle();
-        b.putString("item_uri", uri);
-        b.putInt("item_index", position);
-        mEventHandler.callback(event, b);
-    }
-}
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index 05563b8..f74e2b8 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -43,7 +43,7 @@ import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcException;
 import org.videolan.libvlc.LibVlcUtil;
 import org.videolan.libvlc.Media;
-import org.videolan.libvlc.MediaList;
+import org.videolan.libvlc.CustomMediaList;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.R;
 import org.videolan.vlc.RemoteControlClientReceiver;
@@ -1184,7 +1184,7 @@ public class AudioService extends Service {
             mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);
             mLibVLC.setMediaList();
             mLibVLC.getPrimaryMediaList().clear();
-            MediaList mediaList = mLibVLC.getMediaList();
+            CustomMediaList mediaList = mLibVLC.getMediaList();
 
             mPrevious.clear();
 
-- 
2.1.3



More information about the Android mailing list