From 696fdb8476cf5d2752017259e84445fd7ab55eb0 Mon Sep 17 00:00:00 2001 From: Simon Morlat <simon.morlat@linphone.org> Date: Thu, 16 Sep 2010 22:57:09 +0200 Subject: [PATCH] improve states naming --- configure.in | 2 +- console/commands.c | 40 ++++++++++++++++++++++++++-------------- coreapi/linphonecall.c | 1 - coreapi/linphonecore.c | 3 ++- coreapi/private.h | 1 + coreapi/sal.c | 10 ++++++++-- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/configure.in b/configure.in index 57862bdb25..fc1c4c0a79 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.3.99.2],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.3.99.3],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM dnl Source packaging numbers diff --git a/console/commands.c b/console/commands.c index 9e37b3569d..619746cda1 100644 --- a/console/commands.c +++ b/console/commands.c @@ -2198,7 +2198,7 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){ } static void lpc_display_global_state(LinphoneCore *lc){ - linphonec_out("****************Global liblinphone state********************\n\t%s", + linphonec_out("Global liblinphone state\n%s\n", linphone_global_state_to_string(linphone_core_get_global_state(lc))); } @@ -2206,24 +2206,36 @@ static void lpc_display_call_states(LinphoneCore *lc){ LinphoneCall *call; const MSList *elem; char *tmp; - linphonec_out("****************Calls states*******************************\nId | Destination | State\n"); - - for(elem=linphone_core_get_calls(lc);elem!=NULL;elem=elem->next){ - call=(LinphoneCall*)elem->data; - tmp=linphone_call_get_remote_address_as_string (call); - linphonec_out("%2.2i|%10.10s|%s",(int)(long)linphone_call_get_user_pointer(call), - tmp,linphone_call_state_to_string(linphone_call_get_state(call))); - ms_free(tmp); + linphonec_out("Call states\n" + "Id | Destination | State\n" + "---------------------------------------------------------------\n"); + elem=linphone_core_get_calls(lc); + if (elem==NULL){ + linphonec_out("(empty)\n"); + }else{ + for(;elem!=NULL;elem=elem->next){ + call=(LinphoneCall*)elem->data; + tmp=linphone_call_get_remote_address_as_string (call); + linphonec_out("%-2i | %-35s | %s\n",(int)(long)linphone_call_get_user_pointer(call), + tmp,linphone_call_state_to_string(linphone_call_get_state(call))); + ms_free(tmp); + } } } static void lpc_display_proxy_states(LinphoneCore *lc){ const MSList *elem; - linphonec_out("****************Proxy registration states*****************\nIdentity | State\n"); - for(elem=linphone_core_get_proxy_config_list (lc);elem!=NULL;elem=elem->next){ - LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; - linphonec_out("%20.10s | %s",linphone_proxy_config_get_identity (cfg), - linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg))); + linphonec_out("Proxy registration states\n" + " Identity | State\n" + "------------------------------------------------------------\n"); + elem=linphone_core_get_proxy_config_list (lc); + if (elem==NULL) linphonec_out("(empty)\n"); + else { + for(;elem!=NULL;elem=elem->next){ + LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; + linphonec_out("%-40s | %s\n",linphone_proxy_config_get_identity (cfg), + linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg))); + } } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 338c84336c..812fa8cf78 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -655,7 +655,6 @@ void linphone_call_start_media_streams(LinphoneCall *call){ if (captcard==NULL) { ms_warning("No card defined for capture !"); } - ms_message("streamdir is %i",stream->dir); /*Replace soundcard filters by inactive file players or recorders when placed in recvonly or sendonly mode*/ if (stream->port==0 || stream->dir==SalStreamRecvOnly){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e4e4b14f8b..b35ea38d72 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -903,6 +903,7 @@ static void linphone_core_free_payload_types(void){ } void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message){ + lc->state=gstate; if (lc->vtable.global_state_changed){ lc->vtable.global_state_changed(lc,gstate,message); } @@ -3835,5 +3836,5 @@ const char *linphone_global_state_to_string(LinphoneGlobalState gs){ } LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){ - return LinphoneGlobalOn; + return lc->state; } diff --git a/coreapi/private.h b/coreapi/private.h index fdf9b1f334..b9e33b0490 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -355,6 +355,7 @@ struct _LinphoneCore { LinphoneCoreVTable vtable; Sal *sal; + LinphoneGlobalState state; struct _LpConfig *config; net_config_t net_conf; sip_config_t sip_conf; diff --git a/coreapi/sal.c b/coreapi/sal.c index 463884d709..ca5b4d815b 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -81,11 +81,17 @@ void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_ bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){ int i; + bool_t found=FALSE; + + /* we are looking for at least one stream with requested direction, inactive streams are ignored*/ for(i=0;i<md->nstreams;++i){ const SalStreamDescription *ss=&md->streams[i]; - if (ss->dir==stream_dir) return TRUE; + if (ss->dir==stream_dir) found=TRUE; + else{ + if (ss->dir!=SalStreamInactive) return FALSE; + } } - return FALSE; + return found; } static void assign_string(char **str, const char *arg){ -- GitLab