Commit 8b3112cc authored by Guillaume Beraudo's avatar Guillaume Beraudo
Browse files

Export video codecs list through JNI.

parent 340f7238
......@@ -3961,13 +3961,21 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate,const
const MSList *elem;
for(elem=from;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
if ((strcmp((char*)type, payload_type_get_mime(pt)) == 0) && rate==pt->clock_rate) {
if ((strcmp((char*)type, payload_type_get_mime(pt)) == 0) && (rate == -1 || rate==pt->clock_rate)) {
return pt;
}
}
return NULL;
}
static void printCodecs(const MSList* from) {
const MSList *elem;
for(elem=from;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
ms_message(payload_type_get_mime(pt));
}
}
/**
* Get payload type from mime type and clock rate
* @ingroup media_parameters
......
......@@ -509,6 +509,24 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv*
env->ReleaseStringUTFChars(jmime, mime);
return result;
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
int codecsCount = ms_list_size(codecs);
jlongArray jCodecs = env->NewLongArray(codecsCount);
jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++ ) {
jInternalArray[i] = (unsigned long) (codecs->data);
codecs = codecs->next;
}
env->ReleaseLongArrayElements(jCodecs, jInternalArray, 0);
return jCodecs;
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
,jobject thiz
,jlong lc
......@@ -831,12 +849,9 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv
return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
}
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env
,jobject thiz
,jlong ptr) {
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
PayloadType* pt = (PayloadType*)ptr;
char* value = ms_strdup_printf("[%s] clock [%s], bitrate [%s]"
char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
,payload_type_get_mime(pt)
,payload_type_get_rate(pt)
,payload_type_get_bitrate(pt));
......@@ -844,6 +859,16 @@ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env
ms_free(value);
return jvalue;
}
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_getMime(JNIEnv* env,jobject thiz,jlong ptr) {
PayloadType* pt = (PayloadType*)ptr;
jstring jvalue =env->NewStringUTF(payload_type_get_mime(pt));
return jvalue;
}
extern "C" jint Java_org_linphone_core_PayloadTypeImpl_getRate(JNIEnv* env,jobject thiz, jlong ptr) {
PayloadType* pt = (PayloadType*)ptr;
return payload_type_get_rate(pt);
}
//LinphoneCall
extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv* env
,jobject thiz
......
......@@ -485,4 +485,7 @@ public interface LinphoneCore {
public void setPreferredVideoSize(VideoSize vSize);
public VideoSize getPreferredVideoSize();
public PayloadType[] listVideoCodecs();
}
......@@ -20,4 +20,5 @@ package org.linphone.core;
public interface PayloadType {
String getMime();
}
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