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

Add JNI wrapper to set audio/video codecs and to enable DNS SRV.

parent b285efeb
......@@ -1639,6 +1639,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
ms_list_append(pts, pt);
}
linphone_core_set_video_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
......@@ -1657,6 +1669,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
pts = ms_list_append(pts, pt);
}
linphone_core_set_audio_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
,jobject thiz
,jlong lc
......@@ -5861,4 +5885,10 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
return linphone_core_video_multicast_enabled((LinphoneCore*)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv(JNIEnv *env, jobject thiz, jlong lc, jboolean yesno) {
linphone_core_enable_dns_srv((LinphoneCore *)lc, yesno);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_dnsSrvEnabled(JNIEnv *env, jobject thiz, jlong lc) {
return linphone_core_dns_srv_enabled((LinphoneCore *)lc);
}
......@@ -1127,11 +1127,21 @@ public interface LinphoneCore {
* @return
*/
PayloadType[] getAudioCodecs();
/**
* Set the list of audio codecs.
* @param codecs List of PayloadType objects
*/
void setAudioCodecs(PayloadType[] codecs);
/**
* Returns the currently supported video codecs, as PayloadType elements
* @return
*/
PayloadType[] getVideoCodecs();
/**
* Set the list of video codecs.
* @param codecs List of PayloadType objects
*/
void setVideoCodecs(PayloadType[] codecs);
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
......@@ -2000,7 +2010,17 @@ public interface LinphoneCore {
* @return true if subsequent calls will propose multicast ip set by {@link linphone_core_set_video_multicast_addr}
**/
public boolean videoMulticastEnabled();
/**
* Enable or disable DNS SRV resolution.
* @param yesno true to enable DNS SRV resolution, false to disable it.
*/
public void enableDnsSrv(boolean yesno);
/**
* Tells whether DNS SRV resolution is enabled.
* @return true if DNS SRV resolution is enabled, false if disabled.
*/
public boolean dnsSrvEnabled();
}
......@@ -114,12 +114,14 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setRing(long nativePtr, String path);
private native String getRing(long nativePtr);
private native void setRootCA(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native long[] listVideoPayloadTypes(long nativePtr);
private native void setVideoCodecs(long nativePtr, long[] codecs);
private native LinphoneProxyConfig[] getProxyConfigList(long nativePtr);
private native long[] getAuthInfosList(long nativePtr);
private native long findAuthInfos(long nativePtr, String username, String realm, String domain);
private native long[] listAudioPayloadTypes(long nativePtr);
private native void setAudioCodecs(long nativePtr, long[] codecs);
private native void enableKeepAlive(long nativePtr,boolean enable);
private native boolean isKeepAliveEnabled(long nativePtr);
private native int startEchoCalibration(long nativePtr,Object data);
......@@ -560,6 +562,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setVideoCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setVideoCodecs(nativePtr, typesPtr);
}
public synchronized PayloadType[] getAudioCodecs() {
long[] typesPtr = listAudioPayloadTypes(nativePtr);
if (typesPtr == null) return null;
......@@ -572,6 +581,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setAudioCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setAudioCodecs(nativePtr, typesPtr);
}
public synchronized boolean isNetworkReachable() {
return isNetworkStateReachable(nativePtr);
}
......@@ -1446,4 +1462,15 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean videoMulticastEnabled() {
return videoMulticastEnabled(nativePtr);
}
private native void enableDnsSrv(long ptr, boolean yesno);
@Override
public void enableDnsSrv(boolean yesno) {
enableDnsSrv(nativePtr, yesno);
}
private native boolean dnsSrvEnabled(long ptr);
@Override
public boolean dnsSrvEnabled() {
return dnsSrvEnabled(nativePtr);
}
}
......@@ -21,7 +21,7 @@ package org.linphone.core;
class PayloadTypeImpl implements PayloadType {
protected final long nativePtr;
public final long nativePtr;
private native String toString(long ptr);
private native String getMime(long ptr);
......
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