]> sjero.net Git - linphone/commitdiff
Merge remote-tracking branch 'origin/master' into dev_videoios
authorJehan Monnier <jehan.monnier@linphone.org>
Fri, 16 Sep 2011 09:47:30 +0000 (11:47 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Fri, 16 Sep 2011 09:47:30 +0000 (11:47 +0200)
Conflicts:
coreapi/linphonecore.c
mediastreamer2

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

index 210c2c453817448341c2bb3fb9b58f31688fea59..4cc8e9f9643e78ec57d0663efeba2ef6e0b5c107 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
 linphone
-Copyright (C) 2010  Belledonne Communications SARL 
+Copyright (C) 2010  Belledonne Communications SARL
  (simon.morlat@linphone.org)
 
 This program is free software; you can redistribute it and/or
@@ -165,14 +165,14 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
        LinphoneAddress *addr=linphone_address_new(me);
        const char *username=linphone_address_get_username (addr);
        SalMediaDescription *md=sal_media_description_new();
-       
+
        md->session_id=session_id;
        md->session_ver=session_ver;
        md->nstreams=1;
        strncpy(md->addr,call->localip,sizeof(md->addr));
        strncpy(md->username,username,sizeof(md->username));
        md->bandwidth=linphone_core_get_download_bandwidth(lc);
-       
+
        /*set audio capabilities */
        strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr));
        md->streams[0].port=call->audio_port;
@@ -183,7 +183,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
        pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
        l=ms_list_append(l,pt);
        md->streams[0].payloads=l;
-       
+
 
        if (call->params.has_video){
                md->nstreams++;
@@ -250,7 +250,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
        if (port_offset==-1) return;
        call->audio_port=linphone_core_get_audio_port(call->core)+port_offset;
        call->video_port=linphone_core_get_video_port(call->core)+port_offset;
-       
+
 }
 
 static void discover_mtu(LinphoneCore *lc, const char *remote){
@@ -306,7 +306,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
                sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str);
                ms_free(from_str);
        }
-       
+
        linphone_address_clean(from);
        linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip);
        linphone_call_init_common(call, from, to);
@@ -327,13 +327,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
 
 static void linphone_call_set_terminated(LinphoneCall *call){
        LinphoneCore *lc=call->core;
-       
+
        linphone_core_update_allocated_audio_bandwidth(lc);
 
        call->owns_call_log=FALSE;
        linphone_call_log_completed(call);
-       
-       
+
+
        if (call == lc->current_call){
                ms_message("Resetting the current call");
                lc->current_call=NULL;
@@ -342,10 +342,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
        if (linphone_core_del_call(lc,call) != 0){
                ms_error("Could not remove the call from the list !!!");
        }
-       
+
        if (ms_list_size(lc->calls)==0)
                linphone_core_notify_all_friends(lc,lc->presence_mode);
-       
+
 }
 
 const char *linphone_call_state_to_string(LinphoneCallState cs){
@@ -419,7 +419,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
         if (cstate == LinphoneCallConnected) {
             call->log->status=LinphoneCallSuccess;
         }
-               
+
                if (lc->vtable.call_state_changed)
                        lc->vtable.call_state_changed(lc,call,cstate,message);
                if (cstate==LinphoneCallReleased){
@@ -588,7 +588,7 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
  * executed yet.
  * Pending transfers are executed when this call is being paused or closed,
  * locally or by remote endpoint.
- * If the call is already paused while receiving the transfer request, the 
+ * If the call is already paused while receiving the transfer request, the
  * transfer immediately occurs.
 **/
 bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){
@@ -746,7 +746,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
        LinphoneCore *lc=call->core;
        SalMediaDescription *md=call->localdesc;
        AudioStream *audiostream;
-       
+
        call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc));
        if (linphone_core_echo_limiter_enabled(lc)){
                const char *type=lp_config_get_string(lc->config,"sound","el_type","mic");
@@ -772,7 +772,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
                int enabled=lp_config_get_int(lc->config,"sound","noisegate",0);
                audio_stream_enable_noise_gate(audiostream,enabled);
        }
-       
+
        if (lc->a_rtp)
                rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp);
 
@@ -844,10 +844,10 @@ static void post_configure_audio_streams(LinphoneCall*call){
        float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05);
        float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0);
        int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0);
-       
+
        if (!call->audio_muted)
                audio_stream_set_mic_gain(st,mic_gain);
-       else 
+       else
                audio_stream_set_mic_gain(st,0);
 
        recv_gain = lc->sound_conf.soft_play_lev;
@@ -900,11 +900,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
        LinphoneCore *lc=call->core;
        int up_ptime=0;
        *used_pt=-1;
-       
+
        for(elem=desc->payloads;elem!=NULL;elem=elem->next){
                PayloadType *pt=(PayloadType*)elem->data;
                int number;
-               
+
                if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) {
                        if (desc->type==SalAudio){
                                linphone_core_update_allocated_audio_bandwidth_in_call(call,pt);
@@ -921,8 +921,8 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
                                remote_bw=get_video_bandwidth(remote_bw,call->audio_bw);
                        }
                }
-               
-               if (desc->type==SalAudio){                      
+
+               if (desc->type==SalAudio){
                                bw=get_min_bandwidth(call->audio_bw,remote_bw);
                }else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw);
                if (bw>0) pt->normal_bitrate=bw*1000;
@@ -965,7 +965,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                                                        SalProtoRtpAvp,SalVideo);
 #endif
        bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc);
-       
+
        if(call->audiostream == NULL)
        {
                ms_fatal("start_media_stream() called without prior init !");
@@ -982,7 +982,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                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 ? 
+                       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;
@@ -1061,7 +1061,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
        }
 #ifdef VIDEO_ENABLED
        {
-               
+
                used_pt=-1;
                /* shutdown preview */
                if (lc->previewstream!=NULL) {
@@ -1078,7 +1078,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                                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)
@@ -1086,7 +1086,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                                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;
@@ -1109,6 +1109,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
                                }
                                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,
