]> sjero.net Git - linphone/commitdiff
Merge branch 'dev_conference'
authorSimon Morlat <simon.morlat@linphone.org>
Fri, 16 Sep 2011 19:51:26 +0000 (21:51 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Fri, 16 Sep 2011 19:51:26 +0000 (21:51 +0200)
Conflicts:
coreapi/linphonecall.c
coreapi/linphonecore.c
java/common/org/linphone/core/LinphoneCall.java
mediastreamer2

1  2 
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc
coreapi/private.h
gtk/main.c
java/common/org/linphone/core/LinphoneCall.java
java/common/org/linphone/core/LinphoneCore.java

index 4cc8e9f9643e78ec57d0663efeba2ef6e0b5c107,085cde9739c51e812e61825ab2b9581df1d0a702..2f5ca46ec4f52723095fccf0db3eac7c66934463
@@@ -953,6 -963,157 +963,159 @@@ static void setup_ring_player(LinphoneC
        ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
  }
  
+ #define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION
+ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){
+       LinphoneCore *lc=call->core;
+       int jitt_comp=lc->rtp_conf.audio_jitt_comp;
+       int used_pt=-1;
+       const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
+                                               SalProtoRtpAvp,SalAudio);
+       
+       if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
+               MSSndCard *playcard=lc->sound_conf.lsd_card ? 
+                       lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
+               MSSndCard *captcard=lc->sound_conf.capt_sndcard;
+               const char *playfile=lc->play_file;
+               const char *recfile=lc->rec_file;
+               call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt);
+               bool_t use_ec;
+               if (used_pt!=-1){
+                       if (playcard==NULL) {
+                               ms_warning("No card defined for playback !");
+                       }
+                       if (captcard==NULL) {
+                               ms_warning("No card defined for capture !");
+                       }
+                       /*Replace soundcard filters by inactive file players or recorders
+                        when placed in recvonly or sendonly mode*/
+                       if (stream->port==0 || stream->dir==SalStreamRecvOnly){
+                               captcard=NULL;
+                               playfile=NULL;
+                       }else if (stream->dir==SalStreamSendOnly){
+                               playcard=NULL;
+                               captcard=NULL;
+                               recfile=NULL;
+                               /*And we will eventually play "playfile" if set by the user*/
+                               /*playfile=NULL;*/
+                       }
+                       if (send_ringbacktone){
+                               captcard=NULL;
+                               playfile=NULL;/* it is setup later*/
+                       }
+                       /*if playfile are supplied don't use soundcards*/
+                       if (lc->use_files) {
+                               captcard=NULL;
+                               playcard=NULL;
+                       }
+                       if (call->params.in_conference){
+                               /* first create the graph without soundcard resources*/
+                               captcard=playcard=NULL;
+                       }
+                       use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc);
+                       audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc);
+                       audio_stream_start_full(
+                               call->audiostream,
+                               call->audio_profile,
+                               stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
+                               stream->port,
+                               stream->port+1,
+                               used_pt,
+                               jitt_comp,
+                               playfile,
+                               recfile,
+                               playcard,
+                               captcard,
+                               use_ec
+                               );
+                       post_configure_audio_streams(call);
+                       if (muted && !send_ringbacktone){
+                               audio_stream_set_mic_gain(call->audiostream,0);
+                       }
+                       if (stream->dir==SalStreamSendOnly && playfile!=NULL){
+                               int pause_time=500;
+                               ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
+                       }
+                       if (send_ringbacktone){
+                               setup_ring_player(lc,call);
+                       }
+                       audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL);
+                       if (call->params.in_conference){
+                               /*transform the graph to connect it to the conference filter */
+                               linphone_call_add_to_conf(call);
+                       }
+               }else ms_warning("No audio stream accepted ?");
+       }       
+ }
+ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){
+ #ifdef VIDEO_ENABLED
+       LinphoneCore *lc=call->core;
+       int used_pt=-1;
+       const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc,
+                                                       SalProtoRtpAvp,SalVideo);
+       /* shutdown preview */
+       if (lc->previewstream!=NULL) {
+               video_preview_stop(lc->previewstream);
+               lc->previewstream=NULL;
+       }
+       call->current_params.has_video=FALSE;
+       if (vstream && vstream->dir!=SalStreamInactive && vstream->port!=0) {
+               const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
+               call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
+               if (used_pt!=-1){
+                       VideoStreamDir dir=VideoStreamSendRecv;
+                       MSWebCam *cam=lc->video_conf.device;
+                       bool_t is_inactive=FALSE;
+                       call->current_params.has_video=TRUE;
+                       
+                       video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
+                       video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
+                       if (lc->video_window_id!=0)
+                               video_stream_set_native_window_id(call->videostream,lc->video_window_id);
+                       if (lc->preview_window_id!=0)
+                               video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
+                       video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
+                       
+                       if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
+                               cam=get_nowebcam_device();
+                               dir=VideoStreamSendOnly;
+                       }else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){
+                               dir=VideoStreamRecvOnly;
+                       }else if (vstream->dir==SalStreamSendRecv){
+                               if (lc->video_conf.display && lc->video_conf.capture)
+                                       dir=VideoStreamSendRecv;
+                               else if (lc->video_conf.display)
+                                       dir=VideoStreamRecvOnly;
+                               else
+                                       dir=VideoStreamSendOnly;
+                       }else{
+                               ms_warning("video stream is inactive.");
+                               /*either inactive or incompatible with local capabilities*/
+                               is_inactive=TRUE;
+                       }
+                       if (call->camera_active==FALSE || all_inputs_muted){
+                               cam=get_nowebcam_device();
+                       }
+                       if (!is_inactive){
+                               video_stream_set_direction (call->videostream, dir);
++                              ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
++                              video_stream_set_device_rotation(call->videostream, lc->device_rotation);
+                               video_stream_start(call->videostream,
+                                       call->video_profile, addr, vstream->port,
+                                       vstream->port+1,
+                                       used_pt, lc->rtp_conf.audio_jitt_comp, cam);
+                               video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL);
+                       }
+               }else ms_warning("No video stream accepted.");
+       }else{
+               ms_warning("No valid video stream defined.");
+       }
+ #endif
+ }
  
  void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){
        LinphoneCore *lc=call->core;
index 417751776ab186f983a3b140a05b7e2f3b94ef05,bf656c810318ae4b9f2846ea9d6a48ceffe2d9d6..4fd1d700d152b2a41bad0f5009a9376252a110c7
@@@ -2093,10 -2092,10 +2092,10 @@@ LinphoneCall * linphone_core_invite_add
        char *real_url=NULL;
        LinphoneProxyConfig *dest_proxy=NULL;
        LinphoneCall *call;
 -      
 +
        if (linphone_core_in_call(lc)){
                if (lc->vtable.display_warning)
-                       lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
+                       lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call or conference first !"));
                return NULL;
        }
        if(!linphone_core_can_we_add_call(lc)){
Simple merge
Simple merge
index 6f51440062acba53b071d70d6223a12e96301e13,47592514fbf7be096a9d479bec00bbd75c8d48c5..2424d68befd6f79873714f914dcd869bd9c97958
@@@ -33,8 -33,9 +33,9 @@@
  #include "config.h"
  #endif
  #include "mediastreamer2/mediastream.h"
+ #include "mediastreamer2/msconference.h"
  
 -#ifndef LIBLINPHONE_VERSION 
 +#ifndef LIBLINPHONE_VERSION
  #define LIBLINPHONE_VERSION LINPHONE_VERSION
  #endif
  
@@@ -447,9 -462,7 +462,8 @@@ struct _LinphoneCor
        bool_t auto_net_state_mon;
        bool_t network_reachable;
        bool_t use_preview_window;
 +      int device_rotation;
        bool_t ringstream_autorelease;
-       char* zrtp_secrets_cache;
  };
  
  bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
diff --cc gtk/main.c
index dd161d70a760a96744281b2663444e022301df8a,ac4e632aa5f86ae74ed7883f72e34e428fc2ee45..fe7824b09ad568f56c7661be87bd442c4604ab77
@@@ -1113,21 -1134,38 +1175,51 @@@ static void linphone_gtk_init_status_ic
        gtk_status_icon_set_visible(icon,TRUE);
        g_object_set_data(G_OBJECT(icon),"menu",menu);
        g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)gtk_widget_destroy,menu);
 -              tout=g_timeout_add(1000,(GSourceFunc)do_icon_blink,icon);
+       g_object_set_data(G_OBJECT(icon),"icon",pbuf);
+       g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)g_object_unref,pbuf);
+       pbuf=create_pixbuf(call_icon_path);
+       g_object_set_data(G_OBJECT(icon),"call_icon",pbuf);
+ }
+ static gboolean do_icon_blink(GtkStatusIcon *gi){
+       GdkPixbuf *call_icon=g_object_get_data(G_OBJECT(gi),"call_icon");
+       GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(gi),"icon");
+       GdkPixbuf *cur_icon=gtk_status_icon_get_pixbuf(gi);
+       if (cur_icon==call_icon){
+               gtk_status_icon_set_from_pixbuf(gi,normal_icon);
+       }else{
+               gtk_status_icon_set_from_pixbuf(gi,call_icon);
+       }
+       return TRUE;
+ }
+ static void linphone_gtk_status_icon_set_blinking(gboolean val){
+       guint tout;
+       tout=(unsigned)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(icon),"timeout"));
+       if (val && tout==0){
++              tout=g_timeout_add(500,(GSourceFunc)do_icon_blink,icon);
+               g_object_set_data(G_OBJECT(icon),"timeout",GINT_TO_POINTER(tout));
+       }else if (!val && tout!=0){
+               GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(icon),"icon");
+               g_source_remove(tout);
+               g_object_set_data(G_OBJECT(icon),"timeout",NULL);
+               gtk_status_icon_set_from_pixbuf(icon,normal_icon);
+       }
  }
  
 +static void init_identity_combo(GtkComboBox *box){
 +      GtkListStore *store;
 +      GtkCellRenderer *r1,*r2;
 +      store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER);
 +      gtk_cell_layout_clear(GTK_CELL_LAYOUT(box));
 +      gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(box),(r1=gtk_cell_renderer_text_new()),TRUE);
 +      gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(box),(r2=gtk_cell_renderer_pixbuf_new()),FALSE);
 +      gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(box),r1,"text",0);
 +      gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(box),r2,"stock-id",1);
 +      g_object_set(G_OBJECT(r1),"ellipsize",PANGO_ELLIPSIZE_END,NULL);
 +      gtk_combo_box_set_model(box,GTK_TREE_MODEL(store));
 +}
 +
  void linphone_gtk_load_identities(void){
        const MSList *elem;
        GtkComboBox *box=GTK_COMBO_BOX(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"identities"));
