Commit d5bcf73f authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'dev_lsd' into dev_multicall

Conflicts:
	coreapi/callbacks.c
	coreapi/linphonecore.c
parents 62607065 9bd55d0b
......@@ -35,7 +35,8 @@ liblinphone_la_SOURCES=\
general_state.c \
linphonecall.c \
sipsetup.c sipsetup.h \
siplogin.c
siplogin.c \
lsd.c linphonecore_utils.h
liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
......@@ -49,6 +50,11 @@ if BUILD_WIN32
liblinphone_la_LIBADD+=$(top_builddir)/oRTP/src/libortp.la
endif
noinst_PROGRAMS=test_lsd
test_lsd_SOURCES=test_lsd.c
test_lsd_LDADD=liblinphone.la
AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \
$(ORTP_CFLAGS) \
......
......@@ -118,10 +118,10 @@ static void call_received(SalOp *h){
/* play the ring */
if (lc->sound_conf.ring_sndcard!=NULL && !linphone_core_in_call(lc)){
if(lc->ringstream==NULL)
{
if(lc->ringstream==NULL){
MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
ms_message("Starting local ring...");
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,lc->sound_conf.ring_sndcard);
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,ringcard);
}
else
{
......@@ -149,8 +149,9 @@ static void call_ringing(SalOp *h){
if (md==NULL){
if (lc->ringstream!=NULL) return; /*already ringing !*/
if (lc->sound_conf.play_sndcard!=NULL){
MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
ms_message("Remote ringing...");
lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,lc->sound_conf.play_sndcard);
lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard);
}
}else{
/*accept early media */
......@@ -325,8 +326,10 @@ static void call_terminated(SalOp *op, const char *from){
}
if(call == linphone_core_get_current_call(lc))
linphone_core_stop_media_streams(lc,call);
lc->vtable.show(lc);
lc->vtable.display_status(lc,_("Call terminated."));
if (lc->vtable.show!=NULL)
lc->vtable.show(lc);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call terminated."));
linphone_call_set_terminated(call);
gstate_new_state(lc, GSTATE_CALL_END, NULL);
if (lc->vtable.bye_recv!=NULL){
......
This diff is collapsed.
......@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msvolume.h"
#include "mediastreamer2/msequalizer.h"
#include "mediastreamer2/mseventqueue.h"
#include <ortp/telephonyevents.h>
......@@ -162,7 +163,8 @@ void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, L
info=ortp_strdup_printf(ngettext("You have missed %i call.",
"You have missed %i calls.", lc->missed_calls),
lc->missed_calls);
lc->vtable.display_status(lc,info);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,info);
ms_free(info);
}else calllog->status=status;
lc->call_logs=ms_list_prepend(lc->call_logs,(void *)calllog);
......@@ -469,7 +471,7 @@ static void sound_config_read(LinphoneCore *lc)
lp_config_get_int(lc->config,"sound","agc",0));
gain=lp_config_get_float(lc->config,"sound","soft_play_lev",0);
linphone_core_set_soft_play_level(lc,gain);
linphone_core_set_soft_play_level(lc,gain);
}
static void sip_config_read(LinphoneCore *lc)
......@@ -479,6 +481,11 @@ static void sip_config_read(LinphoneCore *lc)
int port;
int i,tmp;
int ipv6;
if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
sal_use_session_timers(lc->sal,200);
}
port=lp_config_get_int(lc->config,"sip","use_info",0);
linphone_core_set_use_info_for_dtmf(lc,port);
......@@ -489,7 +496,8 @@ static void sip_config_read(LinphoneCore *lc)
if (ipv6==-1){
ipv6=0;
if (host_has_ipv6_network()){
lc->vtable.display_message(lc,_("Your machine appears to be connected to an IPv6 network. By default linphone always uses IPv4. Please update your configuration if you want to use IPv6"));
if (lc->vtable.display_message)
lc->vtable.display_message(lc,_("Your machine appears to be connected to an IPv6 network. By default linphone always uses IPv4. Please update your configuration if you want to use IPv6"));
}
}
linphone_core_enable_ipv6(lc,ipv6);
......@@ -926,6 +934,10 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
#endif
ms_init();
/* create a mediastreamer2 event queue and set it as global */
/* This allows to run event's callback in linphone_core_iterate() */
lc->msevq=ms_event_queue_new();
ms_set_global_event_queue(lc->msevq);
lc->config=lp_config_new(config_path);
if (factory_config_path)
......@@ -934,9 +946,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
lc->sal=sal_init();
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
sal_use_session_timers(lc->sal,200);
}
sip_setup_register_all();
sound_config_read(lc);
net_config_read(lc);
......@@ -949,8 +959,9 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
lc->presence_mode=LINPHONE_STATUS_ONLINE;
lc->max_call_logs=15;
ui_config_read(lc);
lc->vtable.display_status(lc,_("Ready"));
gstate_new_state(lc, GSTATE_POWER_ON, NULL);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
gstate_new_state(lc, GSTATE_POWER_ON, NULL);
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
lc->ready=TRUE;
......@@ -1317,14 +1328,14 @@ void linphone_core_set_user_agent(const char *name, const char *ver){
*
* @ingroup network_parameters
**/
void linphone_core_set_sip_port(LinphoneCore *lc,int port)
int linphone_core_set_sip_port(LinphoneCore *lc,int port)
{
const char *anyaddr;
int err=0;
if (port==lc->sip_conf.sip_port) return;
if (port==lc->sip_conf.sip_port) return 0;
lc->sip_conf.sip_port=port;
if (lc->sal==NULL) return;
if (lc->sal==NULL) return -1;
if (lc->sip_conf.ipv6_enabled)
anyaddr="::0";
......@@ -1334,11 +1345,13 @@ void linphone_core_set_sip_port(LinphoneCore *lc,int port)
if (err<0){
char *msg=ortp_strdup_printf("UDP port %i seems already in use ! Cannot initialize.",port);
ms_warning(msg);
lc->vtable.display_warning(lc,msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
ms_free(msg);
return;
return -1;
}
apply_user_agent(lc);
return 0;
}
/**
......@@ -1392,6 +1405,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
{
snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
}
if (lc->vtable.display_warning!=NULL)
lc->vtable.display_warning(lc,temp);
linphone_core_terminate_call(lc,call);//TODO failure ??
}
......@@ -1530,6 +1544,7 @@ void linphone_core_iterate(LinphoneCore *lc){
}
sal_iterate(lc->sal);
ms_event_queue_pump(lc->msevq);
if (lc->auto_net_state_mon) monitor_network_state(lc,curtime);
proxy_update(lc);
......@@ -1620,9 +1635,11 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
LinphoneAddress *uri;
if (is_enum(url,&enum_domain)){
lc->vtable.display_status(lc,_("Looking for telephone number destination..."));
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Looking for telephone number destination..."));
if (enum_lookup(enum_domain,&enumres)<0){
lc->vtable.display_status(lc,_("Could not resolve this number."));
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Could not resolve this number."));
if(lc->vtable.failure_recv)
lc->vtable.failure_recv(lc,NULL,400);
ms_free(enum_domain);
......@@ -1813,12 +1830,14 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
sal_call_set_local_media_description(call->op,call->localdesc);
}
barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url);
lc->vtable.display_status(lc,barmsg);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,barmsg);
ms_free(barmsg);
if (err<0){
ms_warning("Could not initiate call.");
lc->vtable.display_status(lc,_("could not call"));
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("could not call"));
if(call == linphone_core_get_current_call(lc))
linphone_core_stop_media_streams(lc,call);
linphone_call_unref(call);
......@@ -2144,7 +2163,8 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){
if (stream){
call->audio_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
if (!lc->use_files){
MSSndCard *playcard=lc->sound_conf.play_sndcard;
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
if (playcard==NULL) {
ms_warning("No card defined for playback !");
......@@ -2312,7 +2332,8 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
sal_op_set_contact(call->op,contact);
sal_call_accept(call->op);
lc->vtable.display_status(lc,_("Connected."));
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Connected."));
gstate_new_state(lc, GSTATE_CALL_IN_CONNECTED, NULL);
call->resultdesc=sal_call_get_final_media_description(call->op);
if (call->resultdesc){
......@@ -2355,7 +2376,8 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
}
if(call == linphone_core_get_current_call(lc))
linphone_core_stop_media_streams(lc,call);
lc->vtable.display_status(lc,_("Call ended") );
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call ended") );
gstate_new_state(lc, GSTATE_CALL_END, NULL);
linphone_call_set_terminated(call);
linphone_call_unref(call);
......@@ -2905,7 +2927,8 @@ int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCb
lc_callback_obj_init(&lc->preview_finished_cb,func,userdata);
lc->preview_finished=0;
if (lc->sound_conf.ring_sndcard!=NULL){
lc->ringstream=ring_start_with_cb(ring,2000,lc->sound_conf.ring_sndcard,notify_end_of_ring,(void *)lc);
MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
lc->ringstream=ring_start_with_cb(ring,2000,ringcard,notify_end_of_ring,(void *)lc);
}
return 0;
}
......@@ -3676,6 +3699,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
lc->previewstream=NULL;
}
#endif
ms_event_queue_destroy(lc->msevq);
/* save all config */
net_config_uninit(lc);
sip_config_uninit(lc);
......
......@@ -656,7 +656,7 @@ bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
int linphone_core_get_sip_port(LinphoneCore *lc);
void linphone_core_set_sip_port(LinphoneCore *lc,int port);
int linphone_core_set_sip_port(LinphoneCore *lc,int port);
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
......
/*
linphone
Copyright (C) 2010 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONECORE_UTILS_H
#define LINPHONECORE_UTILS_H
#ifdef IN_LINPHONE
#include "linphonecore.h"
#else
#include "linphone/linphonecore.h"
#endif
typedef struct _LsdPlayer LsdPlayer;
typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon;
typedef void (*LsdEndOfPlayCallback)(LsdPlayer *p);
void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
void *lsd_player_get_user_pointer(const LsdPlayer *p);
int lsd_player_play(LsdPlayer *p, const char *filename);
int lsd_player_stop(LsdPlayer *p);
void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
bool_t lsd_player_loop_enabled(const LsdPlayer *p);
void lsd_player_set_gain(LsdPlayer *p, float gain);
LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);
LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname);
LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer);
void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
#endif
/*
linphone
Copyright (C) 2010 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Linphone Sound Daemon: is a lightweight utility to play sounds to speaker during a conversation.
This is useful for embedded platforms, where sound apis are not performant enough to allow
simultaneous sound access.
*/
#include "linphonecore_utils.h"
#include "private.h"
#include "mediastreamer2/msticker.h"
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/msaudiomixer.h"
#include "mediastreamer2/mschanadapter.h"
#include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/msitc.h"
static struct _MSSndCard *linphone_sound_daemon_get_proxy_card(LinphoneSoundDaemon *obj);
#define MAX_BRANCHES 10
struct _LsdPlayer{
struct _LinphoneSoundDaemon *lsd;
MSFilter *player;
MSFilter *rateconv;
MSFilter *chanadapter;
LsdEndOfPlayCallback eop_cb;
int mixer_pin;
void *user_data;
bool_t loop;
bool_t pad[3];
};
struct _LinphoneSoundDaemon {
int out_rate;
int out_nchans;
MSFilter *mixer;
MSFilter *soundout;
MSFilter *itcsink;
MSTicker *ticker;
MSSndCard *proxycard;
LsdPlayer branches[MAX_BRANCHES];
};
static MSFilter *create_writer(MSSndCard *c){
LinphoneSoundDaemon *lsd=(LinphoneSoundDaemon*)c->data;
lsd->itcsink=ms_filter_new(MS_ITC_SINK_ID);
ms_filter_call_method(lsd->itcsink,MS_ITC_SINK_CONNECT,lsd->branches[0].player);
return lsd->itcsink;
}
static MSSndCardDesc proxycard={
"Linphone Sound Daemon",
/*detect*/ NULL,
/*init*/ NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
/*create_reader*/ NULL,
create_writer,
/*uninit,*/
};
LsdPlayer *linphone_sound_daemon_get_player(LinphoneSoundDaemon *obj){
int i;
for(i=1;i<MAX_BRANCHES;++i){
LsdPlayer *b=&obj->branches[i];
MSFilter *p=b->player;
int state;
ms_filter_call_method(p,MS_PLAYER_GET_STATE,&state);
if (state==MSPlayerClosed){
lsd_player_set_gain(b,1);
lsd_player_enable_loop (b,FALSE);
return b;
}
}
ms_warning("No more free players !");
return NULL;
}
void linphone_sound_daemon_release_player(LinphoneSoundDaemon *obj, LsdPlayer * player){
int state;
ms_filter_call_method(player->player,MS_PLAYER_GET_STATE,&state);
if (state!=MSPlayerClosed){
ms_filter_call_method(player->player,MS_PLAYER_CLOSE,&state);
}
}
LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p){
return p->lsd;
}
int lsd_player_stop(LsdPlayer *p){
ms_filter_call_method_noarg(p->player,MS_PLAYER_PAUSE);
return 0;
}
static void lsd_player_init(LsdPlayer *p, MSConnectionPoint mixer, MSFilterId playerid, LinphoneSoundDaemon *lsd){
MSConnectionHelper h;
p->player=ms_filter_new(playerid);
p->rateconv=ms_filter_new(MS_RESAMPLE_ID);
p->chanadapter=ms_filter_new(MS_CHANNEL_ADAPTER_ID);
ms_connection_helper_start(&h);
ms_connection_helper_link(&h,p->player,-1,0);
ms_connection_helper_link(&h,p->rateconv,0,0);
ms_connection_helper_link(&h,p->chanadapter,0,0);
ms_connection_helper_link(&h,mixer.filter,mixer.pin,-1);
p->mixer_pin=mixer.pin;
p->loop=FALSE;
p->lsd=lsd;
}
static void lsd_player_uninit(LsdPlayer *p, MSConnectionPoint mixer){
MSConnectionHelper h;
ms_connection_helper_start(&h);
ms_connection_helper_unlink (&h,p->player,-1,0);
ms_connection_helper_unlink(&h,p->rateconv,0,0);
ms_connection_helper_unlink(&h,p->chanadapter,0,0);
ms_connection_helper_unlink(&h,mixer.filter,mixer.pin,-1);
ms_filter_destroy(p->player);
ms_filter_destroy(p->rateconv);
ms_filter_destroy(p->chanadapter);
}
void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb){
p->eop_cb=cb;
}
void lsd_player_set_user_pointer(LsdPlayer *p, void *up){
p->user_data=up;
}
void *lsd_player_get_user_pointer(const LsdPlayer *p){
return p->user_data;
}
static void lsd_player_on_eop(void * userdata, unsigned int id, void *arg){
LsdPlayer *p=(LsdPlayer *)userdata;
if (p->eop_cb!=NULL)
p->eop_cb(p);
}
int lsd_player_play(LsdPlayer *b, const char *filename ){
int rate,chans;
int state;
LinphoneSoundDaemon *lsd=b->lsd;
ms_filter_call_method(b->player,MS_PLAYER_GET_STATE,&state);
if (state!=MSPlayerClosed){
ms_filter_call_method_noarg(b->player,MS_PLAYER_CLOSE);
}
if (ms_filter_call_method(b->player,MS_PLAYER_OPEN,(void*)filename)!=0){
ms_warning("Could not play %s",filename);
return -1;
}
ms_filter_call_method(b->player,MS_FILTER_GET_SAMPLE_RATE,&rate);
ms_filter_call_method(b->player,MS_FILTER_GET_NCHANNELS,&chans);
ms_filter_set_notify_callback (b->player,lsd_player_on_eop,b);
ms_filter_call_method(b->rateconv,MS_FILTER_SET_SAMPLE_RATE,&rate);
ms_filter_call_method(b->rateconv,MS_FILTER_SET_NCHANNELS,&chans);
ms_filter_call_method(b->rateconv,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&lsd->out_rate);
ms_filter_call_method(b->chanadapter,MS_FILTER_SET_NCHANNELS,&chans);
ms_filter_call_method(b->chanadapter,MS_CHANNEL_ADAPTER_SET_OUTPUT_NCHANNELS,&lsd->out_nchans);
ms_filter_call_method_noarg (b->player,MS_PLAYER_START);
return 0;
}
void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode){
if (ms_filter_get_id(p->player)==MS_FILE_PLAYER_ID){
int arg=loopmode ? 0 : -1;
ms_filter_call_method(p->player,MS_FILE_PLAYER_LOOP,&arg);
p->loop=loopmode;
}
}
bool_t lsd_player_loop_enabled(const LsdPlayer *p){
return p->loop;
}
void lsd_player_set_gain(LsdPlayer *p, float gain){
MSAudioMixerCtl gainctl;
gainctl.pin=p->mixer_pin;
gainctl.gain=gain;
ms_filter_call_method(p->lsd->mixer,MS_AUDIO_MIXER_SET_INPUT_GAIN,&gainctl);
}
LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname){
int i;
MSConnectionPoint mp;
LinphoneSoundDaemon *lsd;
MSSndCard *card=ms_snd_card_manager_get_card(
ms_snd_card_manager_get(),
cardname);
if (card==NULL){
card=ms_snd_card_manager_get_default_playback_card (
ms_snd_card_manager_get());
if (card==NULL){
ms_error("linphone_sound_daemon_new(): No playback soundcard available");
return NULL;
}
}
lsd=ms_new0(LinphoneSoundDaemon,1);
lsd->soundout=ms_snd_card_create_writer(card);
lsd->mixer=ms_filter_new(MS_AUDIO_MIXER_ID);
lsd->itcsink=ms_filter_new(MS_ITC_SINK_ID);
lsd->out_rate=44100;
lsd->out_nchans=2;
ms_filter_call_method(lsd->soundout,MS_FILTER_SET_SAMPLE_RATE,&lsd->out_rate);
ms_filter_call_method(lsd->soundout,MS_FILTER_SET_NCHANNELS,&lsd->out_nchans);
ms_filter_call_method(lsd->mixer,MS_FILTER_SET_SAMPLE_RATE,&lsd->out_rate);
ms_filter_call_method(lsd->mixer,MS_FILTER_SET_NCHANNELS,&lsd->out_nchans);
mp.filter=lsd->mixer;
mp.pin=0;
lsd_player_init(&lsd->branches[0],mp,MS_ITC_SOURCE_ID,lsd);
for(i=1;i<MAX_BRANCHES;++i){
mp.pin=i;
lsd_player_init(&lsd->branches[i],mp,MS_FILE_PLAYER_ID,lsd);
}
ms_filter_link(lsd->mixer,0,lsd->soundout,0);
lsd->ticker=ms_ticker_new();
ms_ticker_attach(lsd->ticker,lsd->soundout);
lsd->proxycard=ms_snd_card_new(&proxycard);
lsd->proxycard->data=lsd;
return lsd;
}
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj){
int i;
MSConnectionPoint mp;
ms_ticker_detach(obj->ticker,obj->soundout);
mp.filter=obj->mixer;
for(i=0;i<MAX_BRANCHES;++i){
mp.pin=i;
lsd_player_uninit (&obj->branches[i],mp);
}
ms_filter_unlink(obj->mixer,0,obj->soundout,0);
ms_ticker_destroy(obj->ticker);
ms_filter_destroy(obj->soundout);
ms_filter_destroy(obj->mixer);
ms_filter_destroy(obj->itcsink);
}
MSSndCard *linphone_sound_daemon_get_proxy_card(LinphoneSoundDaemon *lsd){
return lsd->proxycard;
}
void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd){
lc->sound_conf.lsd_card=linphone_sound_daemon_get_proxy_card (lsd);
}
......@@ -130,7 +130,8 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
tmp=linphone_address_as_string(friend);
lf->status=estatus;
lf->subscribe_active=TRUE;
lc->vtable.notify_presence_recv(lc,(LinphoneFriend*)lf);
if (lc->vtable.notify_presence_recv)
lc->vtable.notify_presence_recv(lc,(LinphoneFriend*)lf);
ms_free(tmp);