@@ -1124,7 +1126,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
        call->all_muted=all_inputs_muted;
        call->playing_ringbacktone=send_ringbacktone;
        call->up_bw=linphone_core_get_upload_bandwidth(lc);
-       
+
        if (ortp_zrtp_available()) {
                OrtpZrtpParams params;
                params.zid=get_hexa_zrtp_identifier(lc);
@@ -1172,7 +1174,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
                call->videostream=NULL;
        }
        ms_event_queue_skip(call->core->msevq);
-       
+
 #endif
        if (call->audio_profile){
                rtp_profile_clear_all(call->audio_profile);
@@ -1229,11 +1231,11 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){
 /**
  * @addtogroup call_misc
  * @{
-**/ 
+**/
 
 /**
  * Returns the measured sound volume played locally (received from remote)
- * It is expressed in dbm0. 
+ * It is expressed in dbm0.
 **/
 float linphone_call_get_play_volume(LinphoneCall *call){
        AudioStream *st=call->audiostream;
@@ -1241,14 +1243,14 @@ float linphone_call_get_play_volume(LinphoneCall *call){
                float vol=0;
                ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol);
                return vol;
-               
+
        }
        return LINPHONE_VOLUME_DB_LOWEST;
 }
 
 /**
  * Returns the measured sound volume recorded locally (sent to remote)
- * It is expressed in dbm0. 
+ * It is expressed in dbm0.
 **/
 float linphone_call_get_record_volume(LinphoneCall *call){
        AudioStream *st=call->audiostream;
@@ -1256,7 +1258,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
                float vol=0;
                ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&vol);
                return vol;
-               
+
        }
        return LINPHONE_VOLUME_DB_LOWEST;
 }
@@ -1275,7 +1277,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
  * 1-2 = very poor quality <br>
  * 0-1 = can't be worse, mostly unusable <br>
  *
- * @returns The function returns -1 if no quality measurement is available, for example if no 
+ * @returns The function returns -1 if no quality measurement is available, for example if no
  * active audio stream exist. Otherwise it returns the quality rating.
 **/
 float linphone_call_get_current_quality(LinphoneCall *call){
@@ -1318,7 +1320,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
        {
                snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
                free(from);
-       }               
+       }
        else
        {
                snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
@@ -1331,7 +1333,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
 void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){
        int disconnect_timeout = linphone_core_get_nortp_timeout(call->core);
        bool_t disconnected=FALSE;
-       
+
        if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){
                RtpSession *as=NULL,*vs=NULL;
                float audio_load=0, video_load=0;
@@ -1395,9 +1397,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
 
 void linphone_call_log_completed(LinphoneCall *call){
        LinphoneCore *lc=call->core;
-       
+
        call->log->duration=time(NULL)-call->start_time;
-       
+
        if (call->log->status==LinphoneCallMissed){
                char *info;
                lc->missed_calls++;
@@ -1424,5 +1426,3 @@ void linphone_call_log_completed(LinphoneCall *call){
        }
        call_logs_write_to_config_file(lc);
 }
-
-
index e442f0126b9e3754e897aeb4ddc8cb506a58672c..417751776ab186f983a3b140a05b7e2f3b94ef05 100644 (file)
@@ -67,7 +67,7 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
        return 0;
 }
 
-               
+
 /*prevent a gcc bug with %c*/
 static size_t my_strftime(char *s, size_t max, const char  *fmt,  const struct tm *tm){
 #if !defined(_WIN32_WCE)
@@ -109,7 +109,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
        LpConfig *cfg=lc->config;
 
        if (linphone_core_get_global_state (lc)==LinphoneGlobalStartup) return;
-       
+
        for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
                LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
                snprintf(logsection,sizeof(logsection),"call_log_%i",i);
@@ -154,7 +154,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
                        if (tmp) cl->refkey=ms_strdup(tmp);
                        cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
                        lc->call_logs=ms_list_append(lc->call_logs,cl);
-               }else break;    
+               }else break;
        }
 }
 
@@ -167,7 +167,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
 
 /**
  * Returns a human readable string describing the call.
- * 
+ *
  * @note: the returned char* must be freed by the application (use ms_free()).
 **/
 char * linphone_call_log_to_str(LinphoneCallLog *cl){
@@ -203,7 +203,7 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
 
 /**
  * Returns RTP statistics computed locally regarding the call.
- * 
+ *
 **/
 const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl){
        return &cl->local_stats;
@@ -293,7 +293,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
  * @ingroup misc
  *
  * @param file a C FILE* where to fprintf logs. If null stdout is used.
- * 
+ *
 **/
 void linphone_core_enable_logs(FILE *file){
        if (file==NULL) file=stdout;
@@ -308,7 +308,7 @@ void linphone_core_enable_logs(FILE *file){
  *
  * @param logfunc The address of a OrtpLogFunc callback whose protoype is
  *               typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
- * 
+ *
 **/
 void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
        ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
@@ -433,7 +433,7 @@ static void sound_config_read(LinphoneCore *lc)
        lc->sound_conf.latency=0;
 #if !defined(TARGET_OS_IPHONE) && !defined(ANDROID)
     tmp=TRUE;
-#else 
+#else
     tmp=FALSE;
 #endif
     tmp=lp_config_get_int(lc->config,"sound","echocancellation",tmp);
@@ -546,7 +546,7 @@ static void sip_config_read(LinphoneCore *lc)
                        break;
                }
        }
-       
+
        /*for tuning or test*/
        lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
        lc->sip_conf.register_only_when_network_is_up=
@@ -581,7 +581,7 @@ static void rtp_config_read(LinphoneCore *lc)
        nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30);
        linphone_core_set_nortp_timeout(lc,nortp_timeout);
        rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE);
