]> sjero.net Git - linphone/blobdiff - coreapi/linphonecore_jni.cc
Merge branch 'dev_conference'
[linphone] / coreapi / linphonecore_jni.cc
index d5bd4ef46cd77aa07d39db3bef291a74da50c493..8c062156cc7bf394920b14f2ce16989f687b994f 100644 (file)
@@ -20,8 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "linphonecore_utils.h"
 #include <ortp/zrtp.h>
 
+extern "C" {
+#include "mediastreamer2/mediastream.h"
+}
 #include "mediastreamer2/msjava.h"
-
+#include "private.h"
 #include <cpu-features.h>
 
 #ifdef ANDROID
@@ -1164,6 +1167,20 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv*
        linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
 }
 
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreviewWindowId(JNIEnv* env
+                                                                                                                                               ,jobject thiz
+                                                                                                                                               ,jlong lc
+                                                                                                                                               ,jobject obj) {
+       linphone_core_set_native_preview_window_id((LinphoneCore*)lc,(unsigned long)obj);
+}
+
+extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDeviceRotation(JNIEnv* env
+                                                                                                                                               ,jobject thiz
+                                                                                                                                               ,jlong lc
+                                                                                                                                               ,jint rotation) {
+       linphone_core_set_device_rotation((LinphoneCore*)lc,rotation);
+}
+
 
 extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
        linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
@@ -1218,6 +1235,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_enableCamera(JNIEnv *en
        linphone_call_enable_camera((LinphoneCall *)lc, (bool_t) b);
 }
 
+extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_cameraEnabled(JNIEnv *env, jobject thiz, jlong lc){
+       linphone_call_camera_enabled((LinphoneCall *)lc);
+}
+
 extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_inviteAddressWithParams(JNIEnv *env, jobject thiz, jlong lc, jlong addr, jlong params){
        return (jlong) linphone_core_invite_address_with_params((LinphoneCore *)lc, (const LinphoneAddress *)addr, (const LinphoneCallParams *)params);
 }
@@ -1272,7 +1293,7 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv
 extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv*  env,jobject thiz,jlong ptr) {
        linphone_call_get_duration((LinphoneCall *) ptr);
 }
-       
+
 extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) {
        LCSipTransports tr;
        linphone_core_get_sip_transports((LinphoneCore *) ptr, &tr);
@@ -1294,7 +1315,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSignalingTransportPor
        tr.udp_port = udp;
        tr.tcp_port = tcp;
        tr.tls_port = tls;
-       
+
        linphone_core_set_sip_transports(lc, &tr); // tr will be copied
 }
 
@@ -1374,6 +1395,47 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIE
        }
 }
 
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_setVideoDevice(JNIEnv *env,jobject thiz,jlong pCore,jint id) {
+       LinphoneCore* lc = (LinphoneCore *) pCore;
+       const char** devices = linphone_core_get_video_devices(lc);
+       if (devices == NULL) {
+               ms_error("No existing video devices\n");
+               return -1;
+       }
+       int i;
+       for(i=0; i<=id; i++) {
+               if (devices[i] == NULL)
+                       break;
+               ms_message("Existing device %d : %s\n", i, devices[i]);
+               if (i==id) {
+                       return linphone_core_set_video_device(lc, devices[i]);
+               }
+       }
+       return -1;
+}
+
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getVideoDevice(JNIEnv *env,jobject thiz,jlong pCore) {
+       LinphoneCore* lc = (LinphoneCore *) pCore;
+       const char** devices = linphone_core_get_video_devices(lc);
+       if (devices == NULL) {
+               ms_error("No existing video devices\n");
+               return -1;
+       }
+       const char* cam = linphone_core_get_video_device(lc);
+       if (cam == NULL) {
+               ms_error("No current video device\n");
+       } else {
+               int i=0;
+               while(devices[i] != NULL) {
+                       if (strcmp(devices[i], cam) == 0)
+                               return i;
+                       i++;
+               }
+       }
+       ms_warning("Returning default (0) device\n");
+       return 0;
+}
+
 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);
@@ -1396,4 +1458,3 @@ extern "C" void Java_org_linphone_LinphoneManager_hackSpeakerState(JNIEnv*  env,
        msandroid_hack_speaker_state(speakerOn);
 // End Galaxy S hack functions
 }
-