我认为我们应该使用新的包装器作为 Linphone 开发人员的推荐。
Core.java、linphone_jni.cc...等所有文件都会在构建linphonesdk时自动生成。据我了解,生成规则由 .mustache 文件定义。
linphonecore_jni.cc、LinphoneCore.java 等旧文件不再使用。也许您正在修改这些旧文件。
在旧方法中,您的新方法会生成到 Core.java 中,linphone_jni.cc...您必须将它们添加到正确的 .c 和 .h 文件中,并使用正确的格式和注释。
例如:我想在 Core.java 中添加以下方法:
Call inviteAddressToConferenceWithParams(Address var1, CallParams var2);
用方法映射
JNIEXPORT jobject JNICALL Java_org_linphone_core_CoreImpl_createConferenceWithParams(JNIEnv *env, jobject thiz, jlong ptr, jobject params)
在 linphone_jni.cc
我所要做的就是添加 linphone/include/linphone/core.h:
/**
* Some texts
*
* @param[in] lc #LinphoneCore object
* @param[in] addr The destination of the call (sip address).
* @param[in] params Call parameters
* @return A #LinphoneCall object or NULL in case of failure
* @ingroup call_control */
LINPHONE_PUBLIC LinphoneCall * linphone_core_invite_address_to_conference_with_params(LinphoneCore *lc, const LinphoneAddress *addr, LinphoneCallParams *params);
在 linphonecore.c 中:
LinphoneCall * linphone_core_invite_address_to_conference_with_params(LinphoneCore *lc, const LinphoneAddress *addr, LinphoneCallParams *params) {
// Add your code here
return /* return what you want */;
}
然后通过以下方式构建 linphonesdk:
cmake --build .
之后,就会生成Core.java、linphone_jni.cc中的所有相关代码。注意注释。没有它们,将不会生成代码。