diff --git a/console/commands.c b/console/commands.c index 99e2b4a..b43e90e 100644 --- a/console/commands.c +++ b/console/commands.c @@ -2018,14 +2018,13 @@ static int lpc_cmd_codec(int type, LinphoneCore *lc, char *args){ static void linphonec_codec_list(int type, LinphoneCore *lc){ PayloadType *pt; - codecs_config_t *config=&lc->codecs_conf; int index=0; MSList *node=NULL; if (type == AUDIO) { - node=config->audio_codecs; + node=(MSList *)linphone_core_get_audio_codecs(lc); } else if(type==VIDEO) { - node=config->video_codecs; + node=(MSList *)linphone_core_get_video_codecs(lc); } for(;node!=NULL;node=ms_list_next(node)){ @@ -2038,15 +2037,14 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){ PayloadType *pt; - codecs_config_t *config=&lc->codecs_conf; int index=0; MSList *node=NULL; - if (type == AUDIO) { - node=config->audio_codecs; - } else if(type==VIDEO) { - node=config->video_codecs; - } + if (type == AUDIO) { + node=(MSList *)linphone_core_get_audio_codecs(lc); + } else if(type==VIDEO) { + node=(MSList *)linphone_core_get_video_codecs(lc); + } for(;node!=NULL;node=ms_list_next(node)){ if (index == sel_index || sel_index == -1) { @@ -2060,15 +2058,14 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){ static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){ PayloadType *pt; - codecs_config_t *config=&lc->codecs_conf; int index=0; MSList *node=NULL; - if (type == AUDIO) { - node=config->audio_codecs; - } else if(type==VIDEO) { - node=config->video_codecs; - } + if (type == AUDIO) { + node=(MSList *)linphone_core_get_audio_codecs(lc); + } else if(type==VIDEO) { + node=(MSList *)linphone_core_get_video_codecs(lc); + } for(;node!=NULL;node=ms_list_next(node)){ if (index == sel_index || sel_index == -1) { diff --git a/console/linphonec.c b/console/linphonec.c index 6985287..784bce8 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -160,6 +160,7 @@ LPC_AUTH_STACK auth_stack; static int trace_level = 0; static char *logfile_name = NULL; static char configfile_name[PATH_MAX]; +static const char *factory_configfile_name=NULL; static char *sipAddr = NULL; /* for autocall */ #if !defined(_WIN32_WCE) static ortp_pipe_t client_sock=ORTP_PIPE_INVALID; @@ -683,8 +684,7 @@ linphonec_init(int argc, char **argv) /* * Initialize linphone core */ - linphonec=linphone_core_new (&linphonec_vtable, configfile_name, NULL, - NULL); + linphonec=linphone_core_new (&linphonec_vtable, configfile_name, factory_configfile_name, NULL); linphone_core_enable_video(linphonec,vcap_enabled,display_enabled); linphone_core_enable_video_preview(linphonec,preview_enabled); if (!(vcap_enabled || display_enabled)) printf("Warning: video is disabled in linphonec, use -V or -C or -D to enable.\n"); @@ -834,6 +834,7 @@ print_usage (int exit_status) usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\ linphonec -v\n\ \n\ + -b file specify path of readonly factory configuration file.\n\ -c file specify path of configuration file.\n\ -d level be verbose. 0 is no output. 6 is all output\n\ -l logfile specify the log file for your SIP phone\n\ @@ -1127,6 +1128,20 @@ linphonec_parse_cmdline(int argc, char **argv) #endif /*_WIN32_WCE*/ snprintf(configfile_name, PATH_MAX, "%s", argv[arg_num]); } + else if (strncmp ("-b", argv[arg_num], 2) == 0) + { + if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE); +#if !defined(_WIN32_WCE) + if (access(argv[arg_num],F_OK)!=0 ) + { + fprintf (stderr, + "Cannot open config file %s.\n", + argv[arg_num]); + exit(EXIT_FAILURE); + } +#endif /*_WIN32_WCE*/ + factory_configfile_name = argv[arg_num]; + } else if (strncmp ("-s", argv[arg_num], 2) == 0) { arg_num++; diff --git a/coreapi/chat.c b/coreapi/chat.c index 9ee7048..5625a97 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -52,10 +52,11 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){ const char *identity=linphone_core_get_identity(cr->lc); SalOp *op; - if(linphone_core_is_in_communication_with(cr->lc,cr->peer)) + LinphoneCall *call; + if((call = linphone_core_is_in_communication_with(cr->lc,cr->peer))!=NULL) { ms_message("send SIP message into the call\n"); - op = (linphone_core_get_current_call(cr->lc))->op; + op = call->op; } else { diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 0d3bfcd..27b6298 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -46,12 +46,12 @@ static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, bool_t on return l; } -SalMediaDescription *create_local_media_description(LinphoneCore *lc, +SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call, bool_t with_video, bool_t only_one_codec){ MSList *l; PayloadType *pt; const char *username=(call->dir==LinphoneCallOutgoing) ? - linphone_address_get_username(call->log->from): linphone_address_get_username(call->log->to); + linphone_address_get_username(call->log->from): linphone_address_get_username(call->log->to); SalMediaDescription *md=sal_media_description_new(); md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); @@ -180,7 +180,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip); linphone_call_init_common(call, from, to); call->localdesc=create_local_media_description (lc,call, - linphone_core_video_enabled(lc),lc->sip_conf.only_one_codec); + linphone_core_video_enabled(lc),lc->sip_conf.only_one_codec); if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) linphone_core_run_stun_tests(call->core,call); discover_mtu(lc,linphone_address_get_domain(from)); @@ -467,6 +467,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ #ifdef VIDEO_ENABLED if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); + if( lc->video_conf.displaytype != NULL) + video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); #ifdef TEST_EXT_RENDERER video_stream_set_render_callback(call->videostream,rendercb,NULL); #endif diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 384943a..7db7767 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -350,8 +350,7 @@ void linphone_core_disable_logs(){ } -static void -net_config_read (LinphoneCore *lc) +static void net_config_read (LinphoneCore *lc) { int tmp; const char *tmpstr; @@ -761,6 +760,9 @@ static void video_config_read(LinphoneCore *lc){ capture=lp_config_get_int(lc->config,"video","capture",enabled); display=lp_config_get_int(lc->config,"video","display",enabled); self_view=lp_config_get_int(lc->config,"video","self_view",enabled); + lc->video_conf.displaytype=lp_config_get_string(lc->config,"video","displaytype",NULL); + if(lc->video_conf.displaytype) + ms_message("we are using a specific display:%s\n",lc->video_conf.displaytype); #ifdef VIDEO_ENABLED linphone_core_enable_video(lc,capture,display); linphone_core_enable_self_view(lc,self_view); @@ -1819,23 +1821,21 @@ const char * linphone_core_get_route(LinphoneCore *lc){ return route; } -bool_t linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to) +LinphoneCall * linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to) { - char *tmp; - bool_t returned; - const LinphoneAddress *la=linphone_core_get_current_call_remote_address(lc); - if(la == NULL) - { - return FALSE; + MSList *elem; + for(elem=lc->calls;elem!=NULL;elem=elem->next){ + LinphoneCall *call=(LinphoneCall*)elem->data; + const LinphoneAddress *la = linphone_call_get_remote_address(call); + if(la != NULL) + { + if(!strcmp(linphone_address_as_string(la),to)) + { + return call; + } + } } - tmp = linphone_address_as_string(la); - if(!strcmp(tmp,to)) - returned = TRUE; - else - returned = FALSE; - if(tmp) - ms_free(tmp); - return returned; + return NULL; } void linphone_core_start_pending_refered_calls(LinphoneCore *lc){ @@ -1979,7 +1979,6 @@ LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){ return call; } - /** * Initiates an outgoing call according to supplied call parameters * @@ -2010,7 +2009,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. @@ -2156,7 +2155,7 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){ **/ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params){ int err; - + if (call->localdesc) sal_media_description_unref(call->localdesc); call->localdesc=create_local_media_description (lc,call, @@ -2167,7 +2166,6 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, LinphoneCall return err; } - /** * Accept an incoming call. * @@ -3062,7 +3060,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){ if (val){ if (lc->previewstream==NULL){ lc->previewstream=video_preview_start(lc->video_conf.device, - lc->video_conf.vsize); + lc->video_conf.vsize,lc->video_conf.displaytype); } }else{ if (lc->previewstream!=NULL){ diff --git a/coreapi/private.h b/coreapi/private.h index 943bd29..5da575b 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -184,7 +184,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call); const char * linphone_core_get_identity(LinphoneCore *lc); const char * linphone_core_get_route(LinphoneCore *lc); -bool_t linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to); +LinphoneCall * linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to); void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose); void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses); void linphone_core_stop_waiting(LinphoneCore *lc); @@ -334,6 +334,7 @@ typedef struct video_config{ bool_t show_local; bool_t display; bool_t selfview; /*during calls*/ + const char *displaytype; }video_config_t; typedef struct ui_config @@ -419,7 +420,7 @@ int linphone_core_get_calls_nb(const LinphoneCore *lc); void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); -SalMediaDescription *create_local_media_description(LinphoneCore *lc, +SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call, bool_t with_video, bool_t only_one_codec); #define HOLD_OFF (0) diff --git a/coreapi/test_lsd.c b/coreapi/test_lsd.c index a4e78ea..dfb3375 100644 --- a/coreapi/test_lsd.c +++ b/coreapi/test_lsd.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphonecore_utils.h" - +#include "mediastreamer2/mediastream.h" static void play_finished(LsdPlayer *p){ const char *filename=(const char *)lsd_player_get_user_pointer (p);