Get supported video resolutions in Android from linphonecore

This commit is contained in:
Sylvain Berfini 2014-01-28 13:59:55 +01:00
parent 187c55bfd8
commit 809123e950
4 changed files with 44 additions and 12 deletions

View file

@ -5094,21 +5094,21 @@ int linphone_core_get_camera_sensor_rotation(LinphoneCore *lc) {
}
static MSVideoSizeDef supported_resolutions[]={
{ { MS_VIDEO_SIZE_1080P_W,MS_VIDEO_SIZE_1080P_H } , "1080p" },
{ { MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H } , "uxga" },
{ { MS_VIDEO_SIZE_1080P_W, MS_VIDEO_SIZE_1080P_H } , "1080p" },
{ { MS_VIDEO_SIZE_UXGA_W, MS_VIDEO_SIZE_UXGA_H } , "uxga" },
{ { MS_VIDEO_SIZE_SXGA_MINUS_W, MS_VIDEO_SIZE_SXGA_MINUS_H } , "sxga-" },
{ { MS_VIDEO_SIZE_720P_W,MS_VIDEO_SIZE_720P_H } , "720p" },
{ { MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H } , "xga" },
{ {MS_VIDEO_SIZE_SVGA_W,MS_VIDEO_SIZE_SVGA_H} , "svga" },
{ {MS_VIDEO_SIZE_4CIF_W,MS_VIDEO_SIZE_4CIF_H} , "4cif" },
{ {MS_VIDEO_SIZE_VGA_W,MS_VIDEO_SIZE_VGA_H} , "vga" },
{ { MS_VIDEO_SIZE_720P_W, MS_VIDEO_SIZE_720P_H } , "720p" },
{ { MS_VIDEO_SIZE_XGA_W, MS_VIDEO_SIZE_XGA_H } , "xga" },
{ { MS_VIDEO_SIZE_SVGA_W, MS_VIDEO_SIZE_SVGA_H } , "svga" },
{ { MS_VIDEO_SIZE_4CIF_W, MS_VIDEO_SIZE_4CIF_H } , "4cif" },
{ { MS_VIDEO_SIZE_VGA_W, MS_VIDEO_SIZE_VGA_H } , "vga" },
#ifdef __ios
{ {MS_VIDEO_SIZE_IOS_MEDIUM_H,MS_VIDEO_SIZE_IOS_MEDIUM_W} , "ios-medium" },
{ { MS_VIDEO_SIZE_IOS_MEDIUM_H, MS_VIDEO_SIZE_IOS_MEDIUM_W } , "ios-medium" },
#endif
{ {MS_VIDEO_SIZE_CIF_W,MS_VIDEO_SIZE_CIF_H} , "cif" },
{ {MS_VIDEO_SIZE_QVGA_W,MS_VIDEO_SIZE_QVGA_H} , "qvga" },
{ {MS_VIDEO_SIZE_QCIF_W,MS_VIDEO_SIZE_QCIF_H} , "qcif" },
{ {0,0} , NULL }
{ { MS_VIDEO_SIZE_CIF_W, MS_VIDEO_SIZE_CIF_H } , "cif" },
{ { MS_VIDEO_SIZE_QVGA_W, MS_VIDEO_SIZE_QVGA_H } , "qvga" },
{ { MS_VIDEO_SIZE_QCIF_W, MS_VIDEO_SIZE_QCIF_H } , "qcif" },
{ { 0,0 } , NULL }
};
/**

View file

@ -2979,6 +2979,26 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getVideoDevice(JNIEnv *e
return 0;
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_listSupportedVideoResolutions(JNIEnv *env, jobject thiz, jlong lc) {
const MSVideoSizeDef *pdef = linphone_core_get_supported_video_sizes((LinphoneCore *)lc);
int count = 0;
int i = 0;
for (; pdef->name!=NULL; pdef++) {
i++;
}
count = i;
jobjectArray resolutions = (jobjectArray) env->NewObjectArray(count, env->FindClass("java/lang/String"), env->NewStringUTF(""));
pdef = linphone_core_get_supported_video_sizes((LinphoneCore *)lc);
i = 0;
for (; pdef->name!=NULL; pdef++) {
env->SetObjectArrayElement(resolutions, i, env->NewStringUTF(pdef->name));
i++;
}
return resolutions;
}
extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getAuthenticationToken(JNIEnv* env,jobject thiz,jlong ptr) {
LinphoneCall *call = (LinphoneCall *) ptr;
const char* token = linphone_call_get_authentication_token(call);

View file

@ -1413,4 +1413,10 @@ public interface LinphoneCore {
* @return an array of LinphoneChatRoom
*/
public LinphoneChatRoom[] getChatRooms();
/**
* Gets the linphonecore supported resolutions for video
* @return an array of String
*/
public String[] getSupportedVideoSizes();
}

View file

@ -1088,4 +1088,10 @@ class LinphoneCoreImpl implements LinphoneCore {
long ptrParams =((LinphoneCallParamsImpl)params).nativePtr;
return startReferedCall(nativePtr, getCallPtr(call), ptrParams);
}
private native String[] listSupportedVideoResolutions(long ptr);
@Override
public String[] getSupportedVideoSizes() {
return listSupportedVideoResolutions(nativePtr);
}
}