index 8cf2465077a23e1a232f61e2653635a3e6cdb94c,5f8745979f53cd96c08020758b20833d6b20a838..89d534782fb279e1e0f9f6c499e3e645683dbd3b
@@@ -61,11 -74,11 +74,11 @@@ public interface LinphoneCall 
                /**
                 * Streams running
                 */
-               StreamsRunning(7, "StreamsRunning"),
+               public final static State StreamsRunning = new State(ID_STREAMS_RUNNING,"StreamsRunning");
                /**
 -               * Paussing
 +               * Pausing
                 */
-               Pausing(8, "Pausing"),
+               public final static State Pausing = new State(8,"Pausing");
                /**
                 * Paused
                 */
                /**
                 * The call object is now released.
                 */
-               CallReleased(18,"CallReleased");
+               public static final State CallReleased = new State(18,"CallReleased");
  
-               
-               private final int mValue;
-               private final String mStringValue;
-               private State(int v, String desc) {
-                       this.mValue = v;
-                       this.mStringValue = desc;
+               @SuppressWarnings("unchecked")
+               private State(int value,String stringValue) {
+                       mValue = value;
+                       values.addElement(this);
+                       mStringValue=stringValue;
                }
 +              
                public static State fromInt(int value) {
-                       State[] allStates = State.values();
-                       for (int i=0; i<allStates.length;i++) {
-                               if (allStates[i].mValue == value)
-                                       return allStates[i];
+                       for (int i=0; i<values.size();i++) {
+                               State state = (State) values.elementAt(i);
+                               if (state.mValue == value) return state;
                        }
                        throw new RuntimeException("state not found ["+value+"]");
                }