Commit b5da4077 authored by Sylvain Berfini's avatar Sylvain Berfini 🐮
Browse files

feature: LinphoneAudioDevice API to handle audio routing

parent ddc20bd3
......@@ -109,6 +109,9 @@ static void ecc_deinit_filters(EcCalibrator *ecc){
ms_filter_destroy(ecc->sndwrite);
ms_ticker_destroy(ecc->ticker);
if (ecc->capt_card) ms_snd_card_unref(ecc->capt_card);
if (ecc->play_card) ms_snd_card_unref(ecc->play_card);
}
static void on_tone_sent(void *data, MSFilter *f, unsigned int event_id, void *arg){
......@@ -273,10 +276,7 @@ static void ecc_play_tones(EcCalibrator *ecc){
static void * ecc_thread(void *p){
EcCalibrator *ecc=(EcCalibrator*)p;
ecc_init_filters(ecc);
ecc_play_tones(ecc);
ecc_deinit_filters(ecc);
ms_thread_exit(NULL);
return NULL;
}
......@@ -290,14 +290,15 @@ EcCalibrator * ec_calibrator_new(MSFactory *factory, MSSndCard *play_card, MSSnd
ecc->cb_data=cb_data;
ecc->audio_init_cb=audio_init_cb;
ecc->audio_uninit_cb=audio_uninit_cb;
ecc->capt_card=capt_card;
ecc->play_card=play_card;
ecc->capt_card = ms_snd_card_ref(capt_card);
ecc->play_card = ms_snd_card_ref(play_card);
ecc->factory=factory;
return ecc;
}
void ec_calibrator_start(EcCalibrator *ecc){
ms_thread_create(&ecc->thread,NULL,ecc_thread,ecc);
ecc_init_filters(ecc);
ms_thread_create(&ecc->thread, NULL, ecc_thread, ecc);
}
LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc){
......@@ -306,6 +307,7 @@ LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc){
void ec_calibrator_destroy(EcCalibrator *ecc){
if (ecc->thread != 0) ms_thread_join(ecc->thread,NULL);
ecc_deinit_filters(ecc);
ms_free(ecc);
}
......
......@@ -27,8 +27,8 @@
EchoTester* ec_tester_new(MSFactory *factory, MSSndCard *capture_card, MSSndCard *playback_card, unsigned int rate) {
EchoTester *ect = ms_new0(EchoTester,1);
ect->factory = factory;
ect->capture_card = capture_card;
ect->playback_card = playback_card;
ect->capture_card = ms_snd_card_ref(capture_card);
ect->playback_card = ms_snd_card_ref(playback_card);
ect->rate = rate;
return ect;
......@@ -76,6 +76,8 @@ static void ect_uninit_filters(EchoTester *ect) {
}
void ec_tester_destroy(EchoTester *ect) {
if (ect->capture_card) ms_snd_card_unref(ect->capture_card);
if (ect->playback_card) ms_snd_card_unref(ect->playback_card);
ms_free(ect);
}
......
......@@ -532,6 +532,22 @@ void linphone_core_cbs_set_last_call_ended(LinphoneCoreCbs *cbs, LinphoneCoreCbs
cbs->vtable->last_call_ended = cb;
}
LinphoneCoreCbsAudioDeviceChangedCb linphone_core_cbs_get_audio_device_changed(LinphoneCoreCbs *cbs) {
return cbs->vtable->audio_device_changed;
}
void linphone_core_cbs_set_audio_device_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsAudioDeviceChangedCb cb) {
cbs->vtable->audio_device_changed = cb;
}
LinphoneCoreCbsAudioDevicesListUpdatedCb linphone_core_cbs_get_audio_devices_list_updated(LinphoneCoreCbs *cbs) {
return cbs->vtable->audio_devices_list_updated;
}
void linphone_core_cbs_set_audio_devices_list_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsAudioDevicesListUpdatedCb cb) {
cbs->vtable->audio_devices_list_updated = cb;
}
void linphone_core_cbs_set_ec_calibration_result(LinphoneCoreCbs *cbs, LinphoneCoreCbsEcCalibrationResultCb cb) {
cbs->vtable->ec_calibration_result = cb;
}
......@@ -1245,6 +1261,9 @@ static void build_sound_devices_table(LinphoneCore *lc){
old=lc->sound_conf.cards;
lc->sound_conf.cards=devices;
if (old!=NULL) ms_free((void *)old);
L_GET_PRIVATE_FROM_C_OBJECT(lc)->computeAudioDevicesList();
linphone_core_notify_audio_devices_list_updated(lc);
}
static string get_default_local_ring(LinphoneCore * lc) {
......@@ -4708,7 +4727,8 @@ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *dev
LinphoneStatus linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK, lc->factory);
lc->sound_conf.ring_sndcard=card;
if (lc->sound_conf.ring_sndcard) ms_snd_card_unref(lc->sound_conf.ring_sndcard);
if (card) lc->sound_conf.ring_sndcard = ms_snd_card_ref(card);
if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","ringer_dev_id",ms_snd_card_get_string_id(card));
return 0;
......@@ -4716,7 +4736,8 @@ LinphoneStatus linphone_core_set_ringer_device(LinphoneCore *lc, const char * de
LinphoneStatus linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK, lc->factory);
lc->sound_conf.play_sndcard=card;
if (lc->sound_conf.play_sndcard) ms_snd_card_unref(lc->sound_conf.play_sndcard);
if (card) lc->sound_conf.play_sndcard = ms_snd_card_ref(card);
if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","playback_dev_id",ms_snd_card_get_string_id(card));
return 0;
......@@ -4724,7 +4745,8 @@ LinphoneStatus linphone_core_set_playback_device(LinphoneCore *lc, const char *
LinphoneStatus linphone_core_set_capture_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_CAPTURE, lc->factory);
lc->sound_conf.capt_sndcard=card;
if (lc->sound_conf.capt_sndcard) ms_snd_card_unref(lc->sound_conf.capt_sndcard);
if (card) lc->sound_conf.capt_sndcard = ms_snd_card_ref(card);
if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","capture_dev_id",ms_snd_card_get_string_id(card));
return 0;
......@@ -4732,7 +4754,8 @@ LinphoneStatus linphone_core_set_capture_device(LinphoneCore *lc, const char * d
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 (lc->sound_conf.media_sndcard) ms_snd_card_unref(lc->sound_conf.media_sndcard);
if (card) lc->sound_conf.media_sndcard = ms_snd_card_ref(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;
......@@ -6430,6 +6453,10 @@ static void sound_config_uninit(LinphoneCore *lc)
{
sound_config_t *config=&lc->sound_conf;
ms_free((void *)config->cards);
if (config->ring_sndcard) ms_snd_card_unref(config->ring_sndcard);
if (config->media_sndcard) ms_snd_card_unref(config->media_sndcard);
if (config->capt_sndcard) ms_snd_card_unref(config->capt_sndcard);
if (config->play_sndcard) ms_snd_card_unref(config->play_sndcard);
lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring);
lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev);
......
......@@ -52,6 +52,7 @@ void linphone_call_notify_tmmbr_received(LinphoneCall *call, int stream_index, i
void linphone_call_notify_snapshot_taken(LinphoneCall *call, const char *file_path);
void linphone_call_notify_next_video_frame_decoded(LinphoneCall *call);
void linphone_call_notify_camera_not_working(LinphoneCall *call, const char *camera_name);
void linphone_call_notify_audio_device_changed(LinphoneCall *call, LinphoneAudioDevice *audioDevice);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, LinphonePrivate::SalCallOp *op);
......@@ -555,6 +556,8 @@ void linphone_core_notify_is_composing_received(LinphoneCore *lc, LinphoneChatRo
void linphone_core_notify_dtmf_received(LinphoneCore* lc, LinphoneCall *call, int dtmf);
void linphone_core_notify_first_call_started(LinphoneCore *lc);
void linphone_core_notify_last_call_ended(LinphoneCore *lc);
void linphone_core_notify_audio_device_changed(LinphoneCore *lc, LinphoneAudioDevice *audioDevice);
void linphone_core_notify_audio_devices_list_updated(LinphoneCore *lc);
/*
* return true if at least a registered vtable has a cb for dtmf received*/
bool_t linphone_core_dtmf_received_has_listener(const LinphoneCore* lc);
......
......@@ -165,7 +165,12 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf
cfg->avpf_rr_interval = lc ? !!lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
cfg->publish_expires= lc ? lp_config_get_default_int(lc->config, "proxy", "publish_expires", -1) : -1;
cfg->publish = lc ? !!lp_config_get_default_int(lc->config, "proxy", "publish", FALSE) : FALSE;
cfg->push_notification_allowed = lc ? !!lp_config_get_default_int(lc->config, "proxy", "push_notification_allowed", FALSE) : FALSE;
bool_t push_allowed_default = FALSE;
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
push_allowed_default = TRUE;
#endif
cfg->push_notification_allowed = lc ? !!lp_config_get_default_int(lc->config, "proxy", "push_notification_allowed", push_allowed_default) : push_allowed_default;
cfg->refkey = refkey ? ms_strdup(refkey) : NULL;
if (nat_policy_ref) {
LinphoneNatPolicy *policy = linphone_config_create_nat_policy_from_section(lc->config,nat_policy_ref);
......
......@@ -55,6 +55,10 @@ bool_t linphone_ringtoneplayer_is_started(LinphoneRingtonePlayer* rp) {
return linphone_ringtoneplayer_ios_is_started(rp);
}
RingStream* linphone_ringtoneplayer_get_stream(LinphoneRingtonePlayer* rp) {
return NULL;
}
int linphone_ringtoneplayer_stop(LinphoneRingtonePlayer* rp) {
return linphone_ringtoneplayer_ios_stop(rp);
}
......@@ -106,6 +110,10 @@ bool_t linphone_ringtoneplayer_is_started(LinphoneRingtonePlayer* rp) {
return (rp->ringstream!=NULL);
}
RingStream* linphone_ringtoneplayer_get_stream(LinphoneRingtonePlayer* rp) {
return rp->ringstream;
}
LinphoneStatus linphone_ringtoneplayer_stop(LinphoneRingtonePlayer* rp) {
if (rp->ringstream) {
ring_stop(rp->ringstream);
......
......@@ -109,6 +109,16 @@ void linphone_core_notify_last_call_ended(LinphoneCore *lc) {
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_audio_device_changed(LinphoneCore *lc, LinphoneAudioDevice *audioDevice) {
NOTIFY_IF_EXIST(audio_device_changed, lc, audioDevice);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_audio_devices_list_updated(LinphoneCore *lc) {
NOTIFY_IF_EXIST(audio_devices_list_updated, lc);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token) {
NOTIFY_IF_EXIST(call_encryption_changed, lc,call,on,authentication_token);
cleanup_dead_vtable_refs(lc);
......
......@@ -74,6 +74,7 @@ set(ROOT_HEADER_FILES
set(C_API_HEADER_FILES
c-address.h
c-audio-device.h
c-auth-info.h
c-api.h
c-call-cbs.h
......
......@@ -22,6 +22,7 @@
#include "linphone/utils/general.h"
#include "linphone/api/c-audio-device.h"
#include "linphone/api/c-auth-info.h"
#include "linphone/api/c-address.h"
#include "linphone/api/c-call-cbs.h"
......
/*
* Copyright (c) 2010-2020 Belledonne Communications SARL.
*
* This file is part of Liblinphone.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef LINPHONE_AUDIO_DEVICE_H
#define LINPHONE_AUDIO_DEVICE_H
#include "linphone/api/c-types.h"
/**
* @addtogroup audio
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Returns the id of the audio device
* @param[in] audioDevice the #LinphoneAudioDevice
* @return the id of the audio device
*/
LINPHONE_PUBLIC const char *linphone_audio_device_get_id(const LinphoneAudioDevice *audioDevice);
/**
* Returns the name of the audio device
* @param[in] audioDevice the #LinphoneAudioDevice
* @return the name of the audio device
*/
LINPHONE_PUBLIC const char *linphone_audio_device_get_device_name(const LinphoneAudioDevice *audioDevice);
/**
* Returns the driver name used by the device
* @param[in] audioDevice the #LinphoneAudioDevice
* @returns the name of the driver used by this audio device
*/
LINPHONE_PUBLIC const char *linphone_audio_device_get_driver_name(const LinphoneAudioDevice *audioDevice);
/**
* Returns the capabilities of the device
* @param[in] audioDevice the #LinphoneAudioDevice
* @returns the capabilities of the audio device (RECORD, PLAY or both) as a bit mask
*/
LINPHONE_PUBLIC LinphoneAudioDeviceCapabilities linphone_audio_device_get_capabilities(const LinphoneAudioDevice *audioDevice);
/**
* Returns the type of the device
* @param[in] audioDevice the #LinphoneAudioDevice
* @returns the type of the audio device (microphone, speaker, earpiece, bluetooth, etc...)
*/
LINPHONE_PUBLIC LinphoneAudioDeviceType linphone_audio_device_get_type(const LinphoneAudioDevice *audioDevice);
/**
* Returns whether or not the audio device has the given capability
* @param[in] audioDevice the #LinphoneAudioDevice
* @param[in] capability the capability to check
* @returns TRUE if the audio device has the capability, FALSE otherwise
*/
LINPHONE_PUBLIC bool_t linphone_audio_device_has_capability(const LinphoneAudioDevice *audioDevice, const LinphoneAudioDeviceCapabilities capability);
/**
* Takes a reference on a #LinphoneAudioDevice.
*/
LINPHONE_PUBLIC LinphoneAudioDevice *linphone_audio_device_ref(LinphoneAudioDevice *audioDevice);
/**
* Releases a #LinphoneAudioDevice.
*/
LINPHONE_PUBLIC void linphone_audio_device_unref(LinphoneAudioDevice *audioDevice);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
\ No newline at end of file
......@@ -215,6 +215,20 @@ LINPHONE_PUBLIC LinphoneCallCbsCameraNotWorkingCb linphone_call_cbs_get_camera_n
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_camera_not_working(LinphoneCallCbs *cbs, LinphoneCallCbsCameraNotWorkingCb cb);
/**
* Get the audio device changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The audio device changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsAudioDeviceChangedCb linphone_call_cbs_get_audio_device_changed(LinphoneCallCbs *cbs);
/**
* Set the audio device changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The audio device changedcallback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_audio_device_changed(LinphoneCallCbs *cbs, LinphoneCallCbsAudioDeviceChangedCb cb);
/**
* @}
*/
......
......@@ -837,6 +837,36 @@ LINPHONE_PUBLIC void linphone_call_set_params(LinphoneCall *call, const Linphone
**/
LINPHONE_PUBLIC const LinphoneCallParams *linphone_call_get_params(LinphoneCall *call);
/**
* Sets the given #LinphoneAudioDevice as input for this call only.
* @param[in] call The #LinphoneCall
* @param[in] audio_device The #LinphoneAudioDevice
*/
LINPHONE_PUBLIC void linphone_call_set_input_audio_device(LinphoneCall *call, LinphoneAudioDevice *audio_device);
/**
* Sets the given #LinphoneAudioDevice as output for this call only.
* @param[in] call The #LinphoneCall
* @param[in] audio_device The #LinphoneAudioDevice
*/
LINPHONE_PUBLIC void linphone_call_set_output_audio_device(LinphoneCall *call, LinphoneAudioDevice *audio_device);
/**
* Gets the current input device for this call.
* @param[in] call The #LinphoneCall
* @returns the #LinphoneAudioDevice used by this call as input or NULL if there is currently no soundcard configured (depending on the state of the call)
* @maybenil
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_call_get_input_audio_device(const LinphoneCall *call);
/**
* Gets the current output device for this call.
* @param[in] call The #LinphoneCall
* @returns the #LinphoneAudioDevice used by this call as output or NULL if there is currently no soundcard configured (depending on the state of the call)
* @maybenil
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_call_get_output_audio_device(const LinphoneCall *call);
/**
* @}
*/
......
......@@ -121,6 +121,14 @@ typedef void (*LinphoneCallCbsNextVideoFrameDecodedCb)(LinphoneCall *call);
*/
typedef void (*LinphoneCallCbsCameraNotWorkingCb)(LinphoneCall *call, const char *camera_name);
/**
* Callback to notify that the audio device has been changed.
*
* @param call LinphoneCall for which the audio device has changed
* @param audioDevice the new audio device used for this call
*/
typedef void (*LinphoneCallCbsAudioDeviceChangedCb)(LinphoneCall *call, LinphoneAudioDevice *audioDevice);
/**
* @}
**/
......
......@@ -455,6 +455,21 @@ typedef void (*LinphoneCoreCbsFirstCallStartedCb)(LinphoneCore *lc);
*/
typedef void (*LinphoneCoreCbsLastCallEndedCb)(LinphoneCore *lc);
/**
* Callback prototype telling that the audio device for at least one call has changed
* @param[in] lc LinphoneCore object
* @param[in] audioDevice the newly used LinphoneAudioDevice object
*/
typedef void (*LinphoneCoreCbsAudioDeviceChangedCb)(LinphoneCore *lc, LinphoneAudioDevice *audioDevice);
/**
* Callback prototype telling the audio devices list has been updated.
* Either a new device is available or a previously available device isn't anymore.
* You can call linphone_core_get_audio_devices() to get the new list.
* @param[in] lc LinphoneCore object
*/
typedef void (*LinphoneCoreCbsAudioDevicesListUpdatedCb)(LinphoneCore *lc);
/**
* @}
**/
......
......@@ -235,6 +235,8 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb chat_room_ephemeral_message_deleted;
LinphoneCoreCbsFirstCallStartedCb first_call_started;
LinphoneCoreCbsLastCallEndedCb last_call_ended;
LinphoneCoreCbsAudioDeviceChangedCb audio_device_changed;
LinphoneCoreCbsAudioDevicesListUpdatedCb audio_devices_list_updated;
void *user_data; /**<User data associated with the above callbacks */
} LinphoneCoreVTable;
......@@ -837,6 +839,34 @@ LINPHONE_PUBLIC LinphoneCoreCbsLastCallEndedCb linphone_core_cbs_get_last_call_e
**/
LINPHONE_PUBLIC void linphone_core_cbs_set_last_call_ended(LinphoneCoreCbs *cbs, LinphoneCoreCbsLastCallEndedCb cb);
/**
* Gets the audio device changed callback.
* @param[in] cbs LinphoneCoreCbs object
* @return The current callback
*/
LINPHONE_PUBLIC LinphoneCoreCbsAudioDeviceChangedCb linphone_core_cbs_get_audio_device_changed(LinphoneCoreCbs *cbs);
/**
* Sets the audio device changed callback.
* @param[in] cbs LinphoneCoreCbs object
* @param[in] cb The callback to use
**/
LINPHONE_PUBLIC void linphone_core_cbs_set_audio_device_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsAudioDeviceChangedCb cb);
/**
* Gets the audio devices list updated callback.
* @param[in] cbs LinphoneCoreCbs object
* @return The current callback
*/
LINPHONE_PUBLIC LinphoneCoreCbsAudioDevicesListUpdatedCb linphone_core_cbs_get_audio_devices_list_updated(LinphoneCoreCbs *cbs);
/**
* Sets the audio devices list updated callback.
* @param[in] cbs LinphoneCoreCbs object
* @param[in] cb The callback to use
**/
LINPHONE_PUBLIC void linphone_core_cbs_set_audio_devices_list_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsAudioDevicesListUpdatedCb cb);
/**
* @brief Sets a callback to call each time the echo-canceler calibration is completed.
*/
......@@ -6321,6 +6351,90 @@ LINPHONE_PUBLIC void linphone_core_set_auto_iterate_enabled(LinphoneCore *core,
*/
LINPHONE_PUBLIC bool_t linphone_core_is_auto_iterate_enabled(LinphoneCore *core);
/**
* Returns a list of audio devices, with only the first device for each type
* To have the list of all audio devices, use #linphone_core_get_extended_audio_devices
* @param[in] core The #LinphoneCore
* @returns \bctbx_list{LinphoneAudioDevice} A list with the first #LinphoneAudioDevice of each type
* @ingroup audio
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_audio_devices(const LinphoneCore *core);
/**
* Returns the list of all audio devices
* @param[in] core The #LinphoneCore
* @returns \bctbx_list{LinphoneAudioDevice} A list of all #LinphoneAudioDevice
* @ingroup audio
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_extended_audio_devices(const LinphoneCore *core);
/**
* Sets the given #LinphoneAudioDevice as input for all active calls.
* @param[in] core The #LinphoneCore
* @param[in] audio_device The #LinphoneAudioDevice
* @ingroup audio
*/
LINPHONE_PUBLIC void linphone_core_set_input_audio_device(LinphoneCore *core, LinphoneAudioDevice *audio_device);
/**
* Sets the given #LinphoneAudioDevice as output for all active calls.
* @param[in] core The #LinphoneCore
* @param[in] audio_device The #LinphoneAudioDevice
* @ingroup audio
*/
LINPHONE_PUBLIC void linphone_core_set_output_audio_device(LinphoneCore *core, LinphoneAudioDevice *audio_device);
/**
* Gets the input audio device for the current call
* @param[in] core The #LinphoneCore
* @returns The input audio device for the current or first call, NULL if there is no call
* @maybenil
* @ingroup audio
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_core_get_input_audio_device(const LinphoneCore *core);
/**
* Gets the output audio device for the current call
* @param[in] core The #LinphoneCore
* @returns The output audio device for the current or first call, NULL if there is no call
* @maybenil
* @ingroup audio
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_core_get_output_audio_device(const LinphoneCore *core);
/**
* Sets the given #LinphoneAudioDevice as default input for next calls.
* @param[in] core The #LinphoneCore
* @param[in] audio_device The #LinphoneAudioDevice
* @ingroup audio
*/
LINPHONE_PUBLIC void linphone_core_set_default_input_audio_device(LinphoneCore *core, LinphoneAudioDevice *audio_device);
/**
* Sets the given #LinphoneAudioDevice as default output for next calls.
* @param[in] core The #LinphoneCore
* @param[in] audio_device The #LinphoneAudioDevice
* @ingroup audio
*/
LINPHONE_PUBLIC void linphone_core_set_default_output_audio_device(LinphoneCore *core, LinphoneAudioDevice *audio_device);
/**
* Gets the default input audio device
* @param[in] core The #LinphoneCore
* @returns The default input audio device
* @ingroup audio
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_core_get_default_input_audio_device(const LinphoneCore *core);
/**
* Gets the default output audio device
* @param[in] core The #LinphoneCore
* @returns The default output audio device
* @ingroup audio
*/
LINPHONE_PUBLIC const LinphoneAudioDevice* linphone_core_get_default_output_audio_device(const LinphoneCore *core);
#ifdef __cplusplus
}
#endif
......
......@@ -50,6 +50,33 @@ typedef enum _LinphoneCallState{
LinphoneCallStateEarlyUpdating, /**< We are updating the call while not yet answered (SIP UPDATE in early dialog sent) */
} LinphoneCallState;
/**
* #LinphoneAudioDeviceType enum represents the different types of an audio device.
* @ingroup audio
*/
typedef enum _LinphoneAudioDeviceType {
LinphoneAudioDeviceTypeUnknown, /** Unknown */
LinphoneAudioDeviceTypeMicrophone, /** Microphone */
LinphoneAudioDeviceTypeEarpiece, /** Earpiece */
LinphoneAudioDeviceTypeSpeaker, /** Speaker */
LinphoneAudioDeviceTypeBluetooth, /** Bluetooth */
LinphoneAudioDeviceTypeBluetoothA2DP, /** Bluetooth A2DP */
LinphoneAudioDeviceTypeTelephony, /** Telephony */
LinphoneAudioDeviceTypeAuxLine, /** AuxLine */
LinphoneAudioDeviceTypeGenericUsb, /** GenericUsb */
LinphoneAudioDeviceTypeHeadset, /** Headset */
LinphoneAudioDeviceTypeHeadphones, /** Headphones */
} LinphoneAudioDeviceType;
/**
* #LinphoneAudioDeviceCapabilities enum represents whether a device can record audio, play audio or both
* @ingroup audio
*/
typedef enum _LinphoneAudioDeviceCapabilities {
LinphoneAudioDeviceCapabilityRecord = 1 << 0, /** Can record audio */
LinphoneAudioDeviceCapabilityPlay = 1 << 1, /** Can play audio */
} LinphoneAudioDeviceCapabilities;
// =============================================================================
// DEPRECATED
// =============================================================================
......