-       linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);      
+       linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);
 }
 
 static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){
@@ -673,7 +673,7 @@ static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){
                if (pt){
                        if (mtype==SalVideo && pt->type!=PAYLOAD_VIDEO)
                                pt=NULL;
-                       else if (mtype==SalAudio && (pt->type!=PAYLOAD_AUDIO_PACKETIZED 
+                       else if (mtype==SalAudio && (pt->type!=PAYLOAD_AUDIO_PACKETIZED
                            && pt->type!=PAYLOAD_AUDIO_CONTINUOUS)){
                                pt=NULL;
                        }
@@ -963,13 +963,13 @@ static void misc_config_read (LinphoneCore *lc) {
     lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
 }
 
-static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, 
+static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
     const char *factory_config_path, void * userdata)
 {
        memset (lc, 0, sizeof (LinphoneCore));
        lc->data=userdata;
        lc->ringstream_autorelease=TRUE;
-       
+
        memcpy(&lc->vtable,vtable,sizeof(LinphoneCoreVTable));
 
        linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
@@ -1041,7 +1041,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
        lc->sal=sal_init();
        sal_set_user_pointer(lc->sal,lc);
        sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
-       
+
        sip_setup_register_all();
        sound_config_read(lc);
        net_config_read(lc);
@@ -1062,7 +1062,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
 /**
  * Instanciates a LinphoneCore object.
  * @ingroup initializing
- * 
+ *
  * The LinphoneCore object is the primary handle for doing all phone actions.
  * It should be unique within your application.
  * @param vtable a LinphoneCoreVTable structure holding your application callbacks
@@ -1070,13 +1070,13 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
  *        The config file is used to store all settings, call logs, friends, proxies... so that all these settings
  *            become persistent over the life of the LinphoneCore object.
  *            It is allowed to set a NULL config file. In that case LinphoneCore will not store any settings.
- * @param factory_config_path a path to a read-only config file that can be used to 
+ * @param factory_config_path a path to a read-only config file that can be used to
  *        to store hard-coded preference such as proxy settings or internal preferences.
  *        The settings in this factory file always override the one in the normal config file.
  *        It is OPTIONAL, use NULL if unneeded.
  * @param userdata an opaque user pointer that can be retrieved at any time (for example in
  *        callbacks) using linphone_core_get_user_data().
- * 
+ *
 **/
 LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
                                                const char *config_path, const char *factory_config_path, void * userdata)
@@ -1185,7 +1185,7 @@ static void update_primary_contact(LinphoneCore *lc){
 **/
 const char *linphone_core_get_primary_contact(LinphoneCore *lc){
        char *identity;
-       
+
        if (lc->sip_conf.guess_hostname){
                if (lc->sip_conf.guessed_contact==NULL || lc->sip_conf.loopback_only){
                        update_primary_contact(lc);
@@ -1340,7 +1340,7 @@ void linphone_core_set_video_port(LinphoneCore *lc, int port){
 
 /**
  * Sets the no-rtp timeout value in seconds.
- * 
+ *
  * @ingroup media_parameters
  * See linphone_core_get_nortp_timeout() for details.
 **/
@@ -1485,11 +1485,11 @@ static int apply_transports(LinphoneCore *lc){
  * @ingroup network_parameters
 **/
 int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * tr){
-       
+
        if (transports_unchanged(tr,&lc->sip_conf.transports))
                return 0;
        memcpy(&lc->sip_conf.transports,tr,sizeof(*tr));
-       
+
        if (lc->sal==NULL) return 0;
        return apply_transports(lc);
 }
@@ -1704,7 +1704,7 @@ void linphone_core_iterate(LinphoneCore *lc){
                lc_callback_obj_invoke(&lc->preview_finished_cb,lc);
        }
 
-       if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0 
+       if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
            && (curtime-lc->dmfs_playing_start_time)>5){
                ring_stop(lc->ringstream);
                lc->ringstream=NULL;
@@ -1776,7 +1776,7 @@ void linphone_core_iterate(LinphoneCore *lc){
  *   configuration, eventually escape the '+' by 00.
  * - if no domain part is supplied, append the domain name of the default proxy
  * - if no sip: is present, prepend it
- * 
+ *
  * The result is a syntaxically correct SIP address.
 **/
 
@@ -1786,7 +1786,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
        LinphoneProxyConfig *proxy=lc->default_proxy;;
        char *tmpurl;
        LinphoneAddress *uri;
-       
+
        if (is_enum(url,&enum_domain)){
                if (lc->vtable.display_status!=NULL)
                        lc->vtable.display_status(lc,_("Looking for telephone number destination..."));
@@ -1814,7 +1814,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
                                return uri;
                        }
                }
-               
+
                if (proxy!=NULL){
                        /* append the proxy domain suffix */
                        const char *identity=linphone_proxy_config_get_identity(proxy);
@@ -1940,9 +1940,9 @@ static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphonePr
                        return ms_strdup(fixed_contact);
                }
        }
-       
+
        ctt=linphone_core_get_primary_contact_parsed(lc);
-       
+
        if (ctt!=NULL){
                char *ret;
                /*otherwise use supllied localip*/
@@ -1961,17 +1961,17 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
        char *contact;
        char *real_url,*barmsg;
        char *from;
-       
+
        /*try to be best-effort in giving real local or routable contact address */
        contact=get_fixed_contact(lc,call,dest_proxy);
        if (contact){
                sal_op_set_contact(call->op, contact);
                ms_free(contact);
        }
-       
+
        //TODO : should probably not be done here
        linphone_call_init_media_streams(call);
-       if (!lc->sip_conf.sdp_200_ack){ 
+       if (!lc->sip_conf.sdp_200_ack){
                call->media_pending=TRUE;
                sal_call_set_local_media_description(call->op,call->localdesc);
        }
@@ -1987,7 +1987,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
        if (lc->vtable.display_status!=NULL)
                lc->vtable.display_status(lc,barmsg);
        ms_free(barmsg);
-       
+
        if (err<0){
                if (lc->vtable.display_status!=NULL)
                        lc->vtable.display_status(lc,_("Could not call"));
@@ -2052,7 +2052,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur
  * @ingroup call_control
  * @param lc the LinphoneCore object
  * @param addr the destination of the call (sip address).
- * 
+ *
  * The LinphoneAddress can be constructed directly using linphone_address_new(), or
  * created by linphone_core_interpret_url().
  * The application doesn't own a reference to the returned LinphoneCall object.
@@ -2076,7 +2076,7 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
  * @param lc the LinphoneCore object
  * @param addr the destination of the call (sip address).
        @param params call parameters
- * 
+ *
  * The LinphoneAddress can be constructed directly using linphone_address_new(), or
  * created by linphone_core_interpret_url().
  * The application doesn't own a reference to the returned LinphoneCall object.
@@ -2093,7 +2093,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
        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 !"));
@@ -2106,7 +2106,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
        }
        linphone_core_get_default_proxy(lc,&proxy);
        route=linphone_core_get_route(lc);
-       
+
        real_url=linphone_address_as_string(addr);
        dest_proxy=linphone_core_lookup_known_proxy(lc,addr);
 
@@ -2127,7 +2127,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
 
        call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params);
        sal_op_set_route(call->op,route);
-       
+
        if(linphone_core_add_call(lc,call)!= 0)
        {
                ms_warning("we had a problem in adding the call into the invite ... weird");
@@ -2146,7 +2146,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
                sal_op_set_user_pointer(call->ping_op,call);
                call->start_time=time(NULL);
        }
-       
+
        if (real_url!=NULL) ms_free(real_url);
        return call;
 }
@@ -2252,7 +2252,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
  * this method.
  * @param lc the LinphoneCore object
  * @param call the LinphoneCall object representing the call to be answered.
- * 
+ *
 **/
 int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
 {
@@ -2260,7 +2260,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
        const char *contact=NULL;
        SalOp *replaced;
        SalMediaDescription *new_md;
-       
+
        if (call==NULL){
                //if just one call is present answer the only one ...
                if(linphone_core_get_calls_nb (lc) != 1)
@@ -2273,7 +2273,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
                /*call already accepted*/
                return -1;
        }
-       
+
        /* check if this call is supposed to replace an already running one*/
        replaced=sal_call_get_replaces(call->op);
        if (replaced){
@@ -2289,7 +2289,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
                ms_warning("Cannot accept this call, there is already one running.");
                return -1;
        }
-       
+
        /*can accept a new call only if others are on hold */
        {
                MSList *elem;
@@ -2309,7 +2309,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
                ms_message("ring stopped");
                lc->ringstream=NULL;
        }
-       
+
        linphone_core_get_default_proxy(lc,&cfg);
        dest_proxy=cfg;
        dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to);
@@ -2325,7 +2325,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
 
        if (call->audiostream==NULL)
                linphone_call_init_media_streams(call);
-       
+
        sal_call_accept(call->op);
        if (lc->vtable.display_status!=NULL)
                lc->vtable.display_status(lc,_("Connected."));
@@ -2336,7 +2336,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
        if (new_md){
                linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
        }else call->media_pending=TRUE;
-       
+
        ms_message("call answered.");
        return 0;
 }
@@ -2409,7 +2409,7 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
        }
        sal_call_terminate(call->op);
        terminate_call(lc,call);
-       
+
        linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
        return 0;
 }
@@ -2526,7 +2526,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
 {
        char temp[255]={0};
        LinphoneCall *call = the_call;
-       
+
        if(call->state!=LinphoneCallPaused ){
                ms_warning("we cannot resume a call that has not been established and paused before");
                return -1;
@@ -2544,7 +2544,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
        }
        linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
        snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
-       if (lc->vtable.display_status) 
+       if (lc->vtable.display_status)
                lc->vtable.display_status(lc,temp);
        return 0;
 }
@@ -2582,7 +2582,7 @@ int linphone_core_send_publish(LinphoneCore *lc,
  * Set the incoming call timeout in seconds.
  *
  * @ingroup call_control
- * If an incoming call isn't answered for this timeout period, it is 
+ * If an incoming call isn't answered for this timeout period, it is
  * automatically declined.
 **/
 void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds){
@@ -2604,7 +2604,7 @@ void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,
                                                                                                        LinphoneOnlineStatus presence_mode)
 {
        if (minutes_away>0) lc->minutes_away=minutes_away;
-       
+
        if (lc->alt_contact!=NULL) {
                ms_free(lc->alt_contact);
                lc->alt_contact=NULL;
@@ -3033,7 +3033,7 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
        }
        if (call->audiostream!=NULL){
                audio_stream_set_mic_gain(call->audiostream,
-                       (val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1)); 
+                       (val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1));
                if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
                        audio_stream_mute_rtp(call->audiostream,val);
                }
@@ -3051,7 +3051,7 @@ bool_t linphone_core_is_mic_muted(LinphoneCore *lc) {
 }
 
 // returns rtp transmission status for an active stream
-// if audio is muted and config parameter rtp_no_xmit_on_audio_mute 
+// if audio is muted and config parameter rtp_no_xmit_on_audio_mute
 // was set on then rtp transmission is also muted
 bool_t linphone_core_is_rtp_muted(LinphoneCore *lc){
        LinphoneCall *call=linphone_core_get_current_call(lc);
@@ -3163,8 +3163,8 @@ const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc)
                ipstring, sizeof(ipstring), NULL, 0, NI_NUMERICHOST);
        if (error) {
                return lc->net_conf.nat_address;
-       } 
-       
+       }
+
        if (lc->net_conf.nat_address_ip!=NULL){
                ms_free(lc->net_conf.nat_address_ip);
        }
@@ -3392,7 +3392,7 @@ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps) {
        VideoStream *vs = NULL;
 
        vs=get_active_video_stream(lc);
-       
+
        /* If we have a video stream (either preview, either from call), we
                 have a source and it is using the static picture filter, then
                 force the filter to use that picture. */
@@ -3416,9 +3416,9 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc) {
                 force the filter to use that picture. */
        if (vs && vs->source) {
                if (ms_filter_get_id(vs->source) == MS_STATIC_IMAGE_ID) {
-                 
+
                        float fps;
-                 
+
                        ms_filter_call_method(vs->source, MS_FILTER_GET_FPS,(void *)&fps);
                        return fps;
                }
@@ -3481,8 +3481,8 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc)
  * If not set the core will create its own window.
 **/
 void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){
-#ifdef VIDEO_ENABLED
        lc->preview_window_id=id;
+#ifdef VIDEO_ENABLED
        LinphoneCall *call=linphone_core_get_current_call(lc);
        if (call!=NULL && call->videostream){
                video_stream_set_native_preview_window_id(call->videostream,id);
@@ -3499,6 +3499,24 @@ void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno){
        lc->use_preview_window=yesno;
 }
 
+/**
+ * Tells the core the device current orientation. This can be used by capture filters
+ * on mobile devices to select between portrait/landscape mode and to produce properly
+ * orientated images. The exact meaning of the value in rotation if left to each device
+ * specific implementations.
+ *
+**/
+void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation) {
+ms_message("%s : rotation=%d\n", __FUNCTION__, rotation);
+       lc->device_rotation = rotation;
+#ifdef VIDEO_ENABLED
+       LinphoneCall *call=linphone_core_get_current_call(lc);
+       if (call!=NULL && call->videostream){
+               video_stream_set_device_rotation(call->videostream,rotation);
+       }
+#endif
+}
+
 static MSVideoSizeDef supported_resolutions[]={
 #ifdef ENABLE_HD
        {       {MS_VIDEO_SIZE_1080P_W,MS_VIDEO_SIZE_1080P_H}   ,       "1080p" },
@@ -3606,7 +3624,7 @@ void linphone_core_use_files(LinphoneCore *lc, bool_t yesno){
 /**
  * Sets a wav file to be played when putting somebody on hold,
  * or when files are used instead of soundcards (see linphone_core_use_files()).
- * 
+ *
  * The file must be a 16 bit linear wav file.
 **/
 void linphone_core_set_play_file(LinphoneCore *lc, const char *file){
@@ -3626,7 +3644,7 @@ void linphone_core_set_play_file(LinphoneCore *lc, const char *file){
 /**
  * Sets a wav file where incoming stream is to be recorded,
  * when files are used instead of soundcards (see linphone_core_use_files()).
- * 
+ *
  * The file must be a 16 bit linear wav file.
 **/
 void linphone_core_set_record_file(LinphoneCore *lc, const char *file){
@@ -3769,7 +3787,7 @@ void linphone_core_set_video_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp
  *
  * @returns 0 or -1 if no call is running.
 **/
+
 int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote){
        LinphoneCall *call=linphone_core_get_current_call (lc);
        if (call!=NULL){
@@ -3800,7 +3818,7 @@ void net_config_uninit(LinphoneCore *lc)
                ms_free(lc->net_conf.nat_address_ip);
        }
        lp_config_set_int(lc->config,"net","firewall_policy",config->firewall_policy);
-       lp_config_set_int(lc->config,"net","mtu",config->mtu);  
+       lp_config_set_int(lc->config,"net","mtu",config->mtu);
 }
 
 
@@ -3822,7 +3840,7 @@ void sip_config_uninit(LinphoneCore *lc)
 
 
        lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
-       
+
        for(elem=config->proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
                LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
                linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
@@ -3843,7 +3861,7 @@ void sip_config_uninit(LinphoneCore *lc)
        ms_list_for_each(config->proxies,(void (*)(void*)) linphone_proxy_config_destroy);
        ms_list_free(config->proxies);
        config->proxies=NULL;
-       
+
        linphone_proxy_config_write_to_config_file(lc->config,NULL,i);  /*mark the end */
 
        for(elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
@@ -3854,7 +3872,7 @@ void sip_config_uninit(LinphoneCore *lc)
        ms_list_for_each(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
        ms_list_free(lc->auth_info);
        lc->auth_info=NULL;
-       
+
        sal_uninit(lc->sal);
        lc->sal=NULL;
 
@@ -3862,7 +3880,7 @@ void sip_config_uninit(LinphoneCore *lc)
                ms_free(lc->sip_conf.guessed_contact);
        if (config->contact)
                ms_free(config->contact);
-       
+
 }
 
 void rtp_config_uninit(LinphoneCore *lc)
@@ -3916,7 +3934,7 @@ void codecs_config_uninit(LinphoneCore *lc)
        }
        sprintf(key,"audio_codec_%i",index);
        lp_config_clean_section (lc->config,key);
-       
+
        index=0;
        for(node=config->video_codecs;node!=NULL;node=ms_list_next(node)){
                pt=(PayloadType*)(node->data);
@@ -3929,7 +3947,7 @@ void codecs_config_uninit(LinphoneCore *lc)
        }
        sprintf(key,"video_codec_%i",index);
        lp_config_clean_section (lc->config,key);
-       
+
        ms_list_free(lc->codecs_conf.audio_codecs);
        ms_list_free(lc->codecs_conf.video_codecs);
 }
@@ -3947,9 +3965,9 @@ void ui_config_uninit(LinphoneCore* lc)
  * Returns the LpConfig object used to manage the storage (config) file.
  *
  * @ingroup misc
- * The application can use the LpConfig object to insert its own private 
+ * The application can use the LpConfig object to insert its own private
  * sections and pairs of key=value in the configuration file.
- * 
+ *
 **/
 LpConfig *linphone_core_get_config(LinphoneCore *lc){
        return lc->config;
@@ -4096,9 +4114,9 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
 {
        MSList *it;
        MSList *the_calls = lc->calls;
-       
+
        it=ms_list_find(the_calls,call);
-       if (it) 
+       if (it)
        {
                the_calls = ms_list_remove_link(the_calls,it);
        }
@@ -4222,7 +4240,7 @@ void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
 bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc) {
        return sal_get_keepalive_period(lc->sal) > 0;
 }
-       
+
 void linphone_core_start_dtmf_stream(LinphoneCore* lc) {
        get_dtmf_gen(lc); /*make sure ring stream is started*/
        lc->ringstream_autorelease=FALSE; /*disable autorelease mode*/
index 010b158514fd2e7f41bde5fc9eb4642db4476f9f..21335bcfed4db6ad820a8f58e74675f6fe715882 100644 (file)
@@ -68,7 +68,7 @@ typedef struct _LCSipTransports LCSipTransports;
  * The LinphoneAddress has methods to extract and manipulate all parts of the address.
  * When some part of the address (for example the username) is empty, the accessor methods
  * return NULL.
- * 
+ *
  * @ingroup linphone_address
  * @var LinphoneAddress
  */
@@ -128,7 +128,7 @@ typedef enum _LinphoneCallDir LinphoneCallDir;
  * Enum representing the status of a call
  * @ingroup call_logs
 **/
-typedef enum _LinphoneCallStatus { 
+typedef enum _LinphoneCallStatus {
        LinphoneCallSuccess, /**< The call was sucessful*/
        LinphoneCallAborted, /**< The call was aborted */
        LinphoneCallMissed, /**< The call was missed (unanswered)*/
@@ -139,7 +139,7 @@ typedef enum _LinphoneCallStatus {
  * Structure representing a call log.
  *
  * @ingroup call_logs
- * 
+ *
 **/
 typedef struct _LinphoneCallLog{
        LinphoneCallDir dir; /**< The direction of the call*/
@@ -170,7 +170,7 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl);
 
 /**
  * The LinphoneCallParams is an object containing various call related parameters.
- * It can be used to retrieve parameters from a currently running call or modify the call's characteristics 
+ * It can be used to retrieve parameters from a currently running call or modify the call's characteristics
  * dynamically.
 **/
 struct _LinphoneCallParams;
@@ -430,15 +430,15 @@ struct _LinphoneAuthInfo;
  * different SIP domains.
  *
  * Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in
- * order to become known and used automatically when needed. 
+ * order to become known and used automatically when needed.
  * Use linphone_core_add_auth_info() for that purpose.
  *
  * The LinphoneCore object can take the initiative to request authentication information
  * when needed to the application through the auth_info_requested callback of the
  * LinphoneCoreVTable structure.
  *
- * The application can respond to this information request later using 
- * linphone_core_add_auth_info(). This will unblock all pending authentication 
+ * The application can respond to this information request later using
+ * linphone_core_add_auth_info(). This will unblock all pending authentication
  * transactions and retry them with authentication headers.
  *
 **/
@@ -833,7 +833,7 @@ const char * linphone_core_get_relay_addr(const LinphoneCore *lc);
 int linphone_core_set_relay_addr(LinphoneCore *lc, const char *addr);
 
 /* sound functions */
-/* returns a null terminated static array of string describing the sound devices */ 
+/* returns a null terminated static array of string describing the sound devices */
 const char**  linphone_core_get_sound_devices(LinphoneCore *lc);
 bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *device);
 bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *device);
@@ -914,7 +914,7 @@ void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
 bool_t linphone_core_self_view_enabled(const LinphoneCore *lc);
 
 
-/* returns a null terminated static array of string describing the webcams */ 
+/* returns a null terminated static array of string describing the webcams */
 const char**  linphone_core_get_video_devices(const LinphoneCore *lc);
 int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
 const char *linphone_core_get_video_device(const LinphoneCore *lc);
@@ -934,6 +934,7 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc)
 void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id);
 
 void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno);
+void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation);
 
 /*play/record support: use files instead of soundcard*/
 void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
@@ -1011,7 +1012,7 @@ LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
  * force registration refresh to be initiated upon next iterate
  * @ingroup proxies
  */
-void linphone_core_refresh_registers(LinphoneCore* lc);        
+void linphone_core_refresh_registers(LinphoneCore* lc);
 
 
 void linphone_call_send_vfu_request(LinphoneCall *call);
index 7ce1959ffd915d1d9fc5c14585355181fab01153..5d82d099b4a9e8cb00a56cc7c8132e5503b07b01 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);
@@ -1213,6 +1230,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);
 }
@@ -1267,7 +1288,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);
@@ -1289,7 +1310,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
 }
 
