]> sjero.net Git - linphone/commitdiff
Merge branch 'master' of git.savannah.nongnu.org:/srv/git/linphone
authorJehan Monnier <jehan.monnier@linphone.org>
Fri, 10 Sep 2010 13:14:56 +0000 (15:14 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Fri, 10 Sep 2010 13:14:56 +0000 (15:14 +0200)
Conflicts:
coreapi/linphonecore.h

1  2 
build/android/Android.mk
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCore.java

diff --combined build/android/Android.mk
index 7432a77222fff84be3c4e3b0d60bd16e23b7f2c0,7432a77222fff84be3c4e3b0d60bd16e23b7f2c0..0997d9639d12cc5461a6ade75b82438cc66dd0b7
@@@ -37,7 -37,7 +37,6 @@@ LOCAL_SRC_FILES = 
        authentication.c \
        lpconfig.c \
        chat.c \
--      general_state.c \
        sipsetup.c \
        siplogin.c \
        address.c \
diff --combined coreapi/linphonecore.h
index 075fcf2f0f0cf7acb26f98154e603ecb4978c7f9,707e4b40c190c6abde7acccafb70403a8b3879d0..60714aa7c7322c1c0caceef52dc649283513343d
@@@ -160,7 -160,25 +160,25 @@@ char * linphone_call_log_to_str(Linphon
  **/
  struct _LinphoneCall;
  typedef struct _LinphoneCall LinphoneCall;
- enum _LinphoneCallState;
+ typedef enum _LinphoneCallState{
+       LinphoneCallIdle,
+       LinphoneCallIncomingReceived,
+       LinphoneCallOutgoingInit,
+       LinphoneCallOutgoingProgress,
+       LinphoneCallOutgoingRinging,
+       LinphoneCallOutgoingEarlyMedia,
+       LinphoneCallConnected,
+       LinphoneCallStreamsRunning,
+       LinphoneCallPausing,
+       LinphoneCallPaused,
+       LinphoneCallResuming,
+       LinphoneCallRefered,
+       LinphoneCallError,
+       LinphoneCallEnd,
+       LinphoneCallPausedByRemote
+ } LinphoneCallState;
  
  enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
  bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
@@@ -173,6 -191,7 +191,7 @@@ void linphone_call_unref(LinphoneCall *
  LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
  const char *linphone_call_get_refer_to(const LinphoneCall *call);
  bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
+ int linphone_call_get_duration(const LinphoneCall *call);
  void *linphone_call_get_user_pointer(LinphoneCall *call);
  void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
  
@@@ -365,23 -384,6 +384,6 @@@ void linphone_chat_room_destroy(Linphon
  void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void * ud);
  void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
  
- typedef enum _LinphoneCallState{
-       LinphoneCallIdle,
-       LinphoneCallIncomingReceived,
-       LinphoneCallOutgoingInit,
-       LinphoneCallOutgoingProgress,
-       LinphoneCallOutgoingRinging,
-       LinphoneCallOutgoingEarlyMedia,
-       LinphoneCallConnected,
-       LinphoneCallStreamsRunning,
-       LinphoneCallPausing,
-       LinphoneCallPaused,
-       LinphoneCallResuming,
-       LinphoneCallRefered,
-       LinphoneCallError,
-       LinphoneCallEnd,
- } LinphoneCallState;
  typedef enum _LinphoneGlobalState{
        LinphoneGlobalOff,
        LinphoneGlobalStartup,
@@@ -408,7 -410,7 +410,7 @@@ typedef void (*LinphoneGlobalStateCb)(s
  /**Call state notification callback prototype*/
  typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
  /**Registration state notification callback prototype*/
 -typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneCallState cstate, const char *message);
 +typedef void (*LinphoneRegistrationStateCb)(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
  /** Callback prototype */
  typedef void (*ShowInterfaceCb)(struct _LinphoneCore *lc);
  /** Callback prototype */
@@@ -526,6 -528,8 +528,8 @@@ int linphone_core_terminate_all_calls(L
  
  int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
  
+ int linphone_core_pause_all_calls(LinphoneCore *lc);
  int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
  
  LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
@@@ -760,6 -764,10 +764,10 @@@ const char *linphone_core_get_video_dev
  /* Set static picture to be used when "Static picture" is the video device */
  int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
  
+ /* Set and get frame rate for static picture */
+ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps);
+ float linphone_core_get_static_picture_fps(LinphoneCore *lc);
  /*function to be used for eventually setting window decorations (icons, title...)*/
  unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
  
index 67da96a025d3e2e7fb6c5d029e2c4a9195be4f56,67da96a025d3e2e7fb6c5d029e2c4a9195be4f56..c6a7cd6f67d4f535981ed92fb831c9b2ab82b64d
@@@ -77,16 -77,16 +77,32 @@@ public
                vTable.display_status = displayStatusCb;
                vTable.display_message = displayMessageCb;
                vTable.display_warning = displayMessageCb;
--              vTable.general_state = generalStateChange;
++              vTable.global_state_changed = globalStateChange;
++              vTable.registration_state_changed = registrationState;
++              vTable.call_state_changed = callState;
  
                listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener));
                /*displayStatus(LinphoneCore lc,String message);*/
                displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V");
                /*void generalState(LinphoneCore lc,int state); */
--              generalStateId = env->GetMethodID(listernerClass,"generalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GeneralState;Ljava/lang/String;)V");
++              globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V");
++              globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState"));
++              globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;");
++              /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/
++              registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V");
++              registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState"));
++              registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;");
++              /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/
++              callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
++              callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
++              callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
++
++              proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
++              proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
++
++              callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
++              callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
  
--              generalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GeneralState"));
--              generalStateFromIntId = env->GetStaticMethodID(generalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GeneralState;");
        }
  
        ~LinphoneCoreData() {
        jobject userdata;
  
        jclass listernerClass;
--      jclass generalStateClass;
        jmethodID displayStatusId;
--      jmethodID generalStateId;
--      jmethodID generalStateFromIntId;
++
++      jclass globalStateClass;
++      jmethodID globalStateId;
++      jmethodID globalStateFromIntId;
++
++      jclass registrationStateClass;
++      jmethodID registrationStateId;
++      jmethodID registrationStateFromIntId;
++
++      jclass callStateClass;
++      jmethodID callStateId;
++      jmethodID callStateFromIntId;
++
++      jclass proxyClass;
++      jmethodID proxyCtrId;
++
++      jclass callClass;
++      jmethodID callCtrId;
++
        LinphoneCoreVTable vTable;
  
        static void showInterfaceCb(LinphoneCore *lc) {
        static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username) {
  
        }
--      static void generalStateChange(LinphoneCore *lc, LinphoneGeneralState *gstate) {
++      static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
++              JNIEnv *env = 0;
++              jint result = jvm->AttachCurrentThread(&env,NULL);
++              if (result != 0) {
++                      ms_error("cannot attach VM\n");
++                      return;
++              }
++              LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++              env->CallVoidMethod(lcData->listener
++                                                      ,lcData->globalStateId
++                                                      ,lcData->core
++                                                      ,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,gstate),
++                                                      message ? env->NewStringUTF(message) : NULL);
++      }
++      static void registerStateChange(LinphoneCore *lc, LinphoneProxyConfig proxy,LinphoneRegistrationState state,const char* message) {
                JNIEnv *env = 0;
                jint result = jvm->AttachCurrentThread(&env,NULL);
                if (result != 0) {
                }
                LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
                env->CallVoidMethod(lcData->listener
--                                                      ,lcData->generalStateId
++                                                      ,lcData->registrationStateId
                                                        ,lcData->core
--                                                      ,env->CallStaticObjectMethod(lcData->generalStateClass,lcData->generalStateFromIntId,gstate->new_state),
--                                                      gstate->message ? env->NewStringUTF(gstate->message) : NULL);
++                                                      ,env->NewObject(proxyClass,proxyCtrId,proxy)
++                                                      ,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,state),
++                                                      message ? env->NewStringUTF(message) : NULL);
        }
++      static void callStateChange(LinphoneCore *lc, LinphoneCall call,LinphoneCallState *state,const char* message) {
++              JNIEnv *env = 0;
++              jint result = jvm->AttachCurrentThread(&env,NULL);
++              if (result != 0) {
++                      ms_error("cannot attach VM\n");
++                      return;
++              }
++              LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
++              env->CallVoidMethod(lcData->listener
++                                                      ,lcData->callStateId
++                                                      ,lcData->core
++                                                      ,env->NewObject(callClass,callCtrId,call)
++                                                      ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,state),
++                                                      message ? env->NewStringUTF(message) : NULL);
++      }
++
  
  };
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv*  env
@@@ -232,25 -232,25 +295,27 @@@ extern "C" void Java_org_linphone_core_
                ,jlong lc) {
        linphone_core_iterate((LinphoneCore*)lc);
  }
--extern "C" void Java_org_linphone_core_LinphoneCoreImpl_invite(       JNIEnv*  env
++extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_invite(      JNIEnv*  env
                ,jobject  thiz
                ,jlong lc
                ,jstring juri) {
        const char* uri = env->GetStringUTFChars(juri, NULL);
--      linphone_core_invite((LinphoneCore*)lc,uri);
++      LinphoneCall lCall = linphone_core_invite((LinphoneCore*)lc,uri);
        env->ReleaseStringUTFChars(juri, uri);
++      return (jlong)lCall;
  }
  extern "C" void Java_org_linphone_core_LinphoneCoreImpl_inviteAddress(        JNIEnv*  env
                ,jobject  thiz
                ,jlong lc
                ,jlong to) {
--      linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
++      return (jlong) linphone_core_invite_address((LinphoneCore*)lc,(LinphoneAddress*)to);
  }
  
  extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateCall(        JNIEnv*  env
                ,jobject  thiz
--              ,jlong lc) {
--      linphone_core_terminate_call((LinphoneCore*)lc,NULL);
++              ,jlong lc
++              ,jlong call) {
++      linphone_core_terminate_call((LinphoneCore*)lc,(LinphoneCall*)call);
  }
  
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getRemoteAddress(    JNIEnv*  env
@@@ -272,9 -272,9 +337,10 @@@ extern "C" jboolean Java_org_linphone_c
  }
  extern "C" void Java_org_linphone_core_LinphoneCoreImpl_acceptCall(   JNIEnv*  env
                ,jobject  thiz
--              ,jlong lc) {
++              ,jlong lc
++              ,jlong call) {
  
--      linphone_core_accept_call((LinphoneCore*)lc,NULL);
++      linphone_core_accept_call((LinphoneCore*)lc,(LinphoneCall*)call);
  }
  
  extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog(  JNIEnv*  env
@@@ -477,6 -477,6 +543,7 @@@ extern "C" void Java_org_linphone_core_
        env->ReleaseStringUTFChars(jprefix, prefix);
  }
  
++
  //Auth Info
  
  extern "C" jlong Java_org_linphone_core_LinphoneAuthInfoImpl_newLinphoneAuthInfo(JNIEnv* env
@@@ -612,3 -612,3 +679,43 @@@ extern "C" jstring Java_org_linphone_co
        ms_free(value);
        return jvalue;
  }
++//LinphoneCall
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_ref(JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      linphone_call_ref((LinphoneCall*)ptr);
++}
++
++extern "C" void Java_org_linphone_core_LinphoneCallImpl_unref(JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      linphone_call_unref((LinphoneCall*)ptr);
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog(  JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jlong)linphone_call_get_call_log((LinphoneCall*)ptr);
++}
++
++extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isIncoming(       JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return linphone_call_get_dir((LinphoneCall*)ptr)==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
++}
++
++extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getRemoteAddress(    JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jlong)linphone_call_get_remote_address((LinphoneCall*)ptr);
++}
++
++extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState(     JNIEnv*  env
++                                                                                                                                              ,jobject  thiz
++                                                                                                                                              ,jlong ptr) {
++      return (jint)linphone_call_get_state((LinphoneCall*)ptr);
++}
++
++
++
++
index f32d5cd55bacc48cbae26c607b624a72f048be08,12aa788e4d70203e8ded18d5a140015c3c92366e..d6c7799d9ee48f9f72c0c08c196fd932725c47b5
@@@ -21,31 -21,48 +21,31 @@@ package org.linphone.core
  
  import java.util.Vector;
  
 -
 -
 -
        
  public interface LinphoneCore {
        /*
         * linphone core states
         */
 -      static public class     GeneralState {
 +      static public class     GlobalState {
                static private Vector values = new Vector();
 -              /* states for GSTATE_GROUP_POWER */
 -              static public GeneralState GSTATE_POWER_OFF = new GeneralState(0,"GSTATE_POWER_OFF");        /* initial state */
 -              static public GeneralState GSTATE_POWER_STARTUP = new GeneralState(1,"GSTATE_POWER_STARTUP");
 -              static public GeneralState GSTATE_POWER_ON = new GeneralState(2,"GSTATE_POWER_ON");
 -              static public GeneralState GSTATE_POWER_SHUTDOWN = new GeneralState(3,"GSTATE_POWER_SHUTDOWN");
 -              /* states for GSTATE_GROUP_REG */
 -              static public GeneralState GSTATE_REG_NONE = new GeneralState(10,"GSTATE_REG_NONE");       /* initial state */
 -              static public GeneralState GSTATE_REG_OK  = new GeneralState(11,"GSTATE_REG_OK");
 -              static public GeneralState GSTATE_REG_FAILED = new GeneralState(12,"GSTATE_REG_FAILED");
 -              static public GeneralState GSTATE_REG_PENDING = new GeneralState(13,"GSTATE_REG_PENDING");
 -              /* states for GSTATE_GROUP_CALL */
 -              static public GeneralState GSTATE_CALL_IDLE = new GeneralState(20,"GSTATE_CALL_IDLE");      /* initial state */
 -              static public GeneralState GSTATE_CALL_OUT_INVITE = new GeneralState(21,"GSTATE_CALL_OUT_INVITE");
 -              static public GeneralState GSTATE_CALL_OUT_CONNECTED = new GeneralState(22,"GSTATE_CALL_OUT_CONNECTED");
 -              static public GeneralState GSTATE_CALL_IN_INVITE = new GeneralState(23,"GSTATE_CALL_IN_INVITE");
 -              static public GeneralState GSTATE_CALL_IN_CONNECTED = new GeneralState(24,"GSTATE_CALL_IN_CONNECTED");
 -              static public GeneralState GSTATE_CALL_END = new GeneralState(25,"GSTATE_CALL_END");
 -              static public GeneralState GSTATE_CALL_ERROR = new GeneralState(26,"GSTATE_CALL_ERROR");
 -              static public GeneralState GSTATE_INVALID = new GeneralState(27,"GSTATE_INVALID");
 -              static public GeneralState GSTATE_CALL_OUT_RINGING = new GeneralState(28,"GSTATE_CALL_OUT_RINGING");
 +
 +              static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff");       
 +              static public GlobalState GlobalStartup = new GlobalState(1,"GlobalStartup");
 +              static public GlobalState GlobalOn = new GlobalState(2,"GlobalOn");
 +              static public GlobalState GlobalShutdown = new GlobalState(3,"GlobalShutdown");
 +
                private final int mValue;
                private final String mStringValue;
  
 -              private GeneralState(int value,String stringValue) {
 +              private GlobalState(int value,String stringValue) {
                        mValue = value;
                        values.addElement(this);
                        mStringValue=stringValue;
                }
 -              public static GeneralState fromInt(int value) {
 +              public static GlobalState fromInt(int value) {
  
                        for (int i=0; i<values.size();i++) {
 -                              GeneralState state = (GeneralState) values.elementAt(i);
 +                              GlobalState state = (GlobalState) values.elementAt(i);
                                if (state.mValue == value) return state;
                        }
                        throw new RuntimeException("state not found ["+value+"]");
                        return mStringValue;
                }
        }
 +      static public class     RegistrationState {
 +              static private Vector values = new Vector();
 +              static public RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone");       
 +              static public RegistrationState RegistrationProgress  = new RegistrationState(1,"RegistrationProgress");
 +              static public RegistrationState RegistrationOk = new RegistrationState(2,"RegistrationOk");
 +              static public RegistrationState RegistrationCleared = new RegistrationState(3,"RegistrationCleared");
 +              static public RegistrationState RegistrationFailed = new RegistrationState(4,"RegistrationFailed");
 +              private final int mValue;
 +              private final String mStringValue;
 +
 +              private RegistrationState(int value,String stringValue) {
 +                      mValue = value;
 +                      values.addElement(this);
 +                      mStringValue=stringValue;
 +              }
 +              public static RegistrationState fromInt(int value) {
  
 +                      for (int i=0; i<values.size();i++) {
 +                              RegistrationState state = (RegistrationState) values.elementAt(i);
 +                              if (state.mValue == value) return state;
 +                      }
 +                      throw new RuntimeException("state not found ["+value+"]");
 +              }
 +              public String toString() {
 +                      return mStringValue;
 +              }
 +      }
        static public class Transport {
                public final static Transport udp =new Transport("udp");
                public final static Transport tcp =new Transport("tcp");
         * Starts a call given a destination. Internally calls interpretUrl() then invite(LinphoneAddress).
         * @param uri
         */
 -      public void invite(String destination)throws LinphoneCoreException;
 +      public LinphoneCall invite(String destination)throws LinphoneCoreException;
        
 -      public void invite(LinphoneAddress to)throws LinphoneCoreException;
 +      public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException;
 +      
 +      public void terminateCall(LinphoneCall aCall);
 +      /**
 +       * Returns The LinphoneCall the current call if one is in call
 +       *
 +      **/
 +      public LinphoneCall getCurrentCall();
        
 -      public void terminateCall();
        /**
         * get the remote address in case of in/out call
         * @return null if no call engaged yet
         * this method.
         * @throws LinphoneCoreException 
         */
 -      public void acceptCall() throws LinphoneCoreException;
 +      public void acceptCall(LinphoneCall aCall) throws LinphoneCoreException;
        
        
        /**
        public boolean isEchoCancellationEnabled();
        
        public void setSignalingTransport(Transport aTransport);
+       
+       public void enableSpeaker(boolean value);
+       
+       public boolean isSpeakerEnabled();
  
  }