Commit efa62f1d authored by jehan's avatar jehan
Browse files

Merge branch 'master' of git.linphone.org:linphone-private

parents 98baa615 9642f4e7
dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.3.99.5],[linphone-developers@nongnu.org])
AC_INIT([linphone],[3.3.99.6],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
......
......@@ -34,7 +34,6 @@
#include <ctype.h>
#include <linphonecore.h>
#include "linphonec.h"
#include "private.h"
#include "lpconfig.h"
#ifndef WIN32
......@@ -92,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_snapshot(LinphoneCore *lc, char *args);
#endif
static int lpc_cmd_states(LinphoneCore *lc, char *args);
static int lpc_cmd_identify(LinphoneCore *lc, char *args);
......@@ -124,7 +124,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};
VideoParams lpc_video_params={-1,-1,-1,-1,0,TRUE};
/***************************************************************************
......@@ -275,6 +275,9 @@ static LPC_COMMAND advanced_commands[] = {
"'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
"'vwindow size <width> <height>': Resizes video window"
},
{ "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream",
"'snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
#endif
{ "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"
......@@ -629,7 +632,7 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
int n=sscanf(args,"%s %s",arg1,arg2);
if (n==1 || isalpha(*arg1)){
call=linphone_core_get_current_call(lc);
if (call==NULL && linphone_core_get_calls_nb (lc)==1){
if (call==NULL && ms_list_size(linphone_core_get_calls(lc))==1){
call=(LinphoneCall*)linphone_core_get_calls(lc)->data;
}
refer_to=args;
......@@ -1450,7 +1453,7 @@ linphonec_proxy_add(LinphoneCore *lc)
}
linphone_proxy_config_set_identity(cfg, clean);
if ( ! cfg->reg_identity )
if ( ! linphone_proxy_config_get_identity (cfg))
{
linphonec_out("Invalid identity (sip:name@sip.domain.tld).\n");
free(input);
......@@ -1519,7 +1522,7 @@ linphonec_proxy_add(LinphoneCore *lc)
}
linphone_proxy_config_expires(cfg, expires);
linphonec_out("Expiration: %d seconds\n", cfg->expires);
linphonec_out("Expiration: %d seconds\n", linphone_proxy_config_get_expires (cfg));
free(input);
break;
......@@ -1549,7 +1552,7 @@ linphonec_proxy_add(LinphoneCore *lc)
}
linphone_proxy_config_set_route(cfg, clean);
if ( ! cfg->reg_route )
if ( ! linphone_proxy_config_get_route(cfg) )
{
linphonec_out("Invalid route.\n");
free(input);
......@@ -1613,12 +1616,14 @@ linphonec_proxy_add(LinphoneCore *lc)
static void
linphonec_proxy_display(LinphoneProxyConfig *cfg)
{
const char *route=linphone_proxy_config_get_route(cfg);
const char *identity=linphone_proxy_config_get_identity(cfg);
linphonec_out("sip address: %s\nroute: %s\nidentity: %s\nregister: %s\nexpires: %i\nregistered: %s\n",
cfg->reg_proxy,
(cfg->reg_route!=NULL)?cfg->reg_route:"",
(cfg->reg_identity!=NULL)?cfg->reg_identity:"",
(cfg->reg_sendregister)?"yes":"no",
cfg->expires,
linphone_proxy_config_get_addr(cfg),
(route!=NULL)? route:"",
(identity!=NULL)?identity:"",
linphone_proxy_config_register_enabled (cfg)?"yes":"no",
linphone_proxy_config_get_expires (cfg),
linphone_proxy_config_is_registered(cfg) ? "yes" : "no");
}
......@@ -1666,7 +1671,7 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
return;
}
linphone_core_remove_proxy_config(lc,cfg);
linphonec_out("Proxy %s removed.\n", cfg->reg_proxy);
linphonec_out("Proxy %s removed.\n", linphone_proxy_config_get_addr(cfg));
}
static int
......@@ -2048,14 +2053,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;
const MSList *node=NULL;
if (type == AUDIO) {
node=config->audio_codecs;
node=linphone_core_get_audio_codecs(lc);
} else if(type==VIDEO) {
node=config->video_codecs;
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
......@@ -2068,20 +2072,19 @@ 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;
const MSList *node=NULL;
if (type == AUDIO) {
node=config->audio_codecs;
} else if(type==VIDEO) {
node=config->video_codecs;
}
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
} else if(type==VIDEO) {
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
pt->flags|=PAYLOAD_TYPE_ENABLED;
linphone_core_enable_payload_type (lc,pt,TRUE);
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "enabled");
}
index++;
......@@ -2090,22 +2093,21 @@ 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;
const MSList *node=NULL;
if (type == AUDIO) {
node=config->audio_codecs;
} else if(type==VIDEO) {
node=config->video_codecs;
}
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
} else if(type==VIDEO) {
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
pt->flags&=~PAYLOAD_TYPE_ENABLED;
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "disabled");
}
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
linphone_core_enable_payload_type (lc,pt,FALSE);
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate, "disabled");
}
index++;
}
}
......@@ -2114,6 +2116,7 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
char *arg1 = args;
char *arg2 = NULL;
char *ptr = args;
LpConfig *config=linphone_core_get_config(lc);
if (!args) return 0;
......@@ -2136,16 +2139,16 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
n = sscanf(arg2, "%d %d %d", &delay, &tail_len, &frame_size);
if (n == 1) {
lp_config_set_int(lc->config,"sound","ec_delay",delay);
lp_config_set_int(config,"sound","ec_delay",delay);
}
else if (n == 2) {
lp_config_set_int(lc->config,"sound","ec_delay",delay);
lp_config_set_int(lc->config,"sound","ec_tail_len",tail_len);
lp_config_set_int(config,"sound","ec_delay",delay);
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
}
else if (n == 3) {
lp_config_set_int(lc->config,"sound","ec_delay",delay);
lp_config_set_int(lc->config,"sound","ec_tail_len",tail_len);
lp_config_set_int(lc->config,"sound","ec_framesize",frame_size);
lp_config_set_int(config,"sound","ec_delay",delay);
lp_config_set_int(config,"sound","ec_tail_len",tail_len);
lp_config_set_int(config,"sound","ec_framesize",frame_size);
}
}
}
......@@ -2155,9 +2158,9 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
else if (strcmp(arg1,"show")==0){
linphonec_out("echo cancellation is %s; delay %d, tail length %d, frame size %d\n",
linphone_core_echo_cancellation_enabled(lc) ? "on" : "off",
lp_config_get_int(lc->config,"sound","ec_delay",0),
lp_config_get_int(lc->config,"sound","ec_tail_len",0),
lp_config_get_int(lc->config,"sound","ec_framesize",0));
lp_config_get_int(config,"sound","ec_delay",0),
lp_config_get_int(config,"sound","ec_tail_len",0),
lp_config_get_int(config,"sound","ec_framesize",0));
}
else {
return 0;
......@@ -2201,6 +2204,8 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
char subcommand[64];
int a,b;
int err;
if (!args) return 0;
err=sscanf(args,"%s %i %i",subcommand,&a,&b);
if (err>=1){
if (strcmp(subcommand,"pos")==0){
......@@ -2219,9 +2224,18 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
}else if (strcmp(subcommand,"hide")==0){
lpc_video_params.show=FALSE;
lpc_video_params.refresh=TRUE;
}else if (strcmp(subcommand,"id")==0){
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"));
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"));
}else return 0;
}
return 1;
}
#endif
......@@ -2338,6 +2352,17 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){
return 1;
}
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args){
LinphoneCall *call;
if (!args) return 0;
call=linphone_core_get_current_call(lc);
if (call!=NULL){
linphone_call_take_video_snapshot (call,args);
linphonec_out("Taking video snaphot in file %s\n", args);
}else linphonec_out("There is no active call.\n");
return 1;
}
#endif
static int lpc_cmd_identify(LinphoneCore *lc, char *args){
......
......@@ -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;
......@@ -696,8 +697,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");
......@@ -847,6 +847,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\
......@@ -1140,6 +1141,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++;
......
......@@ -99,6 +99,7 @@ typedef struct {
typedef struct {
int x,y,w,h;
unsigned long wid;
bool_t show;
bool_t refresh;
} VideoParams;
......
......@@ -139,7 +139,7 @@ static bool_t strings_equals(const char *s1, const char *s2){
* Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port.
* Returns TRUE if they are equal.
**/
bool_t linphone_address_weak_compare(const LinphoneAddress *a1, const LinphoneAddress *a2){
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2){
const char *u1,*u2;
const char *h1,*h2;
int p1,p2;
......
......@@ -39,8 +39,8 @@ static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, c
MSList *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_address_weak_compare(call->log->from,from) &&
linphone_address_weak_compare(call->log->to, to)){
if (linphone_address_weak_equal(call->log->from,from) &&
linphone_address_weak_equal(call->log->to, to)){
return TRUE;
}
}
......
......@@ -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_get_call_by_remote_address(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
{
......
......@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msvolume.h"
#include "mediastreamer2/msequalizer.h"
#include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/msjpegwriter.h"
#ifdef VIDEO_ENABLED
static MSWebCam *get_nowebcam_device(){
......@@ -473,6 +474,20 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
#endif
}
/**
* Take a photo of currently received video and write it into a jpeg file.
**/
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->jpegwriter!=NULL){
return ms_filter_call_method(call->videostream->jpegwriter,MS_JPEG_WRITER_TAKE_SNAPSHOT,(void*)file);
}
ms_warning("Cannot take snapshot: no currently running video stream on this call.");
return -1;
#endif
return -1;
}
/**
*
**/
......@@ -554,6 +569,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
......
......@@ -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;
......@@ -774,6 +773,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);
......@@ -1832,25 +1834,6 @@ const char * linphone_core_get_route(LinphoneCore *lc){
return route;
}
bool_t 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;
}
tmp = linphone_address_as_string(la);
if(!strcmp(tmp,to))
returned = TRUE;
else
returned = FALSE;
if(tmp)
ms_free(tmp);
return returned;
}
void linphone_core_start_pending_refered_calls(LinphoneCore *lc){
MSList *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
......@@ -2446,28 +2429,9 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
return 0;
}
/**
* Compare the remote address with the one in call
*
* @param a the call
* @param b the remote address to compare with
* @return 0 if it's the good call else 1
*/
static int linphone_call_remote_address_compare(const void * a, const void * b)
{
if(b == NULL || a ==NULL)
return 1;
char *the_remote_address = ((char *)b);
LinphoneCall *call = ((LinphoneCall *)a);
#ifdef DEBUG
ms_message("the remote address:%s\n",the_remote_address);
ms_message("the call:%p => %s\n",call,linphone_call_get_remote_address_as_string(call));
#endif
if(!strcmp(linphone_call_get_remote_address_as_string(call),the_remote_address))
{
return 0;
}
return 1;
static int remote_address_compare(LinphoneCall *call, const LinphoneAddress *raddr){
const LinphoneAddress *addr=linphone_call_get_remote_address (call);
return !linphone_address_weak_equal (addr,raddr);
}
/**
......@@ -2477,12 +2441,9 @@ static int linphone_call_remote_address_compare(const void * a, const void * b)
* @return the LinphoneCall of the call if found
*/
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address){
MSList *the_call = ms_list_find_custom(lc->calls,linphone_call_remote_address_compare,(void *)remote_address);
if(the_call != NULL)
{
return ((LinphoneCall *)the_call->data);
}
LinphoneAddress *raddr=linphone_address_new(remote_address);
MSList *elem=ms_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr);
if (elem) return (LinphoneCall*) elem->data;
return NULL;
}
......@@ -3082,7 +3043,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){
......@@ -3492,6 +3453,7 @@ void linphone_core_stop_dtmf(LinphoneCore *lc){
}
/**
* Retrieves the user pointer that was given to linphone_core_new()
*
......
......@@ -93,7 +93,7 @@ void linphone_address_set_port_int(LinphoneAddress *uri, int port);
void linphone_address_clean(LinphoneAddress *uri);
char *linphone_address_as_string(const LinphoneAddress *u);
char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
bool_t linphone_address_weak_compare(const LinphoneAddress *a1, const LinphoneAddress *a2);
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
void linphone_address_destroy(LinphoneAddress *u);
struct _SipSetupContext;
......@@ -225,6 +225,7 @@ int linphone_call_get_duration(const LinphoneCall *call);
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call);
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
LinphoneError linphone_call_get_error(const LinphoneCall *call);
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
......@@ -852,7 +853,6 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms);
void linphone_core_stop_dtmf(LinphoneCore *lc);
int linphone_core_get_current_call_duration(const LinphoneCore *lc);
......
......@@ -188,7 +188,6 @@ 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);
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);
......@@ -340,6 +339,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
......
......@@ -1446,7 +1446,9 @@ static void registration_success(Sal *sal, eXosip_event_t *ev){
if (!register_again_with_updated_contact(op,ev->request,ev->response)){
sal->callbacks.register_success(op,registered);
}
}else registered=FALSE;
}else {
sal->callbacks.register_success(op,FALSE);
}
}
static bool_t registration_failure(Sal *sal, eXosip_event_t *ev){
......
mediastreamer2 @ e13dd416
Subproject commit 9d112433686a30c5c5c380f64295c0843a2d517b
Subproject commit e13dd416782fe85f25610471b9db117c0eecaf80
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment