[Android] Move media options to the Java side
Edward Wang
git at videolan.org
Mon Oct 28 04:14:41 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Oct 27 21:46:08 2013 -0400| [172a1d8c53c1642c9e67a25752840950c44d0c81] | committer: Edward Wang
Move media options to the Java side
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=172a1d8c53c1642c9e67a25752840950c44d0c81
---
vlc-android/jni/libvlcjni-medialist.c | 31 --------------------
vlc-android/src/org/videolan/libvlc/MediaList.java | 26 ++++++++++++++++
2 files changed, 26 insertions(+), 31 deletions(-)
diff --git a/vlc-android/jni/libvlcjni-medialist.c b/vlc-android/jni/libvlcjni-medialist.c
index 1944a94..35fe300 100644
--- a/vlc-android/jni/libvlcjni-medialist.c
+++ b/vlc-android/jni/libvlcjni-medialist.c
@@ -124,34 +124,3 @@ void Java_org_videolan_libvlc_MediaList_loadPlaylist(JNIEnv *env, jobject thiz,
(*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
}
-
-void Java_org_videolan_libvlc_MediaList_add(JNIEnv *env, jobject thiz, jobject libvlcInstance, jstring mrl, bool noVideo, bool noOmx) {
- libvlc_media_list_t* p_ml = getMediaListFromJava(env, thiz);
- const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, NULL);
- libvlc_media_t *p_md = libvlc_media_new_location((libvlc_instance_t*)(intptr_t)getLong(env, libvlcInstance, "mLibVlcInstance"), p_mrl);
- if (!noOmx) {
- jclass cls = (*env)->GetObjectClass(env, libvlcInstance);
- jmethodID methodId = (*env)->GetMethodID(env, cls, "useIOMX", "()Z");
- if ((*env)->CallBooleanMethod(env, libvlcInstance, methodId)) {
- /*
- * Set higher caching values if using iomx decoding, since some omx
- * decoders have a very high latency, and if the preroll data isn't
- * enough to make the decoder output a frame, the playback timing gets
- * started too soon, and every decoded frame appears to be too late.
- * On Nexus One, the decoder latency seems to be 25 input packets
- * for 320x170 H.264, a few packets less on higher resolutions.
- * On Nexus S, the decoder latency seems to be about 7 packets.
- */
- libvlc_media_add_option(p_md, ":file-caching=1500");
- libvlc_media_add_option(p_md, ":network-caching=1500");
- libvlc_media_add_option(p_md, ":codec=mediacodec,iomx,all");
- }
- if (noVideo)
- libvlc_media_add_option(p_md, ":no-video");
- }
- libvlc_media_list_lock(p_ml);
- libvlc_media_list_add_media(p_ml, p_md);
- libvlc_media_list_unlock(p_ml);
- libvlc_media_release(p_md);
- (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
-}
diff --git a/vlc-android/src/org/videolan/libvlc/MediaList.java b/vlc-android/src/org/videolan/libvlc/MediaList.java
index a3bf600..07fee5c 100644
--- a/vlc-android/src/org/videolan/libvlc/MediaList.java
+++ b/vlc-android/src/org/videolan/libvlc/MediaList.java
@@ -144,6 +144,32 @@ public class MediaList {
return mInternalList.get(position).m.getLocation();
}
+ private String[] getMediaOptions(int position) {
+ boolean noOmx = mInternalList.get(position).noOmx;
+ boolean noVideo = mInternalList.get(position).noVideo;
+ ArrayList<String> options = new ArrayList<String>();
+
+ if (!noOmx) {
+ if (mLibVLC.useIOMX()) {
+ /*
+ * Set higher caching values if using iomx decoding, since some omx
+ * decoders have a very high latency, and if the preroll data isn't
+ * enough to make the decoder output a frame, the playback timing gets
+ * started too soon, and every decoded frame appears to be too late.
+ * On Nexus One, the decoder latency seems to be 25 input packets
+ * for 320x170 H.264, a few packets less on higher resolutions.
+ * On Nexus S, the decoder latency seems to be about 7 packets.
+ */
+ options.add(":file-caching=1500");
+ options.add(":network-caching=1500");
+ options.add(":codec=mediacodec,iomx,all");
+ }
+ if (noVideo)
+ options.add(":no-video");
+ }
+ return options.toArray(new String[options.size()]);
+ }
+
public EventHandler getEventHandler() {
return mEventHandler;
}
More information about the Android
mailing list