[Android] LibVLC: add majorVersion() method

Thomas Guillem git at videolan.org
Tue Jan 21 09:36:51 CET 2020


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 16 16:24:47 2020 +0100| [1bb8b13e8b7ddafcaf5d3f021c622c540da75dbf] | committer: Thomas Guillem

LibVLC: add majorVersion() method

Return the VLC major version, 3 or 4 for now.

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

 libvlc/jni/libvlcjni.c                     | 5 +++++
 libvlc/src/org/videolan/libvlc/LibVLC.java | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 6e7c462cb..c8e4d59fc 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -450,6 +450,11 @@ jstring Java_org_videolan_libvlc_LibVLC_version(JNIEnv* env, jobject thiz)
     return (*env)->NewStringUTF(env, libvlc_get_version());
 }
 
+jint Java_org_videolan_libvlc_LibVLC_majorVersion(JNIEnv* env, jobject thiz)
+{
+    return atoi(libvlc_get_version());
+}
+
 jstring Java_org_videolan_libvlc_LibVLC_compiler(JNIEnv* env, jobject thiz)
 {
     return (*env)->NewStringUTF(env, libvlc_get_compiler());
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 4e9f75dca..53e014574 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -97,6 +97,13 @@ public class LibVLC extends VLCObject<ILibVLC.Event> implements ILibVLC {
      */
     public static native String version();
 
+    /**
+     * Get the libVLC major version
+     *
+     * @return the libVLC major version, always >= 3
+     */
+    public static native int majorVersion();
+
     /**
      * Get the libVLC compiler
      *



More information about the Android mailing list