From c3ebf99f5ea6ec9d1ef26b2c65f1f4262f4f00ca Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 27 Feb 2013 17:28:15 +0100 Subject: [PATCH] Fix compilation for WP8 --- build/vsx/LibLinphone/LibLinphone.vcxproj | 126 +++++++++--------- .../LibLinphone/LibLinphone.vcxproj.filters | 33 ++--- coreapi/bellesip_sal/sal_impl.c | 11 +- coreapi/bellesip_sal/sal_impl.h | 2 +- coreapi/bellesip_sal/sal_op_call_transfer.c | 4 +- coreapi/bellesip_sal/sal_op_presence.c | 2 +- coreapi/bellesip_sal/sal_op_registration.c | 3 +- coreapi/callbacks.c | 4 +- coreapi/conference.c | 9 +- coreapi/ec-calibrator.c | 4 +- coreapi/friend.c | 10 +- coreapi/linphonecall.c | 61 ++++++--- coreapi/linphonecore.c | 18 ++- coreapi/lpconfig.c | 21 ++- coreapi/misc.c | 7 +- coreapi/offeranswer.c | 2 +- coreapi/private.h | 2 +- coreapi/sal.c | 2 +- coreapi/siplogin.c | 5 +- coreapi/test_ecc.c | 11 +- coreapi/upnp.c | 2 +- coreapi/upnp.h | 2 +- {coreapi => include/sal}/sal.h | 0 23 files changed, 194 insertions(+), 147 deletions(-) rename {coreapi => include/sal}/sal.h (100%) diff --git a/build/vsx/LibLinphone/LibLinphone.vcxproj b/build/vsx/LibLinphone/LibLinphone.vcxproj index 14a40eaaa..5dde944fb 100644 --- a/build/vsx/LibLinphone/LibLinphone.vcxproj +++ b/build/vsx/LibLinphone/LibLinphone.vcxproj @@ -94,20 +94,22 @@ Level4 - $(ProjectDir)..\..\..\coreapi;$(ProjectDir)..\..\..\..\mediastreamer2\include;$(ProjectDir)..\..\..\..\oRTP\include;%(AdditionalIncludeDirectories) - __STDC_CONSTANT_MACROS;HAVE_SPEEXDSP;ORTP_INET6;WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIASTREAMER2_EXPORTS;MEDIASTREAMER2_INTERNAL_EXPORTS;WINDOW_NATIVE;_CRT_SECURE_NO_DEPRECATE;_TRUE_TIME;MS2_INTERNAL;MS2_FILTERS;IN_LINPHONE;USE_BELLESIP;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..\..\belle-sip\include;$(ProjectDir)..\..\..\..\oRTP\include;$(ProjectDir)..\..\..\..\mediastreamer2\include;$(ProjectDIr)..\..\..\..\tunnel\include;$(ProjectDir)..\..\..\coreapi;$(ProjectDir)..\..\..\include;%(AdditionalIncludeDirectories) + __STDC_CONSTANT_MACROS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;WINDOW_NATIVE;_TRUE_TIME;IN_LINPHONE;USE_BELLESIP;BUILD_UPNP;LINPHONE_PACKAGE_NAME="linphone";LINPHONE_VERSION="Devel";LIBLINPHONE_EXPORTS;LINPHONE_PLUGINS_DIR="";%(PreprocessorDefinitions) false Default NotUsing false $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) + false + false Console false false true - mediastreamer2_dll.lib;ortp_dll.lib;%(AdditionalDependencies) + belle-sip_dll.lib;mediastreamer2_dll.lib;ws2_32.lib;ortp_dll.lib;gsm_dll.lib;speex_dll.lib;speexdsp_dll.lib;%(AdditionalDependencies) $(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) $(TargetDir)$(TargetName)_dll.lib @@ -117,10 +119,11 @@ - _USRDLL;NDEBUG;%(PreprocessorDefinitions) + _USRDLL;NDEBUG;IN_LINPHONE;WIN32;USE_BELLESIP;%(PreprocessorDefinitions) NotUsing false $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) + $(Project)../../../../belle-sip/include;$(Project)../../../../oRTP/include;$(Project)../../../../mediastreamer2/include;$(Project)../../../coreapi;%(AdditionalIncludeDirectories) Console @@ -129,6 +132,65 @@ true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {4c225a82-800b-427b-ba7b-61686a9b347f} + + + {027bad0e-9179-48c1-9733-7aa7e2c2ec70} + + + {ffc7b532-0502-4d88-ac98-9e89071cbc97} + false + true + false + true + false + + true @@ -138,62 +200,6 @@ false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/vsx/LibLinphone/LibLinphone.vcxproj.filters b/build/vsx/LibLinphone/LibLinphone.vcxproj.filters index 7b4e3d0d3..846ce2633 100644 --- a/build/vsx/LibLinphone/LibLinphone.vcxproj.filters +++ b/build/vsx/LibLinphone/LibLinphone.vcxproj.filters @@ -14,14 +14,9 @@ - - - - - @@ -29,37 +24,29 @@ - - - - - - - - - - - - + + + + + + + + + - - - - - - + \ No newline at end of file diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index cedd2b83f..22494b2a8 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #endif - void _belle_sip_log(belle_sip_log_level lev, const char *fmt, va_list args) { int ortp_level; switch(lev) { @@ -209,8 +208,8 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even int rport; bool_t contact_updated=FALSE; char* new_contact; - belle_sip_request_t* old_request=NULL;; - belle_sip_response_t* old_response=NULL;; + belle_sip_request_t* old_request=NULL; + belle_sip_response_t* old_response=NULL; if (op->state == SalOpStateTerminated) { @@ -346,12 +345,14 @@ static void process_transaction_terminated(void *user_ctx, const belle_sip_trans belle_sip_client_transaction_t* client_transaction = belle_sip_transaction_terminated_event_get_client_transaction(event); belle_sip_server_transaction_t* server_transaction = belle_sip_transaction_terminated_event_get_server_transaction(event); belle_sip_transaction_t* trans; + SalOp* op; + if(client_transaction) trans=BELLE_SIP_TRANSACTION(client_transaction); else trans=BELLE_SIP_TRANSACTION(server_transaction); - SalOp* op = (SalOp*)belle_sip_transaction_get_application_data(trans); + op = (SalOp*)belle_sip_transaction_get_application_data(trans); if (op && op->callbacks.process_transaction_terminated) { op->callbacks.process_transaction_terminated(op,event); } else { @@ -377,7 +378,7 @@ Sal * sal_init(){ sal->nat_helper_enabled=TRUE; snprintf(stack_string,sizeof(stack_string)-1,"(belle-sip/%s)",belle_sip_version_to_string()); sal->user_agent=belle_sip_header_user_agent_new(); - belle_sip_header_user_agent_add_product(sal->user_agent, PACKAGE_NAME "/" LINPHONE_VERSION); + belle_sip_header_user_agent_add_product(sal->user_agent, LINPHONE_PACKAGE_NAME "/" LINPHONE_VERSION); belle_sip_header_user_agent_add_product(sal->user_agent,stack_string); belle_sip_object_ref(sal->user_agent); belle_sip_set_log_handler(_belle_sip_log); diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index a4125f17f..085ce8f8b 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SAL_IMPL_H_ #define SAL_IMPL_H_ -#include "sal.h" +#include "sal/sal.h" #include "belle-sip/belle-sip.h" #include "belle-sip/belle-sdp.h" diff --git a/coreapi/bellesip_sal/sal_op_call_transfer.c b/coreapi/bellesip_sal/sal_op_call_transfer.c index 920f6a4cf..5afa9d8dc 100644 --- a/coreapi/bellesip_sal/sal_op_call_transfer.c +++ b/coreapi/bellesip_sal/sal_op_call_transfer.c @@ -162,8 +162,8 @@ int sal_call_notify_refer_state(SalOp *op, SalOp *newcall){ void sal_op_process_refer(SalOp *op, const belle_sip_request_event_t *event){ belle_sip_request_t* req = belle_sip_request_event_get_request(event); - belle_sip_header_refer_to_t *refer_to= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_refer_to_t);; - belle_sip_header_referred_by_t *referred_by= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_referred_by_t);; + belle_sip_header_refer_to_t *refer_to= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_refer_to_t); + belle_sip_header_referred_by_t *referred_by= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_referred_by_t); belle_sip_server_transaction_t* server_transaction = belle_sip_provider_create_server_transaction(op->base.root->prov,req); belle_sip_response_t* resp; belle_sip_uri_t* refer_to_uri; diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index 18775a6c0..8020436fc 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -479,7 +479,7 @@ static void presence_process_request_event(void *op_base, const belle_sip_reques belle_sip_request_t* req = belle_sip_request_event_get_request(event); belle_sip_dialog_state_t dialog_state; belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t); - belle_sip_header_expires_t* expires = belle_sip_message_get_header_by_type(req,belle_sip_header_expires_t);; + belle_sip_header_expires_t* expires = belle_sip_message_get_header_by_type(req,belle_sip_header_expires_t); const char* body = belle_sip_message_get_body(BELLE_SIP_MESSAGE(req)); SalPresenceStatus estatus=SalPresenceOffline; SalSubscribeStatus sub_state; diff --git a/coreapi/bellesip_sal/sal_op_registration.c b/coreapi/bellesip_sal/sal_op_registration.c index 609fb2b03..5ae44d93e 100644 --- a/coreapi/bellesip_sal/sal_op_registration.c +++ b/coreapi/bellesip_sal/sal_op_registration.c @@ -125,6 +125,7 @@ static int send_register_request_with_expires(SalOp* op, belle_sip_request_t* re int sal_register(SalOp *op, const char *proxy, const char *from, int expires){ belle_sip_request_t *req; + belle_sip_uri_t* req_uri; sal_op_set_from(op,from); sal_op_set_to(op,from); sal_op_set_route(op,proxy); @@ -134,7 +135,7 @@ int sal_register(SalOp *op, const char *proxy, const char *from, int expires){ op->callbacks.process_transaction_terminated=register_process_transaction_terminated; req = sal_op_build_request(op,"REGISTER"); - belle_sip_uri_t* req_uri = belle_sip_request_get_uri(req); + req_uri = belle_sip_request_get_uri(req); belle_sip_uri_set_user(req_uri,NULL); /*remove userinfo if any*/ return send_register_request_with_expires(op,req,expires); diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 23f586088..b274dde1f 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "sal.h" +#include "sal/sal.h" #include "linphonecore.h" #include "private.h" @@ -179,9 +179,9 @@ static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, c #endif static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) { + MSList *elem; ms_warning(" searching for already_a_call_with_remote_address."); - MSList *elem; for(elem=lc->calls;elem!=NULL;elem=elem->next){ const LinphoneCall *call=(LinphoneCall*)elem->data; const LinphoneAddress *cRemote=linphone_call_get_remote_address(call); diff --git a/coreapi/conference.c b/coreapi/conference.c index 16be62613..c98392e95 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -215,6 +215,7 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t active){ int err=0; + char *str; if (!call->current_params.in_conference){ if (call->params.in_conference){ @@ -227,7 +228,7 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a } call->params.in_conference=FALSE; - char *str=linphone_call_get_remote_address_as_string(call); + str=linphone_call_get_remote_address_as_string(call); ms_message("%s will be removed from conference", str); ms_free(str); if (active){ @@ -283,10 +284,11 @@ static int convert_conference_to_call(LinphoneCore *lc){ * @returns 0 if successful, -1 otherwise. **/ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ + int err; char * str=linphone_call_get_remote_address_as_string(call); ms_message("Removing call %s from the conference", str); ms_free(str); - int err=remove_from_conference(lc,call, FALSE); + err=remove_from_conference(lc,call, FALSE); if (err){ ms_error("Error removing participant from conference."); return err; @@ -335,13 +337,14 @@ int linphone_core_leave_conference(LinphoneCore *lc){ * @returns 0 if successful, -1 otherwise **/ int linphone_core_enter_conference(LinphoneCore *lc){ + LinphoneConference *conf; if (linphone_core_sound_resources_locked(lc)) { return -1; } if (lc->current_call != NULL) { linphone_core_pause_call(lc, lc->current_call); } - LinphoneConference *conf=&lc->conf_ctx; + conf=&lc->conf_ctx; if (conf->local_participant==NULL) add_local_endpoint(conf,lc); return 0; } diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 8efbabb1b..f0f009747 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -241,11 +241,13 @@ void ec_calibrator_destroy(EcCalibrator *ecc){ } int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb, void *cb_data){ + unsigned int rate; + if (lc->ecc!=NULL){ ms_error("Echo calibration is still on going !"); return -1; } - unsigned int rate = lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000); + rate = lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000); lc->ecc=ec_calibrator_new(lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,cb_data); return 0; } diff --git a/coreapi/friend.c b/coreapi/friend.c index 3bc30cff0..b1dd9c4c9 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -152,11 +152,13 @@ LinphoneFriend * linphone_friend_new(){ LinphoneFriend *linphone_friend_new_with_addr(const char *addr){ LinphoneAddress* linphone_address = linphone_address_new(addr); + LinphoneFriend *fr; + if (linphone_address == NULL) { ms_error("Cannot create friend for address [%s]",addr?addr:"null"); return NULL; } - LinphoneFriend *fr=linphone_friend_new(); + fr=linphone_friend_new(); if (linphone_friend_set_addr(fr,linphone_address)<0){ linphone_friend_destroy(fr); return NULL; @@ -440,6 +442,8 @@ LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, cons const MSList *elem; const char *username; const char *domain; + const char *it_username; + const char *it_host; LinphoneFriend *lf=NULL; if (puri==NULL){ @@ -453,8 +457,8 @@ LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, cons } for(elem=lc->friends;elem!=NULL;elem=ms_list_next(elem)){ lf=(LinphoneFriend*)elem->data; - const char *it_username=linphone_address_get_username(lf->uri); - const char *it_host=linphone_address_get_domain(lf->uri);; + it_username=linphone_address_get_username(lf->uri); + it_host=linphone_address_get_domain(lf->uri);; if (strcasecmp(domain,it_host)==0 && username_match(username,it_username)){ break; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index ba495f41d..86a5540aa 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -120,9 +120,10 @@ static void linphone_call_videostream_encryption_changed(void *data, bool_t encr static void linphone_call_audiostream_encryption_changed(void *data, bool_t encrypted) { char status[255]={0}; + LinphoneCall *call; ms_message("Audio stream is %s ", encrypted ? "encrypted" : "not encrypted"); - LinphoneCall *call = (LinphoneCall *)data; + call = (LinphoneCall *)data; call->audiostream_encrypted=encrypted; if (encrypted && call->core->vtable.display_status != NULL) { @@ -1333,6 +1334,13 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute 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); + float speed; + float force; + int sustain; + float transmit_thres; + MSFilter *f=NULL; + float floorgain; + int spk_agc; if (!muted) linphone_core_set_mic_gain_db (lc, mic_gain); @@ -1346,12 +1354,11 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute if (st->volsend){ ms_filter_call_method(st->volsend,MS_VOLUME_REMOVE_DC,&dc_removal); - float speed=lp_config_get_float(lc->config,"sound","el_speed",-1); + speed=lp_config_get_float(lc->config,"sound","el_speed",-1); thres=lp_config_get_float(lc->config,"sound","el_thres",-1); - float force=lp_config_get_float(lc->config,"sound","el_force",-1); - int sustain=lp_config_get_int(lc->config,"sound","el_sustain",-1); - float transmit_thres=lp_config_get_float(lc->config,"sound","el_transmit_thres",-1); - MSFilter *f=NULL; + force=lp_config_get_float(lc->config,"sound","el_force",-1); + sustain=lp_config_get_int(lc->config,"sound","el_sustain",-1); + transmit_thres=lp_config_get_float(lc->config,"sound","el_transmit_thres",-1); f=st->volsend; if (speed==-1) speed=0.03; if (force==-1) force=25; @@ -1369,8 +1376,8 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute } if (st->volrecv){ /* parameters for a limited noise-gate effect, using echo limiter threshold */ - float floorgain = 1/pow(10,(mic_gain)/10); - int spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0); + floorgain = 1/pow(10,(mic_gain)/10); + spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0); ms_filter_call_method(st->volrecv, MS_VOLUME_ENABLE_AGC, &spk_agc); ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres); ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_FLOORGAIN,&floorgain); @@ -1478,9 +1485,19 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna LinphoneCore *lc=call->core; int used_pt=-1; char rtcp_tool[128]={0}; + const SalStreamDescription *stream; + MSSndCard *playcard; + MSSndCard *captcard; + bool_t use_ec; + bool_t mute; + const char *playfile; + const char *recfile; + const SalStreamDescription *local_st_desc; + int crypto_idx; + snprintf(rtcp_tool,sizeof(rtcp_tool)-1,"%s-%s",linphone_core_get_user_agent_name(),linphone_core_get_user_agent_version()); /* look for savp stream first */ - const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, + stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpSavp,SalAudio); /* no savp audio stream, use avp */ if (!stream) @@ -1488,13 +1505,12 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna SalProtoRtpAvp,SalAudio); if (stream && stream->dir!=SalStreamInactive && stream->rtp_port!=0){ - MSSndCard *playcard=lc->sound_conf.lsd_card ? + 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; + captcard=lc->sound_conf.capt_sndcard; + playfile=lc->play_file; + recfile=lc->rec_file; call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt); - bool_t use_ec; if (used_pt!=-1){ call->current_params.audio_codec = rtp_profile_get_payload(call->audio_profile, used_pt); @@ -1570,9 +1586,9 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna /* valid local tags are > 0 */ if (stream->proto == SalProtoRtpSavp) { - const SalStreamDescription *local_st_desc=sal_media_description_find_stream(call->localdesc, + local_st_desc=sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp,SalAudio); - int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag); + crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag); if (crypto_idx >= 0) { audio_stream_enable_srtp( @@ -1588,7 +1604,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna }else call->audiostream_encrypted=FALSE; if (call->params.in_conference){ /*transform the graph to connect it to the conference filter */ - bool_t mute=stream->dir==SalStreamRecvOnly; + mute=stream->dir==SalStreamRecvOnly; linphone_call_add_to_conf(call, mute); } call->current_params.in_conference=call->params.in_conference; @@ -1696,13 +1712,15 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){ LinphoneCore *lc=call->core; + LinphoneAddress *me; + char *cname; + bool_t use_arc; call->current_params.audio_codec = NULL; call->current_params.video_codec = NULL; - LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc); - char *cname; - bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc); + me=linphone_core_get_primary_contact_parsed(lc); + use_arc=linphone_core_adaptive_rate_control_enabled(lc); #ifdef VIDEO_ENABLED const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalVideo); @@ -2373,10 +2391,11 @@ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, VideoStream* vstream = call->videostream; if (vstream && vstream->output) { float zoom[3]; + float halfsize; if (zoom_factor < 1) zoom_factor = 1; - float halfsize = 0.5 * 1.0 / zoom_factor; + halfsize = 0.5 * 1.0 / zoom_factor; if ((*cx - halfsize) < 0) *cx = 0 + halfsize; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f1c0b0129..199a1cc3b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2176,7 +2176,7 @@ void linphone_core_iterate(LinphoneCore *lc){ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url){ enum_lookup_res_t *enumres=NULL; char *enum_domain=NULL; - LinphoneProxyConfig *proxy=lc->default_proxy;; + LinphoneProxyConfig *proxy=lc->default_proxy; char *tmpurl; LinphoneAddress *uri; @@ -5344,9 +5344,10 @@ static void linphone_core_uninit(LinphoneCore *lc) } static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){ - ms_message("Network state is now [%s]",isReachable?"UP":"DOWN"); // second get the list of available proxies const MSList *elem=linphone_core_get_proxy_config_list(lc); + + ms_message("Network state is now [%s]",isReachable?"UP":"DOWN"); for(;elem!=NULL;elem=elem->next){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; if (linphone_proxy_config_register_enabled(cfg) ) { @@ -5661,13 +5662,18 @@ const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc){ } const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) { + MSList *calls; + const LinphoneCall *c; + const LinphoneAddress *address; + char *current_uri; + if (uri == NULL) return NULL; - MSList *calls=lc->calls; + calls=lc->calls; while(calls) { - const LinphoneCall *c=(LinphoneCall*)calls->data; + c=(LinphoneCall*)calls->data; calls=calls->next; - const LinphoneAddress *address = linphone_call_get_remote_address(c); - char *current_uri=linphone_address_as_string_uri_only(address); + address = linphone_call_get_remote_address(c); + current_uri=linphone_address_as_string_uri_only(address); if (strcmp(uri,current_uri)==0) { ms_free(current_uri); return c; diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 4608beecf..5f90855f5 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -34,6 +34,9 @@ #include #include #include +#if _MSC_VER +#include +#endif #endif /*_WIN32_WCE*/ @@ -140,18 +143,20 @@ LpItem *lp_section_find_item(const LpSection *sec, const char *name){ void lp_config_parse(LpConfig *lpconfig, FILE *file){ char tmp[MAX_LEN]= {'\0'}; LpSection *cur=NULL; + char *pos1,*pos2; + int nbs; + char secname[MAX_LEN]; + char key[MAX_LEN]; + LpItem *item; if (file==NULL) return; while(fgets(tmp,MAX_LEN,file)!=NULL){ tmp[sizeof(tmp) -1] = '\0'; - char *pos1,*pos2; pos1=strchr(tmp,'['); if (pos1!=NULL && is_first_char(tmp,pos1) ){ pos2=strchr(pos1,']'); if (pos2!=NULL){ - int nbs; - char secname[MAX_LEN]; secname[0]='\0'; /* found section */ *pos2='\0'; @@ -171,7 +176,6 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ }else { pos1=strchr(tmp,'='); if (pos1!=NULL){ - char key[MAX_LEN]; key[0]='\0'; *pos1='\0'; @@ -191,7 +195,7 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ if (pos2-pos1>=0){ /* found a pair key,value */ if (cur!=NULL){ - LpItem *item=lp_section_find_item(cur,key); + item=lp_section_find_item(cur,key); if (item==NULL){ lp_section_add_item(cur,lp_item_new(key,pos1)); }else{ @@ -211,17 +215,20 @@ void lp_config_parse(LpConfig *lpconfig, FILE *file){ LpConfig * lp_config_new(const char *filename){ LpConfig *lpconfig=lp_new0(LpConfig,1); + struct stat fileStat; if (filename!=NULL){ lpconfig->filename=ortp_strdup(filename); lpconfig->file=fopen(filename,"rw"); if (lpconfig->file!=NULL){ - struct stat fileStat; lp_config_parse(lpconfig,lpconfig->file); fclose(lpconfig->file); #if !defined(_WIN32_WCE) +#ifndef S_ISREG +#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) +#endif if ((stat(filename,&fileStat) == 0) && (S_ISREG(fileStat.st_mode))) { /* make existing configuration files non-group/world-accessible */ - if (chmod(filename, S_IRUSR | S_IWUSR) == -1) { + if (_chmod(filename, _S_IREAD | _S_IWRITE) == -1) { ms_warning("unable to correct permissions on " "configuration file: %s", strerror(errno)); } diff --git a/coreapi/misc.c b/coreapi/misc.c index 927c3b55a..bc681d2fa 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -32,7 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#if _MSC_VER +#include +#else #include +#endif #include #endif /*_WIN32_WCE*/ @@ -585,9 +589,10 @@ int linphone_core_get_edge_ptime(LinphoneCore *lc){ } void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){ + int threshold; if (ping_time_ms>0 && lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ ms_message("Stun server ping time is %i ms",ping_time_ms); - int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); + threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); if (ping_time_ms>threshold){ /* we might be in a 2G network*/ diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index ab38f7636..81e212b40 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "sal.h" +#include "sal/sal.h" #include "offeranswer.h" #include "private.h" diff --git a/coreapi/private.h b/coreapi/private.h index d478a32ef..c76e3ccbc 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -31,7 +31,7 @@ extern "C" { #include "linphonefriend.h" #include "linphone_tunnel.h" #include "linphonecore_utils.h" -#include "sal.h" +#include "sal/sal.h" #include "sipsetup.h" #ifdef HAVE_CONFIG_H diff --git a/coreapi/sal.c b/coreapi/sal.c index ffb1b215a..07d189ed8 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. protocols and implementations under linphone, for example SIP, JINGLE... **/ -#include "sal.h" +#include "sal/sal.h" const char* sal_transport_to_string(SalTransport transport) { switch (transport) { case SalTransportUDP:return "udp"; diff --git a/coreapi/siplogin.c b/coreapi/siplogin.c index 6903638d6..f29398c93 100644 --- a/coreapi/siplogin.c +++ b/coreapi/siplogin.c @@ -113,10 +113,9 @@ SipSetup linphone_sip_login={ NULL, NULL, NULL, + sip_login_do_logout, NULL, - NULL, - NULL, - sip_login_do_logout + NULL }; diff --git a/coreapi/test_ecc.c b/coreapi/test_ecc.c index 43ae0dcb2..a0baeea40 100644 --- a/coreapi/test_ecc.c +++ b/coreapi/test_ecc.c @@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" #include "linphonecore_utils.h" +#if _MSC_VER +#include +#endif static void calibration_finished(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay, void *data){ ms_message("echo calibration finished %s.",status==LinphoneEcCalibratorDone ? "successfully" : "with faillure"); @@ -30,6 +33,9 @@ static void calibration_finished(LinphoneCore *lc, LinphoneEcCalibratorStatus st static char config_file[1024]; void parse_args(int argc, char *argv[]){ +#ifndef F_OK +#define F_OK 4 +#endif if (argc != 3 || strncmp("-c",argv[1], 2) || access(argv[2],F_OK)!=0) { printf("Usage: test_ecc [-c config_file] where config_file will be written with the detected value\n"); exit(-1); @@ -38,10 +44,11 @@ void parse_args(int argc, char *argv[]){ } int main(int argc, char *argv[]){ - if (argc>1) parse_args(argc,argv); int count=0; LinphoneCoreVTable vtable={0}; - LinphoneCore *lc=linphone_core_new(&vtable,config_file,NULL,NULL); + LinphoneCore *lc; + if (argc>1) parse_args(argc,argv); + lc=linphone_core_new(&vtable,config_file,NULL,NULL); linphone_core_enable_logs(NULL); diff --git a/coreapi/upnp.c b/coreapi/upnp.c index 86d16d0f0..4672685bd 100644 --- a/coreapi/upnp.c +++ b/coreapi/upnp.c @@ -491,7 +491,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind mapping.remote_port = port->external_port; mapping.remote_host = ""; snprintf(description, 128, "%s %s at %s:%d", - PACKAGE_NAME, + LINPHONE_PACKAGE_NAME, (port->protocol == UPNP_IGD_IP_PROTOCOL_TCP)? "TCP": "UDP", port->local_addr, port->local_port); mapping.description = description; diff --git a/coreapi/upnp.h b/coreapi/upnp.h index fe403a772..81edc5986 100644 --- a/coreapi/upnp.h +++ b/coreapi/upnp.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/upnp_igd.h" #include "linphonecore.h" -#include "sal.h" +#include "sal/sal.h" typedef struct _UpnpSession UpnpSession; typedef struct _UpnpContext UpnpContext; diff --git a/coreapi/sal.h b/include/sal/sal.h similarity index 100% rename from coreapi/sal.h rename to include/sal/sal.h