[Android] libvlc: Media: add AddOption

Thomas Guillem git at videolan.org
Wed May 27 17:43:44 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed May 27 17:37:31 2015 +0200| [0f929c80ab125b49a543e4c83037fbcf5b6505e7] | committer: Thomas Guillem

libvlc: Media: add AddOption

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

 libvlc/jni/libvlcjni-media.c              |   21 +++++++++++++++++++++
 libvlc/src/org/videolan/libvlc/Media.java |   10 ++++++++++
 2 files changed, 31 insertions(+)

diff --git a/libvlc/jni/libvlcjni-media.c b/libvlc/jni/libvlcjni-media.c
index 807ff20..c59ae2c 100644
--- a/libvlc/jni/libvlcjni-media.c
+++ b/libvlc/jni/libvlcjni-media.c
@@ -521,3 +521,24 @@ Java_org_videolan_libvlc_Media_nativeGetType(JNIEnv *env, jobject thiz)
 
     return libvlc_media_get_type(p_obj->u.p_m);
 }
+
+void
+Java_org_videolan_libvlc_Media_nativeAddOption(JNIEnv *env, jobject thiz,
+                                               jstring joption)
+{
+    const char* p_option;
+    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
+
+    if (!p_obj)
+        return;
+
+    if (!joption || !(p_option = (*env)->GetStringUTFChars(env, joption, 0)))
+    {
+        throw_IllegalArgumentException(env, "option invalid");
+        return;
+    }
+
+    libvlc_media_add_option(p_obj->u.p_m, p_option);
+
+    (*env)->ReleaseStringUTFChars(env, joption, p_option);
+}
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index f99b7b1..d492058 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -448,6 +448,15 @@ public final class Media extends VLCObject {
         return mNativeMetas != null ? mNativeMetas[id] : null;
     }
 
+    /**
+     * Add an option to this Media. This Media should be alive (not released).
+     *
+     * @param option ":option" or ":option=value"
+     */
+    public synchronized void AddOption(String option) {
+        nativeAddOption(option);
+    }
+
     @Override
     protected void onReleaseNative() {
         if (mSubItems != null)
@@ -470,4 +479,5 @@ public final class Media extends VLCObject {
     private native Track[] nativeGetTracks();
     private native long nativeGetDuration();
     private native int nativeGetType();
+    private native void nativeAddOption(String option);
 }
\ No newline at end of file



More information about the Android mailing list