mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 20:48:07 +00:00
Add java wrapper for linphone_call_set_next_video_frame_decoded_callback.
This commit is contained in:
parent
ccc60f16ec
commit
c5461d7b6f
3 changed files with 41 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue