Commit 359bb6e0 authored by Simon Morlat's avatar Simon Morlat

code complete for linphone sound daemon

parent 96bbeb0a
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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
......@@ -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;i<MAX_BRANCHES;++i){
for(i=1;i<MAX_BRANCHES;++i){
LsdPlayer *b=&obj->branches[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);
}
......@@ -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;
......
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