@@ -1334,6 +1355,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);
@@ -1356,4 +1418,3 @@ extern "C" void Java_org_linphone_LinphoneManager_hackSpeakerState(JNIEnv*  env,
        msandroid_hack_speaker_state(speakerOn);
 // End Galaxy S hack functions
 }
-
index f22a5b2072776edf9d465ca1f19743a147143a45..e47023f4ffc94b93e4b7f675ec5c1b956071d670 100644 (file)
@@ -215,7 +215,7 @@ bool_t lsd_player_loop_enabled(const LsdPlayer *p){
 void lsd_player_set_gain(LsdPlayer *p, float gain){
        MSAudioMixerCtl gainctl;
        gainctl.pin=p->mixer_pin;
-       gainctl.gain=gain;
+       gainctl.param.gain=gain;
        ms_filter_call_method(p->lsd->mixer,MS_AUDIO_MIXER_SET_INPUT_GAIN,&gainctl);
 }
 
index 373079885d994194671bbee8638d6fa771c892fa..6f51440062acba53b071d70d6223a12e96301e13 100644 (file)
@@ -21,7 +21,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+
 #ifndef _PRIVATE_H
 #define _PRIVATE_H
 
 #endif
 #include "mediastreamer2/mediastream.h"
 
-#ifndef LIBLINPHONE_VERSION 
+#ifndef LIBLINPHONE_VERSION
 #define LIBLINPHONE_VERSION LINPHONE_VERSION
 #endif
 
-#ifndef PACKAGE_SOUND_DIR 
+#ifndef PACKAGE_SOUND_DIR
 #define PACKAGE_SOUND_DIR "."
 #endif
 
@@ -247,7 +247,7 @@ struct _LinphoneProxyConfig
        LinphoneReason error;
 };
 
