From: Simon Morlat Date: Fri, 28 May 2010 12:15:27 +0000 (+0200) Subject: code complete for linphone sound daemon X-Git-Url: http://sjero.net/git/?a=commitdiff_plain;h=359bb6e0a2a217a03c51ace7e599502b6c00dc85;p=linphone code complete for linphone sound daemon --- diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index f15404db..a4ce8e34 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -100,8 +100,9 @@ static void call_received(SalOp *h){ /* play the ring */ if (lc->sound_conf.ring_sndcard!=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); } linphone_call_set_state(call,LCStateRinging); sal_call_notify_ringing(h); @@ -122,8 +123,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 */ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f62449e6..d6df2f81 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -621,7 +621,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) @@ -2240,7 +2240,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 !"); @@ -2820,7 +2821,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; } diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index a7f8cfae..0df37b80 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -31,15 +31,6 @@ typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon; typedef void (*LsdEndOfPlayCallback)(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); - -struct _MSSndCard *linphone_sound_daemon_get_proxy_card(LinphoneSoundDaemon *obj); - -void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj); - 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(LsdPlayer *p); @@ -48,4 +39,10 @@ int lsd_player_stop(LsdPlayer *p); void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode); void lsd_player_set_gain(LsdPlayer *p, float gain); +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 diff --git a/coreapi/lsd.c b/coreapi/lsd.c index cb0f0af4..0ed782fe 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "linphonecore_utils.h" +#include "private.h" #include "mediastreamer2/msticker.h" #include "mediastreamer2/mssndcard.h" #include "mediastreamer2/msaudiomixer.h" @@ -31,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/msitc.h" +static struct _MSSndCard *linphone_sound_daemon_get_proxy_card(LinphoneSoundDaemon *obj); #define MAX_BRANCHES 10 @@ -77,7 +79,7 @@ static MSSndCardDesc proxycard={ LsdPlayer *linphone_sound_daemon_get_player(LinphoneSoundDaemon *obj){ int i; - for(i=0;ibranches[i]; MSFilter *p=b->player; int state; @@ -174,8 +176,6 @@ int lsd_player_play(LsdPlayer *b, const char *filename ){ return 0; } -int lsd_player_stop(LsdPlayer *p); - 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; @@ -252,8 +252,10 @@ void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj){ 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); +} diff --git a/coreapi/private.h b/coreapi/private.h index c3e2960a..22286987 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -293,6 +293,7 @@ typedef struct sound_config struct _MSSndCard * ring_sndcard; /* the playback sndcard currently used */ struct _MSSndCard * play_sndcard; /* the playback sndcard currently used */ struct _MSSndCard * capt_sndcard; /* the capture sndcard currently used */ + struct _MSSndCard * lsd_card; /* dummy playback card for Linphone Sound Daemon extension */ const char **cards; int latency; /* latency in samples of the current used sound device */ char rec_lev;