Commit d70cfbb1 authored by Martin Storsjö's avatar Martin Storsjö

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

Signed-off-by: Martin Storsjö's avatarMartin Storsjö <martin@martin.st>
parent ae2787d9
...@@ -50,20 +50,26 @@ void jni_UnlockAndroidSurface() { ...@@ -50,20 +50,26 @@ void jni_UnlockAndroidSurface() {
pthread_mutex_unlock(&vout_android_lock); 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) if (vout_android_gui == NULL)
return; return;
JNIEnv *p_env;
(*myVm)->AttachCurrentThread (myVm, &p_env, NULL);
jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui); jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui);
jmethodID methodId = (*p_env)->GetMethodID (p_env, cls, "setSurfaceSize", "(IIIIII)V"); 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)->CallVoidMethod (p_env, vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);
(*p_env)->DeleteLocalRef(p_env, cls); (*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); (*myVm)->DetachCurrentThread (myVm);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment