mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 09:49:26 +00:00
Fixes for listeners in Java wrapper + added manually wrapped Core.getMediastreamerFactory
This commit is contained in:
parent
cc86f4c3f6
commit
471c5b3d97
4 changed files with 34 additions and 3 deletions
|
|
@ -416,6 +416,7 @@ class JavaTranslator(object):
|
|||
}
|
||||
|
||||
classDict['isLinphoneFactory'] = _class.name.to_camel_case() == "Factory"
|
||||
classDict['isLinphoneCore'] = _class.name.to_camel_case() == "Core"
|
||||
classDict['doc'] = self.docTranslator.translate(_class.briefDescription) if _class.briefDescription is not None else None
|
||||
|
||||
for _property in _class.properties:
|
||||
|
|
@ -590,7 +591,7 @@ class JniInterface(object):
|
|||
def __init__(self, javaClass, apiClass):
|
||||
self.isSingleListener = (not apiClass.multilistener)
|
||||
self.isMultiListener = (apiClass.multilistener)
|
||||
self.classCName = javaClass.cName
|
||||
self.classCName = javaClass.className
|
||||
self.cPrefix = javaClass.cPrefix
|
||||
self.callbacks = []
|
||||
listener = apiClass.listenerInterface
|
||||
|
|
@ -626,6 +627,7 @@ class JavaClass(object):
|
|||
def __init__(self, package, _class, translator):
|
||||
self._class = translator.translate_class(_class)
|
||||
self.isLinphoneFactory = self._class['isLinphoneFactory']
|
||||
self.isLinphoneCore = self._class['isLinphoneCore']
|
||||
self.isNotLinphoneFactory = not self.isLinphoneFactory
|
||||
self.cName = 'Linphone' + _class.name.to_camel_case()
|
||||
self.cPrefix = 'linphone_' + _class.name.to_snake_case()
|
||||
|
|
|
|||
|
|
@ -95,6 +95,12 @@ public {{#isLinphoneFactory}}abstract class{{/isLinphoneFactory}}{{#isNotLinphon
|
|||
|
||||
abstract public OpenH264DownloadHelper createOpenH264DownloadHelper(Context context);
|
||||
{{/isLinphoneFactory}}
|
||||
{{#isLinphoneCore}}
|
||||
/**
|
||||
* Gets the mediastreamer's factory
|
||||
*/
|
||||
public org.linphone.mediastream.Factory getMediastreamerFactory();
|
||||
{{/isLinphoneCore}}
|
||||
{{#methods}}
|
||||
{{#doc}}
|
||||
/**
|
||||
|
|
@ -181,6 +187,13 @@ class {{classImplName}} {{#isLinphoneFactory}}extends{{/isLinphoneFactory}}{{#is
|
|||
}
|
||||
|
||||
{{/methods}}
|
||||
{{#isLinphoneCore}}
|
||||
private native org.linphone.mediastream.Factory getMediastreamerFactory(long nativePtr);
|
||||
public org.linphone.mediastream.Factory getMediastreamerFactory() {
|
||||
return getMediastreamerFactory(nativePtr);
|
||||
}
|
||||
|
||||
{{/isLinphoneCore}}
|
||||
{{#isNotLinphoneFactory}}
|
||||
private native void unref(long ptr);
|
||||
protected void finalize() throws Throwable {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ static jlong GetObjectNativePtr(JNIEnv *env, jobject object) {
|
|||
class LinphoneJavaBindings {
|
||||
public:
|
||||
LinphoneJavaBindings(JNIEnv *env) {
|
||||
ms_factory_class = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/mediastream/Factory"));
|
||||
ms_factory_class_constructor = env->GetMethodID(ms_factory_class, "<init>", "(J)V");
|
||||
|
||||
{{#objects}}
|
||||
{{cPrefix}}_class = (jclass)env->NewGlobalRef(env->FindClass("{{jniPath}}{{classImplName}}"));
|
||||
{{cPrefix}}_class_constructor = env->GetMethodID({{cPrefix}}_class, "<init>", "(J)V");
|
||||
|
|
@ -86,6 +89,9 @@ public:
|
|||
~LinphoneJavaBindings() {
|
||||
JNIEnv *env = 0;
|
||||
jvm->AttachCurrentThread(&env,NULL);
|
||||
|
||||
env->DeleteGlobalRef(ms_factory_class);
|
||||
|
||||
{{#objects}}
|
||||
env->DeleteGlobalRef({{cPrefix}}_class);
|
||||
{{/objects}}
|
||||
|
|
@ -95,6 +101,9 @@ public:
|
|||
{{/enums}}
|
||||
}
|
||||
|
||||
jclass ms_factory_class;
|
||||
jmethodID ms_factory_class_constructor;
|
||||
|
||||
{{#objects}}
|
||||
jclass {{cPrefix}}_class;
|
||||
jmethodID {{cPrefix}}_class_constructor;
|
||||
|
|
@ -265,6 +274,14 @@ void {{jniPackage}}{{classCName}}Impl_removeListener(JNIEnv* env, jobject thiz,
|
|||
{{/interfaces}}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jobject {{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_factory_get_user_data(linphone_factory_get());
|
||||
MSFactory *factory = linphone_core_get_ms_factory((LinphoneCore*)ptr);
|
||||
return env->NewObject(ljb->ms_factory_class, ljb->ms_factory_class_constructor, (jlong)factory);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
{{#methods}}
|
||||
{{return}} {{name}}({{params}}) {
|
||||
{{#notStatic}}{{classCName}} *cptr = ({{classCName}}*)ptr;{{/notStatic}}{{#strings}}
|
||||
|
|
|
|||
|
|
@ -228,10 +228,10 @@ eval "$SED_START 's/enableDownloadOpenH264(/OpenH264DownloadHelper.enableDownloa
|
|||
eval "$SED_START 's/mLc.destroy()/mLc = null/g' $SED_END"
|
||||
eval "$SED_START 's/getAllDialPlan()/getDialPlans()/g' $SED_END"
|
||||
eval "$SED_START 's/getCountryName()/getCountry()/g' $SED_END"
|
||||
eval "$SED_START 's/getMSFactory()/getMediastreamerFactory()/g' $SED_END"
|
||||
|
||||
#Changes in library required
|
||||
#Tunnel
|
||||
#DialPlan
|
||||
#LinphoneBuffer
|
||||
#Call.zoomVideo()
|
||||
#AccountCreator.updatePassword
|
||||
|
|
@ -239,7 +239,6 @@ eval "$SED_START 's/getCountryName()/getCountry()/g' $SED_END"
|
|||
#Android specifics not wrapped automatically
|
||||
#Core.needsEchoCalibration()
|
||||
#Core.hasCrappyOpenGL()
|
||||
#Core.getMSFactory()
|
||||
#Core.startEchoCalibration
|
||||
#Core.startEchoTester
|
||||
#Core.stopEchoTester
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue