[Android] Add functions for getting the Surface jobject and setting the surface size with an existing JNIEnv

Martin Storsjö git at videolan.org
Wed Jan 15 12:02:33 CET 2014


vlc-ports/android | branch: master | Martin Storsjö <martin at martin.st> | Mon Feb 18 00:15:02 2013 +0200| [d70cfbb15b9bf21bc6268a343994e6ade4958b89] | committer: Martin Storsjö

Add functions for getting the Surface jobject and setting the surface size with an existing JNIEnv

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 vlc-android/jni/vout.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/vlc-android/jni/vout.c b/vlc-android/jni/vout.c
index a5ac276..60abe93 100644
--- a/vlc-android/jni/vout.c
+++ b/vlc-android/jni/vout.c
@@ -50,20 +50,26 @@ void jni_UnlockAndroidSurface() {
     pthread_mutex_unlock(&vout_android_lock);
 }
 
-void jni_SetAndroidSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
+void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
 {
     if (vout_android_gui == NULL)
         return;
 
-    JNIEnv *p_env;
-
-    (*myVm)->AttachCurrentThread (myVm, &p_env, NULL);
     jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui);
     jmethodID methodId = (*p_env)->GetMethodID (p_env, cls, "setSurfaceSize", "(IIIIII)V");
 
     (*p_env)->CallVoidMethod (p_env, vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);
 
     (*p_env)->DeleteLocalRef(p_env, cls);
+}
+
+void jni_SetAndroidSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
+{
+    JNIEnv *p_env;
+
+    (*myVm)->AttachCurrentThread (myVm, &p_env, NULL);
+    jni_SetAndroidSurfaceSizeEnv(p_env, width, height, visible_width, visible_height, sar_num, sar_den);
+
     (*myVm)->DetachCurrentThread (myVm);
 }
 



More information about the Android mailing list