[Android] libvlcjni: return the index in the playlist from readMedia

Ludovic Fauvet git at videolan.org
Tue Sep 25 11:28:44 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Tue Sep 25 01:38:51 2012 +0200| [fc2051522395a8197cd10a8342fc2d08c7de64a4] | committer: Ludovic Fauvet

libvlcjni: return the index in the playlist from readMedia

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fc2051522395a8197cd10a8342fc2d08c7de64a4
---

 vlc-android/jni/libvlcjni.c                  |    4 +++-
 vlc-android/src/org/videolan/vlc/LibVLC.java |    7 ++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index bbaccb5..9736023 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -609,7 +609,7 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
     libvlc_media_list_player_play_item_at_index(p_mlp, position);
 }
 
-void Java_org_videolan_vlc_LibVLC_readMedia(JNIEnv *env, jobject thiz,
+jint Java_org_videolan_vlc_LibVLC_readMedia(JNIEnv *env, jobject thiz,
                                             jlong instance, jstring mrl, jboolean novideo)
 {
     /* Create a new item */
@@ -636,6 +636,8 @@ void Java_org_videolan_vlc_LibVLC_readMedia(JNIEnv *env, jobject thiz,
     libvlc_media_release(m);
 
     create_player_and_play(env, thiz, instance, position);
+
+    return position;
 }
 
 void Java_org_videolan_vlc_LibVLC_playIndex(JNIEnv *env, jobject thiz,
diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index 1e8ec98..174703f 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -247,9 +247,9 @@ public class LibVLC {
     /**
      * Read a media.
      */
-    public void readMedia(String mrl, boolean novideo) {
+    public int readMedia(String mrl, boolean novideo) {
         Log.v(TAG, "Reading " + mrl);
-        readMedia(mLibVlcInstance, mrl, novideo);
+        return readMedia(mLibVlcInstance, mrl, novideo);
     }
 
     /**
@@ -324,8 +324,9 @@ public class LibVLC {
      * Read a media
      * @param instance: the instance of libVLC
      * @param mrl: the media mrl
+     * @return the position in the playlist
      */
-    private native void readMedia(long instance, String mrl, boolean novideo);
+    private native int readMedia(long instance, String mrl, boolean novideo);
 
     /**
      * Play an index in the native media list (playlist)



More information about the Android mailing list