[Android] [PATCH] jni: add jni_get_sdk_int

Thomas Guillem tom at gllm.fr
Wed Oct 22 18:03:33 CEST 2014


return the android api.
---
 vlc-android/jni/libvlcjni.c                     | 10 ++++++++++
 vlc-android/src/org/videolan/libvlc/LibVLC.java |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 0813d7c..e4dc1a6 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -58,6 +58,7 @@
 int jni_attach_thread(JNIEnv **env, const char *thread_name);
 void jni_detach_thread();
 int jni_get_env(JNIEnv **env);
+int jni_get_sdk_int();
 
 static void add_media_options(libvlc_media_t *p_md, JNIEnv *env, jobjectArray mediaOptions)
 {
@@ -247,6 +248,12 @@ int jni_get_env(JNIEnv **env)
     return (*myVm)->GetEnv(myVm, (void **)env, VLC_JNI_VERSION) == JNI_OK ? 0 : -1;
 }
 
+static sdk_int = 0;
+int jni_get_sdk_int()
+{
+    return sdk_int;
+}
+
 // FIXME: use atomics
 static bool verbosity;
 
@@ -296,6 +303,9 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
     methodId = (*env)->GetMethodID(env, cls, "isVerboseMode", "()Z");
     verbosity = (*env)->CallBooleanMethod(env, thiz, methodId);
 
+    methodId = (*env)->GetMethodID(env, cls, "getSdkInt", "()I");
+    sdk_int = (*env)->CallIntMethod(env, thiz, methodId);
+
     methodId = (*env)->GetMethodID(env, cls, "isDirectRendering", "()Z");
     bool direct_rendering = (*env)->CallBooleanMethod(env, thiz, methodId);
     /* With the MediaCodec opaque mode we cannot use the OpenGL ES vout. */
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index 8d5ad0e..ae432c4 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -446,6 +446,10 @@ public class LibVLC {
         this.verboseMode = verboseMode;
     }
 
+    public int getSdkInt() {
+        return Build.VERSION.SDK_INT;
+    }
+
     public float[] getEqualizer()
     {
         return equalizer;
-- 
2.1.0



More information about the Android mailing list