Add linphone_core_get_video_preset() + Add JNI wrapper for some core functions.

This commit is contained in:
Ghislain MARY 2015-06-11 15:21:02 +02:00
parent b2f2db6c67
commit 7ac6a838d4
5 changed files with 60 additions and 1 deletions

View file

@ -7371,7 +7371,11 @@ bool_t linphone_core_video_multicast_enabled(const LinphoneCore *lc) {
}
void linphone_core_set_video_preset(LinphoneCore *lc, const char *preset) {
lp_config_set_string(lc->config, "video", "preset", NULL);
lp_config_set_string(lc->config, "video", "preset", preset);
}
const char * linphone_core_get_video_preset(const LinphoneCore *lc) {
return lp_config_get_string(lc->config, "video", "preset", NULL);
}
#ifdef ANDROID

View file

@ -3528,6 +3528,13 @@ LINPHONE_PUBLIC const OrtpNetworkSimulatorParams *linphone_core_get_network_simu
*/
LINPHONE_PUBLIC void linphone_core_set_video_preset(LinphoneCore *lc, const char *preset);
/**
* Get the video preset used for video calls.
* @param[in] lc LinphoneCore object
* @return The name of the video preset used for video calls (can be NULL if the default video preset is used).
*/
LINPHONE_PUBLIC const char * linphone_core_get_video_preset(const LinphoneCore *lc);
#ifdef __cplusplus
}
#endif

View file

@ -3805,10 +3805,18 @@ extern "C" jintArray Java_org_linphone_core_LinphoneCoreImpl_getPreferredVideoSi
return arr;
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getDownloadBandwidth(JNIEnv *env, jobject thiz, jlong lc) {
return (jint) linphone_core_get_download_bandwidth((LinphoneCore *)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
linphone_core_set_download_bandwidth((LinphoneCore *)lc, (int) bw);
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getUploadBandwidth(JNIEnv *env, jobject thiz, jlong lc) {
return (jint) linphone_core_get_upload_bandwidth((LinphoneCore *)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
}
@ -6221,3 +6229,8 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoPreset(JN
linphone_core_set_video_preset((LinphoneCore *)lc, char_preset);
if (char_preset) env->ReleaseStringUTFChars(preset, char_preset);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoPreset(JNIEnv *env, jobject thiz, jlong lc) {
const char *tmp = linphone_core_get_video_preset((LinphoneCore *)lc);
return tmp ? env->NewStringUTF(tmp) : NULL;
}

View file

@ -1064,7 +1064,18 @@ public interface LinphoneCore {
*/
void setRingback(String path);
/**
* Retrieve the maximum available upload bandwidth.
**/
int getUploadBandwidth();
void setUploadBandwidth(int bw);
/**
* Retrieve the maximum available download bandwidth.
**/
int getDownloadBandwidth();
/**
* Sets maximum available download bandwidth
*
@ -2041,4 +2052,11 @@ public interface LinphoneCore {
* @param preset The name of the video preset to be used (can be null to use the default video preset).
*/
public void setVideoPreset(String preset);
/**
* Get the video preset used for video calls.
* @param lc LinphoneCore object
* @return The name of the video preset used for video calls (can be null if the default video preset is used).
*/
public String getVideoPreset();
}

View file

@ -107,7 +107,9 @@ class LinphoneCoreImpl implements LinphoneCore {
private native String getStunServer(long nativePtr);
private native long createDefaultCallParams(long nativePtr);
private native int updateCall(long ptrLc, long ptrCall, long ptrParams);
private native int getUploadBandwidth(long nativePtr);
private native void setUploadBandwidth(long nativePtr, int bw);
private native int getDownloadBandwidth(long nativePtr);
private native void setDownloadBandwidth(long nativePtr, int bw);
private native void setPreferredVideoSize(long nativePtr, int width, int heigth);
private native void setPreferredVideoSizeByName(long nativePtr, String name);
@ -512,10 +514,19 @@ class LinphoneCoreImpl implements LinphoneCore {
return updateCall(nativePtr, ptrCall, ptrParams);
}
public synchronized int getUploadBandwidth() {
return getUploadBandwidth(nativePtr);
}
public synchronized void setUploadBandwidth(int bw) {
setUploadBandwidth(nativePtr, bw);
}
public synchronized int getDownloadBandwidth() {
return getDownloadBandwidth(nativePtr);
}
public synchronized void setDownloadBandwidth(int bw) {
setDownloadBandwidth(nativePtr, bw);
}
@ -1485,4 +1496,10 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setVideoPreset(String preset) {
setVideoPreset(nativePtr, preset);
}
private native String getVideoPreset(long nativePtr);
@Override
public String getVideoPreset() {
return getVideoPreset(nativePtr);
}
}