diff --git a/linphone/README.mingwce b/linphone/README.mingwce index ce2dc0000..f6b038313 100644 --- a/linphone/README.mingwce +++ b/linphone/README.mingwce @@ -1,6 +1,25 @@ -install arm-mingw32ce from 0.55 from http://cegcc.sourceforge.net/ +install arm-mingw32ce 0.55 from from http://cegcc.sourceforge.net/ + +Modify the file errno.h found in +"/mingw/opt/mingw32ce/arm-wince-mingw32ce/include/errno.h" + +Remove lines 11-14: + +#ifdef __COREDLL__ +# include_next +#else /* __COREDLL__ */ + +and lines 106-107: + +#endif /* Not __COREDLL__ */ -for ortp: -cd oRTP -./configure --host=arm-mingw32ce --enable-strict=no --enable-ipv6=no + +get dependencies: + cd scripts + make -f builder-arm-ming32ce.mk get_dependencies + +build: +from scripts: + make -f builder-arm-ming32ce.mk build-linphone + diff --git a/linphone/configure.in b/linphone/configure.in index ca8b8f40b..273bf8e8e 100644 --- a/linphone/configure.in +++ b/linphone/configure.in @@ -36,13 +36,14 @@ AM_PROG_CC_C_O case $target_os in *mingw32ce) - CFLAGS="$CFLAGS -D_WIN32_WCE" - LIBS="$LIBS -lws2 -liphlpapi" + CFLAGS="$CFLAGS -D_WIN32_WCE -DORTP_STATIC -D_WIN32_WINNT=0x0501 -Dstrerror=" + CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501" + LIBS="$LIBS -lws2 -liphlpapi" mingw_found=yes mingwce_found=yes ;; *mingw*) - CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501" + CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501 " CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501" LIBS="$LIBS -lws2_32" GUI_FLAGS="-mwindows" @@ -326,6 +327,19 @@ dnl compilation of gtk-glade user interface AM_CONDITIONAL(BUILD_GLADE_UI, [test x$gtk_ui = xtrue ] ) AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes ) +dnl check getenv +AH_TEMPLATE([HAVE_GETENV]) +AC_CHECK_FUNC([getenv], AC_DEFINE([HAVE_GETENV], [1], [If present, the getenv function allows fim to read environment variables.])) + +dnl +AC_MSG_CHECKING([for sighandler_t]) +AC_TRY_COMPILE([#include ],[sighandler_t *f;], +has_sighandler_t=yes,has_sighandler_t=no) +AC_MSG_RESULT($has_sighandler_t) +if test "$has_sighandler_t" = "yes" ; then + AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] ) +fi + ################################################## # Stricter build options (after external packages) ################################################## diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index bbf5a8e04..661fc771e 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -31,9 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "exevents.h" -#ifdef INET6 +#ifdef INET6 #ifndef WIN32 -#include +#include #endif #endif @@ -50,7 +50,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val); /* relative path where is stored local ring*/ #define LOCAL_RING "rings/oldphone.wav" /* same for remote ring (ringback)*/ -#define REMOTE_RING "ringback.wav" +#define REMOTE_RING "ringback.wav" sdp_handler_t linphone_sdphandler={ @@ -79,7 +79,7 @@ static void linphone_call_init_common(LinphoneCall *call, char *from, char *to) call->media_start_time=0; call->log=linphone_call_log_new(call, from, to); linphone_core_notify_all_friends(call->core,LINPHONE_STATUS_ONTHEPHONE); - if (linphone_core_get_firewall_policy(call->core)==LINPHONE_POLICY_USE_STUN) + if (linphone_core_get_firewall_policy(call->core)==LINPHONE_POLICY_USE_STUN) linphone_core_run_stun_tests(call->core,call); call->profile=rtp_profile_new("Call RTP profile"); } @@ -280,7 +280,7 @@ void _osip_trace_func(char *fi, int li, osip_trace_level_t level, char *chfr, va ortp_level=ORTP_FATAL; break; case END_TRACE_LEVEL: - break; + break; } if (ortp_log_level_enabled(level)){ int len=strlen(chfr); @@ -376,13 +376,13 @@ void sound_config_read(LinphoneCore *lc) devid=lp_config_get_string(lc->config,"sound","playback_dev_id",NULL); linphone_core_set_playback_device(lc,devid); - + devid=lp_config_get_string(lc->config,"sound","ringer_dev_id",NULL); linphone_core_set_ringer_device(lc,devid); - + devid=lp_config_get_string(lc->config,"sound","capture_dev_id",NULL); linphone_core_set_capture_device(lc,devid); - + /* tmp=lp_config_get_int(lc->config,"sound","play_lev",80); linphone_core_set_play_level(lc,tmp); @@ -393,7 +393,7 @@ void sound_config_read(LinphoneCore *lc) tmpbuf=lp_config_get_string(lc->config,"sound","source","m"); linphone_core_set_sound_source(lc,tmpbuf[0]); */ - + tmpbuf=PACKAGE_SOUND_DIR "/" LOCAL_RING; tmpbuf=lp_config_get_string(lc->config,"sound","local_ring",tmpbuf); if (access(tmpbuf,F_OK)==-1) { @@ -403,9 +403,9 @@ void sound_config_read(LinphoneCore *lc) /* it currently uses old sound files, so replace them */ tmpbuf=PACKAGE_SOUND_DIR "/" LOCAL_RING; } - + linphone_core_set_ring(lc,tmpbuf); - + tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING; tmpbuf=lp_config_get_string(lc->config,"sound","remote_ring",tmpbuf); if (access(tmpbuf,F_OK)==-1){ @@ -448,12 +448,16 @@ void sip_config_read(LinphoneCore *lc) linphone_core_enable_ipv6(lc,ipv6); port=lp_config_get_int(lc->config,"sip","sip_port",5060); linphone_core_set_sip_port(lc,port); - + tmpstr=lp_config_get_string(lc->config,"sip","contact",NULL); if (tmpstr==NULL || linphone_core_set_primary_contact(lc,tmpstr)==-1) { + char *hostname=NULL; + char *username=NULL; +#ifdef HAVE_GETENV char *hostname=getenv("HOST"); char *username=getenv("USER"); if (hostname==NULL) hostname=getenv("HOSTNAME"); +#endif /*HAVE_GETENV*/ if (hostname==NULL) hostname="unknown-host"; if (username==NULL){ @@ -466,8 +470,8 @@ void sip_config_read(LinphoneCore *lc) tmp=lp_config_get_int(lc->config,"sip","guess_hostname",1); linphone_core_set_guess_hostname(lc,tmp); - - + + tmp=lp_config_get_int(lc->config,"sip","inc_timeout",15); linphone_core_set_inc_timeout(lc,tmp); @@ -483,7 +487,7 @@ void sip_config_read(LinphoneCore *lc) /* get the default proxy */ tmp=lp_config_get_int(lc->config,"sip","default_proxy",-1); linphone_core_set_default_proxy_index(lc,tmp); - + /* read authentication information */ for(i=0;; i++){ LinphoneAuthInfo *ai=linphone_auth_info_new_from_config_file(lc->config,i); @@ -507,16 +511,16 @@ void rtp_config_read(LinphoneCore *lc) int nortp_timeout; port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078); linphone_core_set_audio_port(lc,port); - + port=lp_config_get_int(lc->config,"rtp","video_rtp_port",9078); if (port==0) port=9078; linphone_core_set_video_port(lc,port); - + jitt_comp=lp_config_get_int(lc->config,"rtp","audio_jitt_comp",60); - linphone_core_set_audio_jittcomp(lc,jitt_comp); + linphone_core_set_audio_jittcomp(lc,jitt_comp); jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60); nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30); - linphone_core_set_nortp_timeout(lc,nortp_timeout); + linphone_core_set_nortp_timeout(lc,nortp_timeout); } @@ -525,14 +529,14 @@ PayloadType * get_codec(LpConfig *config, char* type,int index){ const char *mime,*fmtp; int rate,enabled; PayloadType *pt; - + snprintf(codeckey,50,"%s_%i",type,index); mime=lp_config_get_string(config,codeckey,"mime",NULL); if (mime==NULL || strlen(mime)==0 ) return NULL; - + pt=payload_type_new(); pt->mime_type=ms_strdup(mime); - + rate=lp_config_get_int(config,codeckey,"rate",8000); pt->clock_rate=rate; fmtp=lp_config_get_string(config,codeckey,"recv_fmtp",NULL); @@ -587,7 +591,7 @@ void video_config_read(LinphoneCore *lc) str=lp_config_get_string(lc->config,"video","device",NULL); if (str && str[0]==0) str=NULL; linphone_core_set_video_device(lc,str); - + linphone_core_set_preferred_video_size_by_name(lc, lp_config_get_string(lc->config,"video","size","cif")); @@ -607,7 +611,7 @@ void ui_config_read(LinphoneCore *lc) for (i=0;(lf=linphone_friend_new_from_config_file(lc,i))!=NULL;i++){ linphone_core_add_friend(lc,lf); } - + } void autoreplier_config_init(LinphoneCore *lc) @@ -681,7 +685,7 @@ void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, co gstate_initialize(lc); gstate_new_state(lc, GSTATE_POWER_STARTUP, NULL); - + ortp_init(); linphone_core_assign_payload_type(&payload_type_lpc1015,115,NULL); linphone_core_assign_payload_type(&payload_type_speex_nb,110,"vbr=on"); @@ -715,9 +719,9 @@ void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, co #endif ms_init(); - + lc->config=lp_config_new(config_path); - + #ifdef VINCENT_MAURY_RSVP /* default qos parameters : rsvp on, rpc off */ lc->rsvp_enable = 1; @@ -796,7 +800,7 @@ void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result if (eXosip_guess_localip(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,result,LINPHONE_IPADDR_SIZE)<0){ /*default to something */ strncpy(result,lc->sip_conf.ipv6_enabled ? "::1" : "127.0.0.1",LINPHONE_IPADDR_SIZE); - ms_error("Could not find default routable ip address !"); + ms_error("Could not find default routable ip address !"); } } @@ -812,10 +816,10 @@ const char *linphone_core_get_primary_contact(LinphoneCore *lc) ms_free(lc->sip_conf.guessed_contact); lc->sip_conf.guessed_contact=NULL; } - + osip_from_init(&url); if (osip_from_parse(url,lc->sip_conf.contact)==0){ - + }else ms_error("Could not parse identity contact !"); linphone_core_get_local_ip(lc, NULL, tmp); if (strcmp(tmp,"127.0.0.1")==0 || strcmp(tmp,"::1")==0 ){ @@ -833,9 +837,9 @@ const char *linphone_core_get_primary_contact(LinphoneCore *lc) } osip_from_to_str(url,&guessed); lc->sip_conf.guessed_contact=guessed; - + osip_from_free(url); - + } identity=lc->sip_conf.guessed_contact; }else{ @@ -847,7 +851,7 @@ const char *linphone_core_get_primary_contact(LinphoneCore *lc) void linphone_core_set_guess_hostname(LinphoneCore *lc, bool_t val){ lc->sip_conf.guess_hostname=val; } - + bool_t linphone_core_get_guess_hostname(LinphoneCore *lc){ return lc->sip_conf.guess_hostname; } @@ -1040,11 +1044,11 @@ void linphone_core_iterate(LinphoneCore *lc) { eXosip_event_t *ev; bool_t disconnected=FALSE; - int disconnect_timeout = linphone_core_get_nortp_timeout(lc); + int disconnect_timeout = linphone_core_get_nortp_timeout(lc); time_t curtime=time(NULL); int elapsed; bool_t one_second_elapsed=FALSE; - + if (curtime-lc->prevtime>=1){ lc->prevtime=curtime; one_second_elapsed=TRUE; @@ -1056,7 +1060,7 @@ void linphone_core_iterate(LinphoneCore *lc) lc->ringstream=NULL; lc_callback_obj_invoke(&lc->preview_finished_cb,lc); } - + if (exosip_running){ while((ev=eXosip_event_wait(0,0))!=NULL){ linphone_core_process_event(lc,ev); @@ -1072,7 +1076,7 @@ void linphone_core_iterate(LinphoneCore *lc) if (lc->call!=NULL){ LinphoneCall *call=lc->call; - + if (call->dir==LinphoneCallIncoming && call->state==LCStateRinging){ elapsed=curtime-call->start_time; ms_message("incoming call ringing for %i seconds",elapsed); @@ -1167,7 +1171,7 @@ bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **rea if (real_parsed_url!=NULL) *real_parsed_url=NULL; *route=NULL; tmproute=linphone_core_get_route(lc); - + if (is_enum(url,&enum_domain)){ lc->vtable.display_status(lc,_("Looking for telephone number destination...")); if (enum_lookup(enum_domain,&enumres)<0){ @@ -1335,7 +1339,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) osip_to_t *real_parsed_url=NULL; char *real_url=NULL; LinphoneProxyConfig *dest_proxy=NULL; - + if (lc->call!=NULL){ lc->vtable.display_warning(lc,_("Sorry, having multiple simultaneous calls is not supported yet !")); return -1; @@ -1355,7 +1359,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) ms_message("The used identity will be %s",linphone_proxy_config_get_identity(dest_proxy)); } - if (dest_proxy!=NULL) + if (dest_proxy!=NULL) from=linphone_proxy_config_get_identity(dest_proxy); else if (proxy!=NULL) from=linphone_proxy_config_get_identity(proxy); @@ -1374,10 +1378,10 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) osip_message_set_supported(invite, "timer"); } /* make sdp message */ - + osip_from_init(&parsed_url2); osip_from_parse(parsed_url2,from); - + lc->call=linphone_call_new_outgoing(lc,parsed_url2,real_parsed_url); /*try to be best-effort in giving real local or routable contact address, except when the user choosed to override the ipaddress */ @@ -1404,7 +1408,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) lc->call=NULL; linphone_core_stop_media_streams(lc); } - + goto end; end: if (real_url!=NULL) ms_free(real_url); @@ -1454,7 +1458,7 @@ int linphone_core_set_rpc_mode(LinphoneCore *lc, int on) { if (on==1) printf("RPC_ENABLE set on\n"); - else + else printf("RPC_ENABLE set off\n"); lc->rpc_enable = (on==1); /* need to tell eXosip the new setting */ @@ -1468,7 +1472,7 @@ int linphone_core_set_rsvp_mode(LinphoneCore *lc, int on) { if (on==1) printf("RSVP_ENABLE set on\n"); - else + else printf("RSVP_ENABLE set off\n"); lc->rsvp_enable = (on==1); /* need to tell eXosip the new setting */ @@ -1484,10 +1488,10 @@ int linphone_core_change_qos(LinphoneCore *lc, int answer) if (lc->call==NULL){ return -1; } - + if (lc->rsvp_enable && answer==1) { - /* answer is yes, local setting is with qos, so + /* answer is yes, local setting is with qos, so * the user chose to continue with no qos ! */ /* so switch in normal mode : ring and 180 */ lc->rsvp_enable = 0; /* no more rsvp */ @@ -1604,7 +1608,7 @@ static void post_configure_audio_streams(LinphoneCore *lc){ ms_filter_call_method(f,MS_VOLUME_SET_EA_FORCE,&force); if (sustain!=-1) ms_filter_call_method(f,MS_VOLUME_SET_EA_SUSTAIN,&sustain); - + } parametrize_equalizer(lc,st); if (lc->vtable.dtmf_received!=NULL){ @@ -1636,7 +1640,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ ms_warning("No card defined for capture !"); goto end; } - if (audio_params->relay_session_id!=NULL) + if (audio_params->relay_session_id!=NULL) audio_stream_set_relay_session_id(lc->audiostream,audio_params->relay_session_id); audio_stream_start_now( lc->audiostream, @@ -1661,7 +1665,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ lc->play_file, lc->rec_file); } - post_configure_audio_streams(lc); + post_configure_audio_streams(lc); audio_stream_set_rtcp_information(lc->audiostream, cname, tool); } #ifdef VIDEO_ENABLED @@ -1673,9 +1677,9 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ } if (lc->video_conf.display || lc->video_conf.capture) { StreamParams *video_params=&call->video_params; - + if (video_params->remoteport>0){ - if (video_params->relay_session_id!=NULL) + if (video_params->relay_session_id!=NULL) video_stream_set_relay_session_id(lc->videostream,video_params->relay_session_id); video_stream_set_sent_video_size(lc->videostream,linphone_core_get_preferred_video_size(lc)); video_stream_enable_self_view(lc->videostream,lc->video_conf.selfview); @@ -1735,11 +1739,11 @@ int linphone_core_accept_call(LinphoneCore *lc, const char *url) LinphoneCall *call=lc->call; int err; bool_t offering=FALSE; - + if (call==NULL){ return -1; } - + if (lc->call->state==LCStateAVRunning){ /*call already accepted*/ return -1; @@ -1771,7 +1775,7 @@ int linphone_core_accept_call(LinphoneCore *lc, const char *url) offering=TRUE; ms_message("generating sdp offer"); sdpmesg=sdp_context_get_offer(call->sdpctx); - + if (sdpmesg==NULL){ ms_error("fail to generate sdp offer !"); return -1; @@ -1786,7 +1790,7 @@ int linphone_core_accept_call(LinphoneCore *lc, const char *url) eXosip_unlock(); lc->vtable.display_status(lc,_("Connected.")); gstate_new_state(lc, GSTATE_CALL_IN_CONNECTED, NULL); - + if (!offering) linphone_core_start_media_streams(lc, lc->call); ms_message("call answered."); return 0; @@ -1799,11 +1803,11 @@ int linphone_core_terminate_call(LinphoneCore *lc, const char *url) return -1; } lc->call=NULL; - + eXosip_lock(); eXosip_call_terminate(call->cid,call->did); eXosip_unlock(); - + /*stop ringing*/ if (lc->ringstream!=NULL) { ring_stop(lc->ringstream); @@ -1853,7 +1857,7 @@ void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away, ms_message("contact url is correct."); } osip_from_free(url); - + } if (contactok>=0){ if (lc->alt_contact!=NULL) ms_free(lc->alt_contact); @@ -1861,7 +1865,7 @@ void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away, } if (lc->presence_mode!=presence_mode){ linphone_core_notify_all_friends(lc,presence_mode); - /* + /* Improve the use of all LINPHONE_STATUS available. !TODO Do not mix "presence status" with "answer status code".. Use correct parameter to follow sip_if_match/sip_etag. @@ -1870,7 +1874,7 @@ void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away, } lc->prev_mode=lc->presence_mode; lc->presence_mode=presence_mode; - + } LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc){ @@ -1915,7 +1919,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){ MSSndCard *sndcard=NULL; if (devid!=NULL){ sndcard=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),devid); - if (sndcard!=NULL && + if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & cap)==0 ){ ms_warning("%s card does not have the %s capability, ignoring.", devid, @@ -1997,7 +2001,7 @@ const char * linphone_core_get_capture_device(LinphoneCore *lc) return lc->sound_conf.capt_sndcard ? ms_snd_card_get_string_id(lc->sound_conf.capt_sndcard) : NULL; } -/* returns a static array of string describing the sound devices */ +/* returns a static array of string describing the sound devices */ const char** linphone_core_get_sound_devices(LinphoneCore *lc){ build_sound_devices_table(lc); return lc->sound_conf.cards; @@ -2025,7 +2029,7 @@ void linphone_core_set_sound_source(LinphoneCore *lc, char source) ms_snd_card_set_capture(sndcard,MS_SND_CARD_LINE); break; } - + } void linphone_core_set_ring(LinphoneCore *lc,const char *path){ @@ -2128,7 +2132,7 @@ void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf) osip_message_set_content_type(msg,"application/dtmf-relay"); snprintf(clen,sizeof(clen),"%lu",(unsigned long)strlen(dtmf_body)); osip_message_set_content_length(msg,clen); - + eXosip_lock(); eXosip_call_send_request(call->did,msg); eXosip_unlock(); @@ -2169,7 +2173,7 @@ static void apply_nat_settings(LinphoneCore *lc){ int err; struct addrinfo hints,*res; const char *addr=lc->net_conf.nat_address; - + if (lc->net_conf.firewall_policy==LINPHONE_POLICY_USE_NAT_ADDRESS){ if (addr==NULL || strlen(addr)==0){ lc->vtable.display_warning(lc,_("No nat/firewall address supplied !")); @@ -2179,7 +2183,7 @@ static void apply_nat_settings(LinphoneCore *lc){ memset(&hints,0,sizeof(struct addrinfo)); if (lc->sip_conf.ipv6_enabled) hints.ai_family=AF_INET6; - else + else hints.ai_family=AF_INET; hints.ai_socktype = SOCK_DGRAM; err=getaddrinfo(addr,NULL,&hints,&res); @@ -2227,7 +2231,7 @@ static void apply_nat_settings(LinphoneCore *lc){ } else { eXosip_set_option(EXOSIP_OPT_SET_IPV4_FOR_GATEWAY,NULL); - eXosip_masquerade_contact("",0); + eXosip_masquerade_contact("",0); } } @@ -2452,7 +2456,7 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file){ } if (file!=NULL) { lc->rec_file=ms_strdup(file); - if (lc->audiostream) + if (lc->audiostream) audio_stream_record(lc->audiostream,file); } } @@ -2512,7 +2516,7 @@ void net_config_uninit(LinphoneCore *lc) net_config_t *config=&lc->net_conf; lp_config_set_int(lc->config,"net","download_bw",config->download_bw); lp_config_set_int(lc->config,"net","upload_bw",config->upload_bw); - + if (config->stun_server!=NULL) lp_config_set_string(lc->config,"net","stun_server",config->stun_server); if (config->nat_address!=NULL) @@ -2557,9 +2561,9 @@ void sip_config_uninit(LinphoneCore *lc) #endif } } - + 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++){ LinphoneAuthInfo *ai=(LinphoneAuthInfo*)(elem->data); linphone_auth_info_write_config(lc->config,ai,i); @@ -2581,9 +2585,9 @@ void sound_config_uninit(LinphoneCore *lc) { sound_config_t *config=&lc->sound_conf; ms_free(config->cards); - + lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring); - + if (config->local_ring) ms_free(config->local_ring); if (config->remote_ring) ms_free(config->remote_ring); ms_snd_card_manager_destroy(); @@ -2591,7 +2595,7 @@ void sound_config_uninit(LinphoneCore *lc) void video_config_uninit(LinphoneCore *lc) { - + } void codecs_config_uninit(LinphoneCore *lc) @@ -2670,7 +2674,7 @@ void linphone_core_uninit(LinphoneCore *lc) sip_setup_unregister_all(); linphone_core_free_payload_types(); - + ortp_exit(); eXosip_quit(); exosip_running=FALSE; diff --git a/linphone/coreapi/misc.c b/linphone/coreapi/misc.c index 0d4baf42f..eca072491 100644 --- a/linphone/coreapi/misc.c +++ b/linphone/coreapi/misc.c @@ -22,18 +22,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/mediastream.h" #include #include +#ifdef HAVE_SIGHANDLER_T #include +#endif /*HAVE_SIGHANDLER_T*/ #include #include #include #include #include - +#include #undef snprintf #include -#ifndef WIN32 + +#if !defined(WIN32) static char lock_name[80]; static char lock_set=0; @@ -41,7 +44,7 @@ static char lock_set=0; int set_lock_file() { FILE *lockfile; - + snprintf(lock_name,80,"/tmp/linphone.%i",getuid()); lockfile=fopen(lock_name,"w"); if (lockfile==NULL) @@ -60,7 +63,7 @@ int get_lock_file() { int pid; FILE *lockfile; - + snprintf(lock_name,80,"/tmp/linphone.%i",getuid()); lockfile=fopen(lock_name,"r"); if (lockfile==NULL) @@ -104,7 +107,7 @@ void check_sound_device(LinphoneCore *lc) char *snd_pcm_oss=NULL; char *snd_mixer_oss=NULL; char *snd_pcm=NULL; - + fd=open("/proc/modules",O_RDONLY); if (fd>0){ /* read the entire /proc/modules file and check if sound conf seems correct */ @@ -144,7 +147,7 @@ void check_sound_device(LinphoneCore *lc) } /* now check general volume. Some user forget to rise it and then complain that linphone is not working */ - /* but some other users complain that linphone should not change levels... + /* but some other users complain that linphone should not change levels... if (lc->sound_conf.sndcard!=NULL){ a=snd_card_get_level(lc->sound_conf.sndcard,SND_CARD_LEVEL_GENERAL); if (a<50){ @@ -164,12 +167,12 @@ void check_sound_device(LinphoneCore *lc) const char *payload_type_get_description(PayloadType *pt){ return _((const char *)pt->user_data); -} +} -void payload_type_set_enable(PayloadType *pt,int value) +void payload_type_set_enable(PayloadType *pt,int value) { if ((value)!=0) payload_type_set_flag(pt,PAYLOAD_TYPE_ENABLED); \ - else payload_type_unset_flag(pt,PAYLOAD_TYPE_ENABLED); + else payload_type_unset_flag(pt,PAYLOAD_TYPE_ENABLED); } @@ -266,7 +269,7 @@ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType /*let the video use all the bandwidth minus the maximum bandwidth used by audio */ if (min_video_bw>0) pt->normal_bitrate=min_video_bw*1000; - else + else pt->normal_bitrate=1500000; /*around 1.5 Mbit/s*/ ret=TRUE; } @@ -274,7 +277,7 @@ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType break; } /*if (!ret) ms_warning("Payload %s is not usable with your internet connection.",pt->mime_type);*/ - + return ret; } @@ -284,7 +287,7 @@ static PayloadType * find_payload(RtpProfile *prof, PayloadType *pt /*from confi PayloadType *it; for(i=0;i<127;++i){ it=rtp_profile_get_payload(prof,i); - if (it!=NULL && strcasecmp(pt->mime_type,it->mime_type)==0 + if (it!=NULL && strcasecmp(pt->mime_type,it->mime_type)==0 && (pt->clock_rate==it->clock_rate || pt->clock_rate<=0) && payload_type_get_user_data(it)==NULL ){ if ( (pt->recv_fmtp && it->recv_fmtp && strcasecmp(pt->recv_fmtp,it->recv_fmtp)==0) || @@ -316,7 +319,7 @@ static MSList *fix_codec_list(RtpProfile *prof, MSList *conflist) MSList *elem; MSList *newlist=NULL; PayloadType *payload,*confpayload; - + for (elem=conflist;elem!=NULL;elem=ms_list_next(elem)) { confpayload=(PayloadType*)elem->data; @@ -350,12 +353,12 @@ void linphone_core_setup_local_rtp_profile(LinphoneCore *lc) PayloadType *payload; bool_t prepend; lc->local_profile=rtp_profile_clone_full(&av_profile); - - /* first look at the list given by configuration file to see if + + /* first look at the list given by configuration file to see if it is correct */ audiopt=fix_codec_list(lc->local_profile,lc->codecs_conf.audio_codecs); videopt=fix_codec_list(lc->local_profile,lc->codecs_conf.video_codecs); - + /* now find and add payloads that are not listed in the configuration codec list */ for (i=0;i<127;i++) @@ -384,7 +387,7 @@ void linphone_core_setup_local_rtp_profile(LinphoneCore *lc) case PAYLOAD_AUDIO_CONTINUOUS: case PAYLOAD_AUDIO_PACKETIZED: if (prepend) - audiopt=ms_list_prepend(audiopt,(void *)payload); + audiopt=ms_list_prepend(audiopt,(void *)payload); else audiopt=ms_list_append(audiopt,(void *)payload); break; @@ -427,6 +430,7 @@ int from_2char_without_params(osip_from_t *from,char **str) } bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret){ +#if !defined(_WIN32_WCE) FILE *f=popen(command,"r"); if (f!=NULL){ int err; @@ -442,6 +446,7 @@ bool_t lp_spawn_command_line_sync(const char *command, char **result,int *comman if (command_ret!=NULL) *command_ret=err; return TRUE; } +#endif /*_WIN32_WCE*/ return FALSE; } @@ -454,12 +459,12 @@ bool_t host_has_ipv6_network() struct ifaddrs *ifp; struct ifaddrs *ifpstart; bool_t ipv6_present=FALSE; - + if (getifaddrs (&ifpstart) < 0) { return FALSE; } - + for (ifp=ifpstart; ifp != NULL; ifp = ifp->ifa_next) { if (!ifp->ifa_addr) @@ -467,7 +472,7 @@ bool_t host_has_ipv6_network() switch (ifp->ifa_addr->sa_family) { case AF_INET: - + break; case AF_INET6: ipv6_present=TRUE; @@ -608,7 +613,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ } if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,_("Stun lookup in progress...")); - + /*create the two audio and video RTP sockets, and send STUN message to our stun server */ sock1=create_socket(linphone_core_get_audio_port(lc)); if (sock1<0) return; diff --git a/linphone/mediastreamer2/configure.ac b/linphone/mediastreamer2/configure.ac index ea26ee637..2dd9ed7e0 100644 --- a/linphone/mediastreamer2/configure.ac +++ b/linphone/mediastreamer2/configure.ac @@ -138,9 +138,10 @@ case $target_os in CFLAGS="$CFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -D_WIN32_WCE -DORTP_STATIC" CXXFLAGS="$CXXFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC -D_WIN32_WCE" dnl ORTP_STATIC to tell ortp not to export its variable with dllexport, as if we were building statically, or dynamically on linux - LIBS="$LIBS -lws2" + LIBS="$LIBS -lws2" mingw_found=yes - ;; + build_tests=no + ;; *mingw*) CFLAGS="$CFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC" CXXFLAGS="$CXXFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC" @@ -158,6 +159,8 @@ esac AM_CONDITIONAL(BUILD_MACOSX, test x$macosx_found = xyes) +AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno) + AC_CONFIG_COMMANDS([libtool-hacking],[ if test "$mingw_found" = "yes" ; then echo "Hacking libtool to work with mingw..." diff --git a/linphone/mediastreamer2/tests/Makefile.am b/linphone/mediastreamer2/tests/Makefile.am index b6e16f9cf..443b0edf1 100644 --- a/linphone/mediastreamer2/tests/Makefile.am +++ b/linphone/mediastreamer2/tests/Makefile.am @@ -1,3 +1,5 @@ +if BUILD_TESTS + noinst_PROGRAMS=echo ring mtudiscover bench if BUILD_VIDEO @@ -31,3 +33,5 @@ INCLUDES=-I$(top_srcdir)/include/ AM_CFLAGS=-I$(top_srcdir) $(ORTP_CFLAGS) $(STRICT_OPTIONS) $(VIDEO_CFLAGS) AM_LDFLAGS=-rdynamic + +endif diff --git a/linphone/patches/libeXosip2-wince.patch b/linphone/patches/libeXosip2-wince.patch new file mode 100644 index 000000000..a6b8244c3 --- /dev/null +++ b/linphone/patches/libeXosip2-wince.patch @@ -0,0 +1,12 @@ +Index: src/eXutils.c +=================================================================== +--- src/eXutils.c (revision 1047) ++++ src/eXutils.c (working copy) +@@ -26,6 +26,7 @@ + #include "eXosip2.h" + + #if defined(_WIN32_WCE) ++#include + #elif defined(WIN32) + #include + #include diff --git a/linphone/patches/libosip2-wince.patch b/linphone/patches/libosip2-wince.patch new file mode 100644 index 000000000..8925e6269 --- /dev/null +++ b/linphone/patches/libosip2-wince.patch @@ -0,0 +1,13 @@ +Index: include/osip2/internal.h +=================================================================== +--- include/osip2/internal.h (revision 797) ++++ include/osip2/internal.h (working copy) +@@ -216,7 +216,7 @@ + #include + #undef _WINSOCKAPI_ + +-#if (_WIN32_WINNT >= 0x0403) ++#if (_WIN32_WINNT >= 0x0403) && !defined(_WIN32_WCE) + + #define OSIP_CRITICALSECTION_SPIN 4000 + typedef struct diff --git a/linphone/scripts/builder-arm-ming32ce.mk b/linphone/scripts/builder-arm-ming32ce.mk index 495901f1b..d96b2ee0b 100644 --- a/linphone/scripts/builder-arm-ming32ce.mk +++ b/linphone/scripts/builder-arm-ming32ce.mk @@ -1,11 +1,33 @@ +############################################################################ +# builder-arm-mingw32ce.mk +# Copyright (C) 2009 Belledonne Communications,Grenoble France +# +############################################################################ + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU General Public License + # as published by the Free Software Foundation; either version 2 + # of the License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # +############################################################################ host:=armv4-mingw32ce -config_site:=cegcc-config.site -library_mode:="" -libosip2_version:=svn -libeXosip2_version:=svn +config_site:=mingw32ce-config.site +library_mode:= --disable-shared --enable-static +libosip2_version:=797 +libeXosip2_version:=1047 linphone_configure_controls?= --disable-video \ --with-readline=none \ --enable-gtk_ui=no \ + --enable-console_ui=no \ --enable-ssl-hmac=no \ SPEEX_CFLAGS="-I$(prefix)/include" \ SPEEX_LIBS="-L$(prefix)/lib -lspeex " diff --git a/linphone/scripts/builder-generic.mk b/linphone/scripts/builder-generic.mk index 59fc53e8e..fb27308cc 100644 --- a/linphone/scripts/builder-generic.mk +++ b/linphone/scripts/builder-generic.mk @@ -1,3 +1,25 @@ +############################################################################ +# builder-generic.mk +# Copyright (C) 2009 Belledonne Communications,Grenoble France +# +############################################################################ + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU General Public License + # as published by the Free Software Foundation; either version 2 + # of the License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # +############################################################################ + host?=armv6-apple-darwin config_site?=iphone-config.site library_mode?= --disable-shared @@ -55,11 +77,15 @@ build-liblinphone: $(LINPHONE_SRC_DIR)/Makefile clean-makefile-liblinphone: cd $(LINPHONE_SRC_DIR) && rm Makefile && rm oRTP/Makefile && rm mediastreamer2/Makefile +clean-liblinphone: + cd $(LINPHONE_SRC_DIR) && make clean #osip2 get_osip2_svn: cd $(LINPHONE_SRC_DIR)/ \ - && svn co svn://svn.sv.gnu.org/osip/trunk/osip libosip2-$(libosip2_version) + && svn co -r ${libosip2_version} svn://svn.sv.gnu.org/osip/trunk/osip libosip2-$(libosip2_version) \ + && cd libosip2-$(libosip2_version) \ + && patch -p0 < $(LINPHONE_SRC_DIR)/patches/libosip2-wince.patch get_osip2_src: cd $(LINPHONE_SRC_DIR)/ \ && rm -f libosip2-$(libosip2_version).tar.gz \ @@ -93,7 +119,9 @@ clean-makefile-osip2: get_eXosip2_svn: cd $(LINPHONE_SRC_DIR)/ \ - && svn co svn://svn.sv.gnu.org/exosip/trunk/exosip libeXosip2-$(libeXosip2_version) + && svn co -r ${libeXosip2_version} svn://svn.sv.gnu.org/exosip/trunk/exosip libeXosip2-$(libeXosip2_version)\ + && cd libeXosip2-$(libeXosip2_version) \ + && patch -p0 < $(LINPHONE_SRC_DIR)/patches/libeXosip2-wince.patch get_eXosip2_src: cd $(LINPHONE_SRC_DIR)/ \ diff --git a/linphone/scripts/cegcc-config.site b/linphone/scripts/cegcc-config.site deleted file mode 100644 index 8ffc17354..000000000 --- a/linphone/scripts/cegcc-config.site +++ /dev/null @@ -1,17 +0,0 @@ -# -*- shell-script -*- - - -ARCH=arm4l -SDK_BIN_PATH=/opt/mingw32ce/bin -SYSROOT_PATH=/opt/mingw32ce - -CC="${SDK_BIN_PATH}/arm-mingw32ce-gcc -isysroot=${SYSROOT_PATH}" -CXX="${SDK_BIN_PATH}/arm-mingw32ce-g++ -isysroot=${SYSROOT_PATH}" -LD="${SDK_BIN_PATH}/arm-mingw32ce-ld " -AR=${SDK_BIN_PATH}/arm-mingw32ce-ar -RANLIB=${SDK_BIN_PATH}/arm-mingw32ce-ranlib - -CPPFLAGS="-D_WIN32_WCE -DUNICODE -Drewind=" -#CFLAGS="-D_WIN32_WCE" -#LDFLAGS="-Wl,-syslibroot ${SYSROOT_PATH}" -LDFLAGS="-Wl,-L${SYSROOT_PATH}/arm-mingw32ce/lib -lws2" diff --git a/linphone/scripts/mingw32ce-config.site b/linphone/scripts/mingw32ce-config.site new file mode 100644 index 000000000..c82747f34 --- /dev/null +++ b/linphone/scripts/mingw32ce-config.site @@ -0,0 +1,34 @@ +############################################################################ +# mingw32ce-config.site +# Copyright (C) 2009 Belledonne Communications,Grenoble France +# +############################################################################ + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU General Public License + # as published by the Free Software Foundation; either version 2 + # of the License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # +############################################################################ + + +SDK_BIN_PATH=/opt/mingw32ce/bin +SYSROOT_PATH=/opt/mingw32ce + +CC="${SDK_BIN_PATH}/arm-mingw32ce-gcc -isysroot=${SYSROOT_PATH}" +CXX="${SDK_BIN_PATH}/arm-mingw32ce-g++ -isysroot=${SYSROOT_PATH}" +LD="${SDK_BIN_PATH}/arm-mingw32ce-ld " +AR=${SDK_BIN_PATH}/arm-mingw32ce-ar +RANLIB=${SDK_BIN_PATH}/arm-mingw32ce-ranlib + +CPPFLAGS="-D_WIN32_WCE -DUNICODE -Drewind=" +LDFLAGS="-L${SYSROOT_PATH}/arm-mingw32ce/lib -lws2"