mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 17:59:21 +00:00
choose video placement from linphonec
This commit is contained in:
parent
3180acd72a
commit
82e88822b8
8 changed files with 251 additions and 11 deletions
12
configure.in
12
configure.in
|
|
@ -294,7 +294,19 @@ AC_ARG_WITH( sdl,
|
|||
[ --with-sdl Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
|
||||
[ libsdldir=${withval}],[ libsdldir=/usr ])
|
||||
|
||||
AC_ARG_ENABLE(x11,
|
||||
[ --disable-x11 Disable X11 support],
|
||||
[case "${enableval}" in
|
||||
yes) enable_x11=true ;;
|
||||
no) enable_x11=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
|
||||
esac],[enable_x11=true])
|
||||
|
||||
if test "$video" = "true"; then
|
||||
|
||||
if test "$enable_x11" = "true"; then
|
||||
AC_CHECK_HEADERS(X11/Xlib.h)
|
||||
fi
|
||||
AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args);
|
|||
static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_states(LinphoneCore *lc, char *args);
|
||||
|
||||
/* Command handler helpers */
|
||||
static void linphonec_proxy_add(LinphoneCore *lc);
|
||||
|
|
@ -118,6 +119,7 @@ static LPC_COMMAND *lpc_find_command(const char *name);
|
|||
|
||||
void linphonec_out(const char *fmt,...);
|
||||
|
||||
VideoParams lpc_video_params={-1,-1,-1,-1,TRUE};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
|
@ -130,7 +132,7 @@ void linphonec_out(const char *fmt,...);
|
|||
* Commands table.
|
||||
*/
|
||||
static LPC_COMMAND commands[] = {
|
||||
{ "help", lpc_cmd_help, "Print commands help, 'help advanced' for advanced features.",
|
||||
{ "help", lpc_cmd_help, "Print commands help.",
|
||||
"'help <command>'\t: displays specific help for command.\n"
|
||||
"'help advanced'\t: shows advanced commands.\n"
|
||||
},
|
||||
|
|
@ -253,7 +255,17 @@ static LPC_COMMAND advanced_commands[] = {
|
|||
"Set the rtp_no_xmit_on_audio_mute configuration parameter",
|
||||
" If set to 1 then rtp transmission will be muted when\n"
|
||||
" audio is muted , otherwise rtp is always sent."},
|
||||
{ "video-window", lpc_cmd_video_window, "Control video display window", NULL },
|
||||
{ "vwindow", lpc_cmd_video_window, "Control video display window",
|
||||
"'vwindow show': shows video window\n"
|
||||
"'vwindow hide': hides video window\n"
|
||||
"'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
|
||||
"'vwindow size <width> <height>': Resizes video window"
|
||||
},
|
||||
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
|
||||
"'states global': shows global state of liblinphone \n"
|
||||
"'states calls': shows state of calls\n"
|
||||
"'states proxies': shows state of proxy configurations"
|
||||
},
|
||||
{ "register", lpc_cmd_register, "Register in one line to a proxy" , "register <sip identity> <sip proxy> <password>"},
|
||||
{ "unregister", lpc_cmd_unregister, "Unregister from default proxy", NULL },
|
||||
{ "status", lpc_cmd_status, "Print various status information",
|
||||
|
|
@ -413,7 +425,7 @@ lpc_cmd_help(LinphoneCore *lc, char *arg)
|
|||
}
|
||||
|
||||
linphonec_out("---------------------------\n");
|
||||
linphonec_out("Type 'help <command>' for more details.\n");
|
||||
linphonec_out("Type 'help <command>' for more details or 'help advanced' to list additional commands.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2155,9 +2167,88 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
|
|||
}
|
||||
|
||||
static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
|
||||
char subcommand[64];
|
||||
int a,b;
|
||||
int err;
|
||||
#ifdef VIDEO_ENABLED
|
||||
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;
|
||||
}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;
|
||||
}else if (strcmp(subcommand,"show")==0){
|
||||
lpc_video_params.show=TRUE;
|
||||
lpc_video_params.refresh=TRUE;
|
||||
}else if (strcmp(subcommand,"hide")==0){
|
||||
lpc_video_params.show=FALSE;
|
||||
lpc_video_params.refresh=TRUE;
|
||||
}else return 0;
|
||||
}
|
||||
#else
|
||||
linphonec_out("Sorry, this version of linphonec wasn't compiled with video support.");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void lpc_display_global_state(LinphoneCore *lc){
|
||||
linphonec_out("****************Global liblinphone state********************\n\t%s",
|
||||
linphone_global_state_to_string(linphone_core_get_global_state(lc)));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
static int lpc_cmd_states(LinphoneCore *lc, char *args){
|
||||
if (args==NULL) {
|
||||
lpc_display_global_state(lc);
|
||||
lpc_display_call_states(lc);
|
||||
lpc_display_proxy_states(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"global")==0){
|
||||
lpc_display_global_state(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"proxies")==0){
|
||||
lpc_display_proxy_states(lc);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args,"calls")==0){
|
||||
lpc_display_call_states(lc);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Command table management funx
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@
|
|||
#define PACKAGE_DIR ""
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
#include <X11/Xlib.h>
|
||||
#include <SDL/SDL_syswm.h>
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Types
|
||||
|
|
@ -169,6 +174,8 @@ static ortp_pipe_t server_sock;
|
|||
#endif /*_WIN32_WCE*/
|
||||
|
||||
|
||||
extern VideoParams lpc_video_params;
|
||||
|
||||
void linphonec_call_identify(LinphoneCall* call){
|
||||
static long callid=1;
|
||||
linphone_call_set_user_pointer (call,(void*)callid);
|
||||
|
|
@ -841,6 +848,66 @@ usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\
|
|||
exit(exit_status);
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
static void sdl_x11_apply_video_params(){
|
||||
static SDL_SysWMinfo info;
|
||||
static bool_t wminfo_ready=FALSE;
|
||||
|
||||
if ( !wminfo_ready){
|
||||
SDL_VERSION(&info.version);
|
||||
if ( SDL_GetWMInfo(&info) ) {
|
||||
if ( info.subsystem == SDL_SYSWM_X11 ) {
|
||||
wminfo_ready=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void lpc_apply_video_params(){
|
||||
if (lpc_video_params.refresh){
|
||||
unsigned long wid=linphone_core_get_native_video_window_id (linphonec);
|
||||
if (wid!=0){
|
||||
lpc_video_params.refresh=FALSE;
|
||||
#ifdef HAVE_X11_XLIB_H
|
||||
sdl_x11_apply_video_params();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
@ -882,6 +949,10 @@ linphonec_idle_call ()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
lpc_apply_video_params();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,12 @@ typedef struct {
|
|||
char *doc; /* Long description. */
|
||||
} LPC_COMMAND;
|
||||
|
||||
typedef struct {
|
||||
int x,y,w,h;
|
||||
bool_t show;
|
||||
bool_t refresh;
|
||||
} VideoParams;
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Forward declarations
|
||||
|
|
|
|||
|
|
@ -3815,3 +3815,25 @@ PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type,
|
|||
/*not found*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *linphone_global_state_to_string(LinphoneGlobalState gs){
|
||||
switch(gs){
|
||||
case LinphoneGlobalOff:
|
||||
return "LinphoneGlobalOff";
|
||||
break;
|
||||
case LinphoneGlobalOn:
|
||||
return "LinphoneGlobalOn";
|
||||
break;
|
||||
case LinphoneGlobalStartup:
|
||||
return "LinphoneGlobalStartup";
|
||||
break;
|
||||
case LinphoneGlobalShutdown:
|
||||
return "LinphoneGlobalShutdown";
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){
|
||||
return LinphoneGlobalOn;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,8 +179,10 @@ typedef enum _LinphoneCallState{
|
|||
LinphoneCallPausedByRemote
|
||||
} LinphoneCallState;
|
||||
|
||||
const char *linphone_call_state_to_string(LinphoneCallState cs);
|
||||
|
||||
enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
|
||||
|
||||
LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
|
||||
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
|
||||
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
|
||||
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
|
||||
|
|
@ -265,6 +267,19 @@ bool_t linphone_friend_in_list(const LinphoneFriend *lf);
|
|||
**/
|
||||
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
|
||||
|
||||
/**
|
||||
* LinphoneRegistrationState describes proxy registration states.
|
||||
**/
|
||||
typedef enum _LinphoneRegistrationState{
|
||||
LinphoneRegistrationNone,
|
||||
LinphoneRegistrationProgress,
|
||||
LinphoneRegistrationOk,
|
||||
LinphoneRegistrationCleared,
|
||||
LinphoneRegistrationFailed
|
||||
}LinphoneRegistrationState;
|
||||
|
||||
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
|
||||
|
||||
LinphoneProxyConfig *linphone_proxy_config_new(void);
|
||||
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
|
||||
int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
|
||||
|
|
@ -278,6 +293,7 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
|
|||
void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
|
||||
void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
|
||||
|
||||
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
|
||||
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
|
||||
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
|
||||
|
||||
|
|
@ -391,13 +407,7 @@ typedef enum _LinphoneGlobalState{
|
|||
LinphoneGlobalShutdown
|
||||
}LinphoneGlobalState;
|
||||
|
||||
typedef enum _LinphoneRegistrationState{
|
||||
LinphoneRegistrationNone,
|
||||
LinphoneRegistrationProgress,
|
||||
LinphoneRegistrationOk,
|
||||
LinphoneRegistrationCleared,
|
||||
LinphoneRegistrationFailed
|
||||
}LinphoneRegistrationState;
|
||||
const char *linphone_global_state_to_string(LinphoneGlobalState gs);
|
||||
|
||||
/**
|
||||
* @addtogroup initializing
|
||||
|
|
@ -830,6 +840,8 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
|
|||
|
||||
const MSList *linphone_core_get_calls(LinphoneCore *lc);
|
||||
|
||||
LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ struct _LinphoneProxyConfig
|
|||
struct _SipSetupContext *ssctx;
|
||||
int auth_failures;
|
||||
char *dial_prefix;
|
||||
LinphoneRegistrationState state;
|
||||
bool_t commit;
|
||||
bool_t reg_sendregister;
|
||||
bool_t registered;
|
||||
|
|
|
|||
|
|
@ -799,10 +799,35 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
|
|||
|
||||
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
|
||||
LinphoneCore *lc=cfg->lc;
|
||||
cfg->state=state;
|
||||
if (lc && lc->vtable.registration_state_changed){
|
||||
lc->vtable.registration_state_changed(lc,cfg,state,message);
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *cfg){
|
||||
return cfg->state;
|
||||
}
|
||||
|
||||
const char *linphone_registration_state_to_string(LinphoneRegistrationState cs){
|
||||
switch(cs){
|
||||
case LinphoneRegistrationCleared:
|
||||
return "LinphoneRegistrationCleared";
|
||||
break;
|
||||
case LinphoneRegistrationNone:
|
||||
return "LinphoneRegistrationNone";
|
||||
break;
|
||||
case LinphoneRegistrationProgress:
|
||||
return "LinphoneRegistrationProgress";
|
||||
break;
|
||||
case LinphoneRegistrationOk:
|
||||
return "LinphoneRegistrationOk";
|
||||
break;
|
||||
case LinphoneRegistrationFailed:
|
||||
return "LinphoneRegistrationFailed";
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue