[Android] LibVLC: update with last VLC changes

Thomas Guillem git at videolan.org
Sun Jun 5 14:12:21 CEST 2016


vlc-android | branch: 2.0.x | Thomas Guillem <thomas at gllm.fr> | Sun Jun  5 12:50:57 2016 +0200| [e62624d0bfa1c8e11c844cb6591058b9eb0c8c81] | committer: Geoffrey Métais

LibVLC: update with last VLC changes

(cherry picked from commit 293e794245562e7b26bd3ea3109e64ee269264a1)

> https://code.videolan.org/videolan/vlc-android/commit/e62624d0bfa1c8e11c844cb6591058b9eb0c8c81
---

 libvlc/jni/libvlcjni-media.c              |  6 +++---
 libvlc/src/org/videolan/libvlc/Media.java | 14 +++++++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libvlc/jni/libvlcjni-media.c b/libvlc/jni/libvlcjni-media.c
index aa107b1..001eb91 100644
--- a/libvlc/jni/libvlcjni-media.c
+++ b/libvlc/jni/libvlcjni-media.c
@@ -396,7 +396,7 @@ error:
 
 jboolean
 Java_org_videolan_libvlc_Media_nativeParseAsync(JNIEnv *env, jobject thiz,
-                                                jint flags)
+                                                jint flags, jint timeout)
 {
     vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
 
@@ -407,7 +407,7 @@ Java_org_videolan_libvlc_Media_nativeParseAsync(JNIEnv *env, jobject thiz,
     p_obj->p_sys->b_parsing_async = true;
     pthread_mutex_unlock(&p_obj->p_sys->lock);
 
-    return libvlc_media_parse_with_options(p_obj->u.p_m, flags) == 0 ? true : false;
+    return libvlc_media_parse_with_options(p_obj->u.p_m, flags, timeout) == 0 ? true : false;
 }
 
 jboolean
@@ -422,7 +422,7 @@ Java_org_videolan_libvlc_Media_nativeParse(JNIEnv *env, jobject thiz, jint flags
     p_obj->p_sys->b_parsing_sync = true;
     pthread_mutex_unlock(&p_obj->p_sys->lock);
 
-    if (libvlc_media_parse_with_options(p_obj->u.p_m, flags) != 0)
+    if (libvlc_media_parse_with_options(p_obj->u.p_m, flags, -1) != 0)
         return false;
 
     pthread_mutex_lock(&p_obj->p_sys->lock);
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index ca7200f..0cd33a4 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -139,7 +139,8 @@ public class Media extends VLCObject<Media.Event> {
     public static class ParsedStatus {
         public static final int Skipped = 1;
         public static final int Failed = 2;
-        public static final int Done = 3;
+        public static final int Timeout = 3;
+        public static final int Done = 4;
     }
 
     /**
@@ -551,9 +552,12 @@ public class Media extends VLCObject<Media.Event> {
      * event (only if this methods returned true).
      *
      * @param flags see {@link Parse}
+     * @param imeout maximum time allowed to preparse the media. If -1, the
+     * default "preparse-timeout" option will be used as a timeout. If 0, it will
+     * wait indefinitely. If > 0, the timeout will be used (in milliseconds).
      * @return true in case of success, false otherwise.
      */
-    public boolean parseAsync(int flags) {
+    public boolean parseAsync(int flags, int timeout) {
         boolean parse = false;
         synchronized (this) {
             if ((mParseStatus & (PARSE_STATUS_PARSED | PARSE_STATUS_PARSING)) == 0) {
@@ -564,6 +568,10 @@ public class Media extends VLCObject<Media.Event> {
         return parse && nativeParseAsync(flags);
     }
 
+    public boolean parseAsync(int flags) {
+        return parseAsync(flags, -1);
+    }
+
     /**
      * Parse the media and local art asynchronously. This Media should be alive (not released).
      *
@@ -778,7 +786,7 @@ public class Media extends VLCObject<Media.Event> {
     private native void nativeNewFromFd(LibVLC libVLC, FileDescriptor fd);
     private native void nativeNewFromMediaList(MediaList ml, int index);
     private native void nativeRelease();
-    private native boolean nativeParseAsync(int flags);
+    private native boolean nativeParseAsync(int flags, int timeout);
     private native boolean nativeParse(int flags);
     private native String nativeGetMrl();
     private native int nativeGetState();



More information about the Android mailing list