[Android] libvlc: MediaPlayer: remove expandMedia
Thomas Guillem
git at videolan.org
Thu May 28 18:50:24 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 28 18:38:38 2015 +0200| [c12e91f74df9987f74f9abdf5c712b8d6d5da425] | committer: Thomas Guillem
libvlc: MediaPlayer: remove expandMedia
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c12e91f74df9987f74f9abdf5c712b8d6d5da425
---
libvlc/jni/libvlcjni-mediaplayer.c | 57 --------------------
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 4 --
.../org/videolan/vlc/MediaWrapperListPlayer.java | 28 +++++-----
3 files changed, 15 insertions(+), 74 deletions(-)
diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index 5fe1e7c..e3d7caf 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -610,60 +610,3 @@ Java_org_videolan_libvlc_MediaPlayer_playerNavigate(JNIEnv *env, jobject thiz,
libvlc_media_player_navigate(p_obj->u.p_mp, (unsigned) navigate);
}
-
-/* TODO REMOVE */
-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;
- }
-}
-
-/* TODO REMOVE */
-jint
-Java_org_videolan_libvlc_MediaPlayer_expandMedia(JNIEnv *env, jobject thiz,
- jobject children)
-{
- jint ret;
- libvlc_media_t *p_md;
- vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
-
- if (!p_obj)
- return -1;
-
- p_md = libvlc_media_player_get_media(p_obj->u.p_mp);
- if (!p_md)
- return -1;
-
- ret = (jint)expand_media_internal(env,
- p_obj->p_libvlc,
- children,
- p_md);
- libvlc_media_release(p_md);
- return ret;
-}
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 9d6327b..335c3f3 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -254,10 +254,6 @@ public class MediaPlayer extends VLCObject {
public native long getSpuDelay();
- /* MediaList */
- public native int expandMedia(ArrayList<String> children);
-
-
public native float[] getBands();
public native String[] getPresets();
public native float[] getPreset(int index);
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
index 9687ab4..2ce32d8 100644
--- a/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapperListPlayer.java
@@ -26,6 +26,7 @@ import android.net.Uri;
import java.util.ArrayList;
import org.videolan.libvlc.Media;
+import org.videolan.libvlc.MediaList;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.VLCOptions;
@@ -94,19 +95,20 @@ public class MediaWrapperListPlayer {
* Expand the current media.
* @return the index of the media was expanded, and -1 if no media was expanded
*/
- public int expand() {
- ArrayList<String> children = new ArrayList<String>();
- int ret = VLCInstance.getMainMediaPlayer().expandMedia(children);
- if(ret == 0) {
- mMediaList.remove(mPlayerIndex);
- for(String mrl : children) {
- final Media media = new Media(VLCInstance.get(), Uri.parse(mrl));
- media.parse(); // FIXME: parse should be done asynchronously
- media.release();
- mMediaList.insert(mPlayerIndex, new MediaWrapper(media));
- }
- }
- return ret;
+ public int expand() {
+ final Media media = VLCInstance.getMainMediaPlayer().getMedia();
+ final MediaList ml = media.subItems();
+
+ if (ml.getCount() > 0) {
+ mMediaList.remove(mPlayerIndex);
+ for (int i = 0; i < ml.getCount(); ++i) {
+ final Media child = ml.getMediaAt(i);
+ child.parse();
+ mMediaList.insert(mPlayerIndex, new MediaWrapper(child));
+ }
+ return 0;
+ } else
+ return -1;
}
public int expand(int index) {
More information about the Android
mailing list