-struct _LinphoneAuthInfo 
+struct _LinphoneAuthInfo
 {
        char *username;
        char *realm;
@@ -280,7 +280,7 @@ struct _LinphoneFriend{
        bool_t subscribe_active;
        bool_t inc_subscribe_pending;
        bool_t commit;
-};     
+};
 
 
 typedef struct sip_config
@@ -310,7 +310,7 @@ typedef struct rtp_config
        int audio_jitt_comp;  /*jitter compensation*/
        int video_jitt_comp;  /*jitter compensation*/
        int nortp_timeout;
-       bool_t rtp_no_xmit_on_audio_mute;                              
+       bool_t rtp_no_xmit_on_audio_mute;
                               /* stop rtp xmit when audio muted */
 }rtp_config_t;
 
@@ -447,6 +447,7 @@ struct _LinphoneCore
        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;
 };
index e8313628f532a208b765b59c4fc0f4c3c0801101..dd161d70a760a96744281b2663444e022301df8a 100644 (file)
@@ -981,6 +981,46 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
        linphone_gtk_update_call_buttons (call);
 }
 
+static void update_registration_status(LinphoneProxyConfig *cfg, LinphoneRegistrationState rs){
+       GtkComboBox *box=GTK_COMBO_BOX(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"identities"));
+       GtkTreeModel *model=gtk_combo_box_get_model(box);
+       GtkTreeIter iter;
+       gboolean found=FALSE;
+       const char *stock_id=NULL;
+       
+       if (gtk_tree_model_get_iter_first(model,&iter)){
+               gpointer p;
+               do{
+                       gtk_tree_model_get(model,&iter,2,&p,-1);
+                       if (p==cfg) {
+                               found=TRUE;
+                               break;
+                       }
+               }while(gtk_tree_model_iter_next(model,&iter));
+       }
+       if (!found) {
+               g_warning("Could not find proxy config in combo box of identities.");
+               return;
+       }
+       switch (rs){
+               case LinphoneRegistrationOk:
+                       stock_id=GTK_STOCK_YES;
+               break;
+               case LinphoneRegistrationProgress:
+                       stock_id=GTK_STOCK_REFRESH;
+               break;
+               case LinphoneRegistrationCleared:
+                       stock_id=NULL;
+               break;
+               case LinphoneRegistrationFailed:
+                       stock_id=GTK_STOCK_DIALOG_WARNING;
+               break;
+               default:
+               break;
+       }
+       gtk_list_store_set(GTK_LIST_STORE(model),&iter,1,stock_id,-1);
+}
+
 static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, 
                                                     LinphoneRegistrationState rs, const char *msg){
        switch (rs){
@@ -995,6 +1035,7 @@ static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphonePr
                default:
                break;
        }
+       update_registration_status(cfg,rs);
 }
 
 
