[Android] AudioService: fix open MRL with existing items
Edward Wang
git at videolan.org
Mon Jul 29 10:14:28 CEST 2013
vlc-ports/android | branch: 0.1.x-bugfix | Edward Wang <edward.c.wang at compdigitec.com> | Sat Jul 27 13:11:25 2013 -0400| [b36d1340353ed9c87954a76b82a6a2acb26b03f7] | committer: Jean-Baptiste Kempf
AudioService: fix open MRL with existing items
(cherry picked from commit 5cf82ed6b89496ee1465de7d85ec2b0004d6eb66)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b36d1340353ed9c87954a76b82a6a2acb26b03f7
---
vlc-android/jni/libvlcjni.c | 8 ++++----
vlc-android/src/org/videolan/libvlc/LibVLC.java | 4 ++--
vlc-android/src/org/videolan/vlc/AudioService.java | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 8926517..2389b6b 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -719,7 +719,7 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
libvlc_media_player_play(mp);
}
-jboolean Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz)
+jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz)
{
int current_position = getInt(env, thiz, "mInternalMediaPlayerIndex");
libvlc_media_list_t* p_mlist = getMediaList(env, thiz);
@@ -744,11 +744,11 @@ jboolean Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz)
if(subitem_count > 0) {
create_player_and_play(env, thiz,
getLong(env, thiz, "mLibVlcInstance"), current_position);
- return JNI_TRUE;
+ return (jint)current_position;
} else
- return JNI_FALSE;
+ return -1;
} else {
- return JNI_FALSE;
+ return -1;
}
}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index 837aad1..a60ed4e 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -577,9 +577,9 @@ public class LibVLC {
* currently playing media. If there are any subitems, it will
* expand them and replace the current media.
*
- * @return true if a media was expanded, false otherwise
+ * @return the index of the media was expanded, and -1 if no media was expanded
*/
- public native boolean expandMedia();
+ public native int expandMedia();
/**
* Return the length of the stream, in milliseconds
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 3e0ca04..72b117a 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -641,18 +641,18 @@ public class AudioService extends Service {
private void next() {
// Try to expand any items present
- if(mLibVLC.expandMedia()) {
+ int pos = mLibVLC.expandMedia();
+ if(pos >= 0) {
Log.d(TAG, "Found subitems, updating media display");
ArrayList<String> mediaPathList = new ArrayList<String>();
mLibVLC.getMediaListItems(mediaPathList);
- int pos = mMediaList.indexOf(mCurrentMedia);
mMediaList.clear();
mPrevious.clear();
for(int i = 0; i < mediaPathList.size(); i++)
mMediaList.add(new Media(mediaPathList.get(i), i));
- mCurrentMedia = mMediaList.get(pos);
mLibVLCPlaylistActive = true;
+ mCurrentMedia = mMediaList.get(pos);
final AudioService service = this;
mVlcEventHandler.postDelayed(new Runnable() {
@Override
More information about the Android
mailing list