Commit c5461d7b authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add java wrapper for linphone_call_set_next_video_frame_decoded_callback.

parent ccc60f16
......@@ -6204,4 +6204,28 @@ extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_getCall(JNIEnv* e
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getChar(JNIEnv* env ,jobject thiz, jlong ptr) {
return linphone_chat_room_get_char((LinphoneChatRoom *)ptr);
}
\ No newline at end of file
}
static void _next_video_frame_decoded_callback(LinphoneCall *call, void *user_data) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
ms_error("cannot attach VM\n");
return;
}
jobject listener = (jobject) user_data;
jclass clazz = (jclass) env->GetObjectClass(listener);
jmethodID method = env->GetMethodID(clazz, "onNextVideoFrameDecoded","(Lorg/linphone/core/LinphoneCall;)V");
env->DeleteLocalRef(clazz);
jobject jcall = getCall(env, call);
env->CallVoidMethod(listener, method, jcall);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
jobject listener = env->NewGlobalRef(jlistener);
LinphoneCall *call = (LinphoneCall *)ptr;
linphone_call_set_next_video_frame_decoded_callback(call, _next_video_frame_decoded_callback, listener);
}
......@@ -26,6 +26,13 @@ import java.util.Vector;
*/
public interface LinphoneCall {
/**
* LinphoneCall listener
*/
interface LinphoneCallListener {
void onNextVideoFrameDecoded(LinphoneCall call);
}
/**
* Linphone call states
*
......@@ -365,6 +372,9 @@ public interface LinphoneCall {
* @return LinphoneChatRoom where messaging can take place.
*/
public LinphoneChatRoom getChatRoom() ;
/**
* Set the callbacks associated with the LinphoneCall.
*/
void setListener(LinphoneCall.LinphoneCallListener listener);
}
......@@ -44,6 +44,7 @@ class LinphoneCallImpl implements LinphoneCall {
private native float getCurrentQuality(long nativePtr);
private native float getAverageQuality(long nativePtr);
private native boolean mediaInProgress(long nativePtr);
private native void setListener(long ptr, LinphoneCallListener listener);
/*
* This method must always be called from JNI, nothing else.
......@@ -261,4 +262,8 @@ class LinphoneCallImpl implements LinphoneCall {
return new LinphoneChatRoomImpl(getChatRoom(nativePtr));
}
@Override
public void setListener(LinphoneCallListener listener) {
setListener(nativePtr, listener);
}
}
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