@@ -1074,6 +1115,19 @@ static void linphone_gtk_init_status_icon(){
        g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)gtk_widget_destroy,menu);
 }
 
+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"));
@@ -1081,19 +1135,28 @@ void linphone_gtk_load_identities(void){
        LinphoneProxyConfig *def=NULL;
        int def_index=0,i;
        GtkListStore *store;
+       GtkTreeIter iter;
 
        store=GTK_LIST_STORE(gtk_combo_box_get_model(box));
+       if (gtk_tree_model_get_n_columns(GTK_TREE_MODEL(store))==1){
+               /* model is empty, this is the first time we go here */
+               init_identity_combo(box);
+               store=GTK_LIST_STORE(gtk_combo_box_get_model(box));
+       }
        gtk_list_store_clear(store);
-
        linphone_core_get_default_proxy(linphone_gtk_get_core(),&def);
        def_identity=g_strdup_printf(_("%s (Default)"),linphone_core_get_primary_contact(linphone_gtk_get_core()));
-       gtk_combo_box_append_text(box,def_identity);
+       gtk_list_store_append(store,&iter);
+       gtk_list_store_set(store,&iter,0,def_identity,1,NULL,2,NULL,-1);
        g_free(def_identity);
        for(i=1,elem=linphone_core_get_proxy_config_list(linphone_gtk_get_core());
                        elem!=NULL;
                        elem=ms_list_next(elem),i++){
                LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
-               gtk_combo_box_append_text(box,linphone_proxy_config_get_identity(cfg));
+               gtk_list_store_append(store,&iter);
+               gtk_list_store_set(store,&iter,0,linphone_proxy_config_get_identity(cfg),1,
+                                  linphone_proxy_config_is_registered(cfg) ? GTK_STOCK_YES : NULL,
+                                  2,cfg,-1);
                if (cfg==def) {
                        def_index=i;
                }
index a6edf1b7eb24514752c2ab8ff9c55d076f33758f..8cf2465077a23e1a232f61e2653635a3e6cdb94c 100644 (file)
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 package org.linphone.core;
 
-import java.util.Vector;
 
 /**
  * Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or passed to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)}
@@ -30,104 +29,97 @@ public interface LinphoneCall {
         * Linphone call states
         *
         */
-       static class State {
-               @SuppressWarnings("unchecked")
-               static private Vector values = new Vector();
-               private final int mValue;
-               private final String mStringValue;
+       enum State {
                /**
                 * Idle
                 */
-               public final static State Idle = new State(0,"Idle");
+               Idle(0, "Idle"),
                /**
                 * Incoming call received.
                 */
-               public final static State IncomingReceived = new State(1,"IncomingReceived");
+               IncomingReceived(1, "IncomingReceived"),
                /**
-                * Outgoing call initialiazed.
+                * Outgoing call initialized.
                 */
-               public final static State OutgoingInit = new State(2,"OutgoingInit");
+               OutgoingInit(2, "OutgoingInit"),
                /**
                 * Outgoing call in progress. 
                 */
-               public final static State OutgoingProgress = new State(3,"OutgoingProgress");
+               OutgoingProgress(3, "OutgoingProgress"),
                /**
                 * Outgoing call ringing.
                 */
-               public final static State OutgoingRinging = new State(4,"OutgoingRinging");
+               OutgoingRinging(4, "OutgoingRinging"),
                /**
                 * Outgoing call early media
                 */
-               public final static State OutgoingEarlyMedia = new State(5,"OutgoingEarlyMedia");
+               OutgoingEarlyMedia(5, "OutgoingEarlyMedia"),
                /**
                 * Connected
                 */
-               public final static State Connected = new State(6,"Connected");
+               Connected(6, "Connected"),
                /**
                 * Streams running
                 */
-               public final static State StreamsRunning = new State(7,"StreamsRunning");
+               StreamsRunning(7, "StreamsRunning"),
                /**
-                * Paussing
+                * Pausing
                 */
-               public final static State Pausing = new State(8,"Pausing");
+               Pausing(8, "Pausing"),
                /**
                 * Paused
                 */
-               public final static State Paused = new State(9,"Paused");
+               Paused(9, "Paused"),
                /**
                 * Resuming
                 */
-               public final static State Resuming = new State(10,"Resuming");
+               Resuming(10, "Resuming"),
                /**
                 * Refered
                 */
-               public final static State Refered = new State(11,"Refered");
+               Refered(11,"Refered"),
                /**
                 * Error
                 */
-               public final static State Error = new State(12,"Error");
+               Error(12,"Error"),
                /**
                 * Call end
                 */
-               public final static State CallEnd = new State(13,"CallEnd");
-               
+               CallEnd(13,"CallEnd"),
                /**
                 * Paused by remote
                 */
-               public final static State PausedByRemote = new State(14,"PausedByRemote");
-               
+               PausedByRemote(14,"PausedByRemote"),
                /**
                 * The call's parameters are updated, used for example when video is asked by remote
                 */
-               public static final State CallUpdatedByRemote = new State(15, "CallUpdatedByRemote");
-
+               CallUpdatedByRemote(15, "CallUpdatedByRemote"),
                /**
                 * We are proposing early media to an incoming call
                 */
-               public static final State CallIncomingEarlyMedia = new State(16,"CallIncomingEarlyMedia");
-
+               CallIncomingEarlyMedia(16,"CallIncomingEarlyMedia"),
                /**
                 * The remote accepted the call update initiated by us
                 */
-               public static final State CallUpdated = new State(17, "CallUpdated");
-               
+               CallUpdated(17, "CallUpdated"),
                /**
                 * The call object is now released.
                 */
-               public static final State CallReleased = new State(18,"CallReleased");
+               CallReleased(18,"CallReleased");
 
-               @SuppressWarnings("unchecked")
-               private State(int value,String stringValue) {
-                       mValue = value;
-                       values.addElement(this);
-                       mStringValue=stringValue;
+               
+               private final int mValue;
+               private final String mStringValue;
+               private State(int v, String desc) {
+                       this.mValue = v;
+                       this.mStringValue = desc;
                }
+               
                public static State fromInt(int value) {
-
-                       for (int i=0; i<values.size();i++) {
-                               State state = (State) values.elementAt(i);
-                               if (state.mValue == value) return state;
+                       State[] allStates = State.values();
+                       for (int i=0; i<allStates.length;i++) {
+                               if (allStates[i].mValue == value)
+                                       return allStates[i];
                        }
                        throw new RuntimeException("state not found ["+value+"]");
                }
@@ -160,6 +152,8 @@ public interface LinphoneCall {
        LinphoneCallParams getCurrentParamsCopy();
        
        void enableCamera(boolean enabled);
+       boolean cameraEnabled();
+       
        /**
         * Enables or disable echo cancellation.
         * @param enable
index 457a7c34ac5c9793a484bf3930c4e96a39e5cf3b..a56e2b86193f21e7272f27eac0aaccd17d695f00 100644 (file)
@@ -474,6 +474,11 @@ public interface LinphoneCore {
        
        void setVideoWindow(Object w);
        void setPreviewWindow(Object w);
+       void setDeviceRotation(int rotation);
+       
+       void setVideoDevice(int id);
+       int getVideoDevice();
+       
        /**
         * Enables video globally.
         *
index 021c5cd8cca603c6e905ec6688a4deefa995358c..5ee91bbafef99fea6e56a31714af4eceaf0d6553 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 021c5cd8cca603c6e905ec6688a4deefa995358c
+Subproject commit 5ee91bbafef99fea6e56a31714af4eceaf0d6553