From bed44649e230006ee37fe3ea33e3cf09d526f24a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 15 Apr 2011 23:54:46 +0200 Subject: [PATCH] add amr support on android --- build/android/Android.mk | 13 ++++++++-- coreapi/linphonecore_jni.cc | 24 +++++++++++++++++++ .../org/linphone/core/LinphoneCore.java | 11 ++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index 4ac0b93a7..db4d5368d 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -61,7 +61,8 @@ LOCAL_CFLAGS += \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"3.4.0\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) + -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \ + -UNE_BONNE_PIPE_CA_FAIT_DU_BIEN LOCAL_CFLAGS += -DIN_LINPHONE @@ -89,9 +90,17 @@ LOCAL_STATIC_LIBRARIES := \ libortp \ libeXosip2 \ libosip2 \ - libgsm + libgsm +ifneq ($(BUILD_AMR),0) +LOCAL_CFLAGS += -DHAVE_AMR + +LOCAL_STATIC_LIBRARIES += \ + libmsamr \ + libopencoreamr +endif + ifeq ($(LINPHONE_VIDEO),1) ifeq ($(BUILD_X264),1) LOCAL_STATIC_LIBRARIES += \ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 74a076936..b2dd76f16 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -27,6 +27,9 @@ extern "C" void libmsilbc_init(); #ifdef HAVE_X264 extern "C" void libmsx264_init(); #endif +#ifdef HAVE_AMR +extern "C" void libmsamr_init(); +#endif #endif /*ANDROID*/ static JavaVM *jvm=0; @@ -339,6 +342,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* #endif #ifdef HAVE_X264 libmsx264_init(); +#endif +#ifdef HAVE_AMR + libmsamr_init(); #endif jlong nativePtr = (jlong)linphone_core_new( &ldata->vTable ,userConfig @@ -557,6 +563,24 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy return jCodecs; } +extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env + ,jobject thiz + ,jlong lc) { + const MSList* codecs = linphone_core_get_audio_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 diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 328ef8c87..90b6de412 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -536,7 +536,16 @@ public interface LinphoneCore { VideoSize getPreferredVideoSize(); - PayloadType[] listVideoCodecs(); + /** + * Returns the currently supported audio codecs, as PayloadType elements + * @return + */ + PayloadType[] getAudioCodecs(); + /** + * Returns the currently supported video codecs, as PayloadType elements + * @return + */ + PayloadType[] getVideoCodecs(); /** * enable signaling keep alive. small udp packet sent periodically to keep udp NAT association */