Commit 12b340b6 authored by Mickaël Turnel's avatar Mickaël Turnel

Add a media souncard

parent a6836f87
......@@ -1211,6 +1211,9 @@ static void sound_config_read(LinphoneCore *lc)
devid=lp_config_get_string(lc->config,"sound","capture_dev_id",NULL);
linphone_core_set_capture_device(lc,devid);
devid=lp_config_get_string(lc->config,"sound","media_dev_id",NULL);
linphone_core_set_media_device(lc,devid);
/*
tmp=lp_config_get_int(lc->config,"sound","play_lev",80);
linphone_core_set_play_level(lc,tmp);
......@@ -4192,6 +4195,10 @@ int linphone_core_get_rec_level(LinphoneCore *lc) {
return lc->sound_conf.rec_lev;
}
int linphone_core_get_media_level(LinphoneCore *lc) {
return lc->sound_conf.media_lev;
}
void linphone_core_set_ring_level(LinphoneCore *lc, int level){
MSSndCard *sndcard;
lc->sound_conf.ring_lev = (char)level;
......@@ -4256,6 +4263,13 @@ void linphone_core_set_rec_level(LinphoneCore *lc, int level) {
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_CAPTURE,level);
}
void linphone_core_set_media_level(LinphoneCore *lc, int level) {
MSSndCard *sndcard;
lc->sound_conf.media_lev = (char)level;
sndcard=lc->sound_conf.media_sndcard;
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
}
static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, MSFactory *f){
MSSndCard *sndcard=NULL;
if (devid!=NULL){
......@@ -4318,6 +4332,14 @@ LinphoneStatus linphone_core_set_capture_device(LinphoneCore *lc, const char * d
return 0;
}
LinphoneStatus linphone_core_set_media_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK, lc->factory);
lc->sound_conf.media_sndcard=card;
if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","media_dev_id",ms_snd_card_get_string_id(card));
return 0;
}
const char * linphone_core_get_ringer_device(LinphoneCore *lc) {
if (lc->sound_conf.ring_sndcard) return ms_snd_card_get_string_id(lc->sound_conf.ring_sndcard);
return NULL;
......@@ -4331,6 +4353,10 @@ const char * linphone_core_get_capture_device(LinphoneCore *lc) {
return lc->sound_conf.capt_sndcard ? ms_snd_card_get_string_id(lc->sound_conf.capt_sndcard) : NULL;
}
const char * linphone_core_get_media_device(LinphoneCore *lc) {
return lc->sound_conf.media_sndcard ? ms_snd_card_get_string_id(lc->sound_conf.media_sndcard) : NULL;
}
const char** linphone_core_get_sound_devices(LinphoneCore *lc){
return lc->sound_conf.cards;
}
......
......@@ -36,8 +36,9 @@ LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, const char *
LinphonePlayer *obj = linphone_player_new(lc);
MSSndCard *snd_card;
MSSndCardManager *snd_card_manager = ms_factory_get_snd_card_manager(lc->factory);
if (sound_card_name == NULL) sound_card_name = linphone_core_get_ringer_device(lc);
if (sound_card_name == NULL) sound_card_name = linphone_core_get_media_device(lc);
snd_card = ms_snd_card_manager_get_card(snd_card_manager, sound_card_name);
ms_snd_card_set_stream_type(snd_card, MS_SND_CARD_STREAM_MEDIA);
if (video_display_name == NULL) video_display_name = linphone_core_get_video_display_filter(lc);
obj->impl = ms_media_player_new(lc->factory, snd_card, video_display_name, window_id);
obj->open = _local_player_open;
......
......@@ -296,7 +296,8 @@ 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 * capt_sndcard; /* the capture sndcard currently used */
struct _MSSndCard * media_sndcard; /* the media 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 */
......@@ -305,6 +306,7 @@ struct sound_config
char rec_lev;
char play_lev;
char ring_lev;
char media_lev;
char source;
char *local_ring;
char *remote_ring;
......
......@@ -2924,6 +2924,14 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED int linphone_core_get_play_level(LinphoneCor
**/
LINPHONE_PUBLIC LINPHONE_DEPRECATED int linphone_core_get_rec_level(LinphoneCore *lc);
/**
* Get sound media level in 0-100 scale.
* @ingroup media_parameters
* @deprecated
* @donotwrap
**/
LINPHONE_PUBLIC LINPHONE_DEPRECATED int linphone_core_get_media_level(LinphoneCore *lc);
/**
* Set sound ring level in 0-100 scale.
* @ingroup media_parameters
......@@ -2948,6 +2956,14 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_play_level(LinphoneCo
**/
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_rec_level(LinphoneCore *lc, int level);
/**
* Set sound media level in 0-100 scale.
* @deprecated
* @ingroup media_parameters
* @donotwrap
**/
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_set_media_level(LinphoneCore *lc, int level);
LINPHONE_DEPRECATED char linphone_core_get_sound_source(LinphoneCore *lc);
LINPHONE_DEPRECATED void linphone_core_set_sound_source(LinphoneCore *lc, char source);
......@@ -3008,6 +3024,14 @@ LINPHONE_PUBLIC const char * linphone_core_get_playback_device(LinphoneCore *lc)
**/
LINPHONE_PUBLIC const char * linphone_core_get_capture_device(LinphoneCore *lc);
/**
* Gets the name of the currently assigned sound device for media.
* @param[in] lc #LinphoneCore object
* @return The name of the currently assigned sound device for capture
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char * linphone_core_get_media_device(LinphoneCore *lc);
/**
* Sets the sound device used for ringing.
* @param[in] lc #LinphoneCore object
......@@ -3035,6 +3059,15 @@ LINPHONE_PUBLIC LinphoneStatus linphone_core_set_playback_device(LinphoneCore *l
**/
LINPHONE_PUBLIC LinphoneStatus linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
/**
* Sets the sound device used for media.
* @param[in] lc #LinphoneCore object
* @param[in] devid The device name as returned by linphone_core_get_sound_devices()
* @return 0
* @ingroup media_parameters
**/
LINPHONE_PUBLIC LinphoneStatus linphone_core_set_media_device(LinphoneCore *lc, const char * devid);
/**
* Whenever the liblinphone is playing a ring to advertise an incoming call or ringback of an outgoing call, this function stops
* the ringing. Typical use is to stop ringing when the user requests to ignore the call.
......
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