diff --git a/configure.ac b/configure.ac index 34485363c..5f803f662 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([linphone],[3.3.99.6],[linphone-developers@nongnu.org]) +AC_INIT([linphone],[3.3.99.7],[linphone-developers@nongnu.org]) AC_CANONICAL_SYSTEM AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) diff --git a/console/Makefile.am b/console/Makefile.am index bef1e90d1..cf6a336ed 100644 --- a/console/Makefile.am +++ b/console/Makefile.am @@ -51,6 +51,3 @@ linphonecsh_LDADD = $(ORTP_LIBS) endif - - - diff --git a/console/commands.c b/console/commands.c index 51314ccb1..d22d4b818 100644 --- a/console/commands.c +++ b/console/commands.c @@ -91,6 +91,7 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args); #ifdef VIDEO_ENABLED static int lpc_cmd_camera(LinphoneCore *lc, char *args); static int lpc_cmd_video_window(LinphoneCore *lc, char *args); +static int lpc_cmd_preview_window(LinphoneCore *lc, char *args); static int lpc_cmd_snapshot(LinphoneCore *lc, char *args); #endif static int lpc_cmd_states(LinphoneCore *lc, char *args); @@ -125,7 +126,7 @@ static LPC_COMMAND *lpc_find_command(const char *name); void linphonec_out(const char *fmt,...); VideoParams lpc_video_params={-1,-1,-1,-1,0,TRUE}; - +VideoParams lpc_preview_params={-1,-1,-1,-1,0,TRUE}; /*************************************************************************** * @@ -273,7 +274,17 @@ static LPC_COMMAND advanced_commands[] = { "'vwindow show': shows video window\n" "'vwindow hide': hides video window\n" "'vwindow pos ': Moves video window to x,y pixel coordinates\n" - "'vwindow size ': Resizes video window" + "'vwindow size ': Resizes video window\n" + "'vwindow id ': embeds video display into supplied window id." + }, + { "pwindow", lpc_cmd_preview_window, "Control local camera video display (preview window)", + "'pwindow show': shows the local camera video display\n" + "'pwindow hide': hides the local camera video display\n" + "'pwindow pos ': Moves preview window to x,y pixel coordinates\n" + "'pwindow size ': Resizes preview window\n" + "'pwindow id ': embeds preview display into supplied window id.\n" + "'pwindow integrated': integrate preview display within the video window of current call.\n" + "'pwindow standalone': use standalone window for preview display." }, { "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream", "'snapshot ': take a snapshot and records it in jpeg format into the supplied path\n" @@ -2200,44 +2211,62 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args) } #ifdef VIDEO_ENABLED -static int lpc_cmd_video_window(LinphoneCore *lc, char *args){ +static int _lpc_cmd_video_window(LinphoneCore *lc, char *args, bool_t is_preview){ char subcommand[64]; int a,b; int err; + VideoParams *params=is_preview ? &lpc_preview_params : &lpc_video_params; if (!args) return 0; err=sscanf(args,"%s %i %i",subcommand,&a,&b); if (err>=1){ if (strcmp(subcommand,"pos")==0){ if (err<3) return 0; - lpc_video_params.x=a; - lpc_video_params.y=b; - lpc_video_params.refresh=TRUE; + params->x=a; + params->y=b; + params->refresh=TRUE; }else if (strcmp(subcommand,"size")==0){ if (err<3) return 0; - lpc_video_params.w=a; - lpc_video_params.h=b; - lpc_video_params.refresh=TRUE; + params->w=a; + params->h=b; + params->refresh=TRUE; }else if (strcmp(subcommand,"show")==0){ - lpc_video_params.show=TRUE; - lpc_video_params.refresh=TRUE; + params->show=TRUE; + params->refresh=TRUE; + if (is_preview) linphone_core_enable_video_preview (lc,TRUE); }else if (strcmp(subcommand,"hide")==0){ - lpc_video_params.show=FALSE; - lpc_video_params.refresh=TRUE; + params->show=FALSE; + params->refresh=TRUE; + if (is_preview) linphone_core_enable_video_preview (lc,FALSE); }else if (strcmp(subcommand,"id")==0){ - static char envbuf[128]; if (err == 1){ - linphonec_out("vwindow id: 0x%x / SDL_WINDOWID='%s'\n",(unsigned int)lpc_video_params.wid, getenv("SDL_WINDOWID")); + linphonec_out("vwindow id: 0x%x\n",is_preview ? linphone_core_get_native_preview_window_id (lc) : + linphone_core_get_native_video_window_id (lc)); return 1; } else if (err != 2) return 0; - lpc_video_params.wid=a; - snprintf(envbuf, sizeof(envbuf)-1, "SDL_WINDOWID=0x%x", (unsigned int)lpc_video_params.wid); - err = putenv(envbuf); - linphonec_out("vwindow id: 0x%x / SDL_WNIDOWID='%s'\n",(unsigned int)lpc_video_params.wid, getenv("SDL_WINDOWID")); + params->wid=a; + if (is_preview) + linphone_core_set_native_preview_window_id (lc,a); + else + linphone_core_set_native_video_window_id(lc,a); + }else if (is_preview==TRUE){ + if (strcmp(subcommand,"integrated")==0){ + linphone_core_use_preview_window (lc,FALSE); + }else if (strcmp(subcommand,"standalone")==0){ + linphone_core_use_preview_window(lc,TRUE); + }else return 0; }else return 0; } return 1; } + +static int lpc_cmd_video_window(LinphoneCore *lc, char *args){ + return _lpc_cmd_video_window(lc, args, FALSE); +} + +static int lpc_cmd_preview_window(LinphoneCore *lc, char *args){ + return _lpc_cmd_video_window(lc, args, TRUE); +} #endif static void lpc_display_global_state(LinphoneCore *lc){ diff --git a/console/linphonec.c b/console/linphonec.c index fa169466c..d61e39115 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -177,7 +177,6 @@ static ortp_pipe_t server_sock; bool_t linphonec_camera_enabled=TRUE; -extern VideoParams lpc_video_params; void linphonec_call_identify(LinphoneCall* call){ static long callid=1; @@ -869,63 +868,68 @@ usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\ #ifdef VIDEO_ENABLED #ifdef HAVE_X11_XLIB_H -static void sdl_x11_apply_video_params(){ - static SDL_SysWMinfo info; - bool_t wminfo_ready=FALSE; - - - SDL_VERSION(&info.version); - if ( SDL_GetWMInfo(&info) ) { - if ( info.subsystem == SDL_SYSWM_X11 ) { - wminfo_ready=TRUE; - } +static void x11_apply_video_params(VideoParams *params, Window window){ + XWindowChanges wc; + unsigned int flags=0; + static Display *display = NULL; + const char *dname=getenv("DISPLAY"); + + if (display==NULL && dname!=NULL){ + display=XOpenDisplay(dname); } - - if ( !wminfo_ready) return; - - { - XWindowChanges wc; - unsigned int flags=0; - Display *display = info.info.x11.display; - Window window = info.info.x11.wmwindow; - - memset(&wc,0,sizeof(wc)); - wc.x=lpc_video_params.x; - wc.y=lpc_video_params.y; - wc.width=lpc_video_params.w; - wc.height=lpc_video_params.h; - if (lpc_video_params.x!=-1 ){ - flags|=CWX|CWY; - } - if (lpc_video_params.w!=-1){ - flags|=CWWidth|CWHeight; - } - info.info.x11.lock_func(); - XConfigureWindow(display,window,flags,&wc); - if (lpc_video_params.show) - XMapWindow(display,window); - else - XUnmapWindow(display,window); - info.info.x11.unlock_func(); + + if (display==NULL){ + ms_error("Could not open display %s",dname); + return; } + memset(&wc,0,sizeof(wc)); + wc.x=params->x; + wc.y=params->y; + wc.width=params->w; + wc.height=params->h; + if (params->x!=-1 ){ + flags|=CWX|CWY; + } + if (params->w!=-1){ + flags|=CWWidth|CWHeight; + } + /*printf("XConfigureWindow x=%i,y=%i,w=%i,h=%i\n", + wc.x, wc.y ,wc.width, wc.height);*/ + XConfigureWindow(display,window,flags,&wc); + if (params->show) + XMapWindow(display,window); + else + XUnmapWindow(display,window); + XSync(display,FALSE); } #endif static void lpc_apply_video_params(){ - static unsigned long prev_wid=0; - + static unsigned long old_wid=0,old_pwid=0; unsigned long wid=linphone_core_get_native_video_window_id (linphonec); + unsigned long pwid=linphone_core_get_native_preview_window_id (linphonec); - if (wid!=0 && (lpc_video_params.refresh || prev_wid!=wid)){ + if (wid!=0 && (lpc_video_params.refresh || old_wid!=wid)){ lpc_video_params.refresh=FALSE; #ifdef HAVE_X11_XLIB_H if (lpc_video_params.wid==0){ // do not manage window if embedded - sdl_x11_apply_video_params(); + x11_apply_video_params(&lpc_video_params,wid); } #endif } - prev_wid=wid; + old_wid=wid; + if (pwid!=0 && (lpc_preview_params.refresh || old_pwid!=pwid)){ + lpc_preview_params.refresh=FALSE; +#ifdef HAVE_X11_XLIB_H + printf("wid=%lu pwid=%lu\n",wid,pwid); + if (lpc_preview_params.wid==0){ // do not manage window if embedded + printf("Refreshing\n"); + x11_apply_video_params(&lpc_preview_params,pwid); + } +#endif + } + old_pwid=pwid; } #endif diff --git a/console/linphonec.h b/console/linphonec.h index f38319ac0..9d7487b97 100644 --- a/console/linphonec.h +++ b/console/linphonec.h @@ -104,6 +104,10 @@ typedef struct { bool_t refresh; } VideoParams; + +extern VideoParams lpc_video_params; +extern VideoParams lpc_preview_params; + /*************************************************************************** * * Forward declarations diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 2b9400e67..add616d85 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -297,6 +297,8 @@ static void call_ack(SalOp *op){ static void call_updating(SalOp *op){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); + LinphoneCallState prevstate=LinphoneCallIdle; + if (call->resultdesc) sal_media_description_unref(call->resultdesc); call->resultdesc=sal_call_get_final_media_description(op); @@ -319,7 +321,9 @@ static void call_updating(SalOp *op){ linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)"); } else if(call->state==LinphoneCallStreamsRunning && - sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){ + ( sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) + || sal_media_description_has_dir(call->resultdesc,SalStreamInactive) + || strcmp(call->resultdesc->addr,"0.0.0.0")==0)){ if(lc->vtable.display_status) lc->vtable.display_status(lc,_("We are being paused...")); linphone_call_set_state (call,LinphoneCallPausedByRemote,"Call paused by remote"); @@ -327,6 +331,7 @@ static void call_updating(SalOp *op){ ms_error("Inconsitency detected: current call is %p but call %p is being paused !",lc->current_call,call); } }else{ + prevstate=call->state; linphone_call_set_state(call, LinphoneCallUpdatedByRemote,"Call updated by remote"); } /*accept the modification (sends a 200Ok)*/ @@ -334,6 +339,9 @@ static void call_updating(SalOp *op){ linphone_call_stop_media_streams (call); linphone_call_init_media_streams (call); linphone_call_start_media_streams (call); + if (prevstate!=LinphoneCallIdle){ + linphone_call_set_state (call,prevstate,"Connected (streams running)"); + } } if (lc->current_call==NULL) linphone_core_start_pending_refered_calls (lc); } diff --git a/coreapi/help/Makefile.am b/coreapi/help/Makefile.am index c24672180..4ded6c77f 100644 --- a/coreapi/help/Makefile.am +++ b/coreapi/help/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = Doxyfile.in doxygen.dox -SOURCES= doxygen.dox *.c $(top_srcdir)/coreapi/*.c $(top_srcdir)/coreapi/*.h +SOURCES= doxygen.dox $(top_srcdir)/coreapi/help/*.c $(top_srcdir)/coreapi/*.c $(top_srcdir)/coreapi/*.h #html doc diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4a937538e..775d6712f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3042,8 +3042,13 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){ #ifdef VIDEO_ENABLED if (val){ if (lc->previewstream==NULL){ - lc->previewstream=video_preview_start(lc->video_conf.device, - lc->video_conf.vsize,lc->video_conf.displaytype); + lc->previewstream=video_preview_new(); + video_preview_set_size(lc->previewstream,lc->video_conf.vsize); + if (lc->video_conf.displaytype) + video_preview_set_display_filter_name(lc->previewstream,lc->video_conf.displaytype); + if (lc->preview_window_id!=0) + video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id); + video_preview_start(lc->previewstream,lc->video_conf.device); } }else{ if (lc->previewstream!=NULL){ @@ -3291,7 +3296,7 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc) if (call && call->videostream) return video_stream_get_native_preview_window_id(call->videostream); if (lc->previewstream) - return video_stream_get_native_preview_window_id(lc->previewstream); + return video_preview_get_native_window_id(lc->previewstream); #endif return lc->preview_window_id; } diff --git a/coreapi/private.h b/coreapi/private.h index a1a0f2fd7..163df5f02 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -31,6 +31,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "mediastreamer2/mediastream.h" #ifndef LIBLINPHONE_VERSION #define LIBLINPHONE_VERSION LINPHONE_VERSION @@ -389,7 +390,7 @@ struct _LinphoneCore MSList *chatrooms; int max_call_logs; int missed_calls; - struct _VideoStream *previewstream; + VideoPreview *previewstream; struct _MSEventQueue *msevq; RtpTransport *a_rtp,*a_rtcp; MSList *bl_reqs; diff --git a/gtk/main.c b/gtk/main.c index ed2b77ba1..f30620ff4 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -649,12 +649,14 @@ static gboolean in_call_timer(){ return FALSE; } -static bool_t all_calls_paused(const MSList *calls){ +static bool_t all_other_calls_paused(LinphoneCall *refcall, const MSList *calls){ for(;calls!=NULL;calls=calls->next){ LinphoneCall *call=(LinphoneCall*)calls->data; LinphoneCallState cs=linphone_call_get_state(call); - if (cs!=LinphoneCallPaused && cs!=LinphoneCallIncomingReceived && cs!=LinphoneCallPausing) - return FALSE; + if (refcall!=call){ + if (cs!=LinphoneCallPaused && cs!=LinphoneCallPausing) + return FALSE; + } } return TRUE; } @@ -673,11 +675,17 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){ stop_active=FALSE; }else{ stop_active=TRUE; - if (all_calls_paused(calls)){ + if (all_other_calls_paused(NULL,calls)){ start_active=TRUE; add_call=TRUE; - }else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived){ - start_active=TRUE; + }else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived && all_other_calls_paused(call,calls)){ + if (ms_list_size(calls)>1){ + start_active=TRUE; + add_call=TRUE; + }else{ + start_active=TRUE; + add_call=FALSE; + } }else{ start_active=FALSE; } @@ -969,7 +977,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call break; case LinphoneCallIncomingReceived: linphone_gtk_create_in_call_view (call); - linphone_gtk_in_call_view_set_incoming(call,!all_calls_paused (linphone_core_get_calls(lc))); + linphone_gtk_in_call_view_set_incoming(call,!all_other_calls_paused (call,linphone_core_get_calls(lc))); if (auto_answer) { linphone_call_ref(call); g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call); diff --git a/mediastreamer2 b/mediastreamer2 index 8868e7ce0..5fe12a5d5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8868e7ce004ba99afd20ff21cd0c7ef25ffbef06 +Subproject commit 5fe12a5d5dcf3b267bbd7a3adc036d7113243454 diff --git a/po/POTFILES.in b/po/POTFILES.in index 704f41386..c69378f97 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -72,4 +72,4 @@ mediastreamer2/src/chanadapt.c mediastreamer2/src/itc.c mediastreamer2/src/extdisplay.c mediastreamer2/src/msiounit.c - +mediastreamer2/src/x11video.c