core_utils.h 5.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
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
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 19
*/

20 21 22 23 24
#ifndef LINPHONE_CORE_UTILS_H_
#define LINPHONE_CORE_UTILS_H_


#include "linphone/types.h"
25
#include "linphone/callbacks.h"
26

27

jehan's avatar
jehan committed
28 29 30
#ifdef __cplusplus
extern "C" {
#endif
31 32 33

typedef void (*LsdEndOfPlayCallback)(LsdPlayer *p);

34 35 36
LINPHONE_PUBLIC void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
LINPHONE_PUBLIC void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
LINPHONE_PUBLIC void *lsd_player_get_user_pointer(const LsdPlayer *p);
37 38
LINPHONE_PUBLIC LinphoneStatus lsd_player_play(LsdPlayer *p, const char *filename);
LINPHONE_PUBLIC LinphoneStatus lsd_player_stop(LsdPlayer *p);
39 40 41 42 43 44 45 46 47 48 49 50
LINPHONE_PUBLIC void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
LINPHONE_PUBLIC bool_t lsd_player_loop_enabled(const LsdPlayer *p);
LINPHONE_PUBLIC void lsd_player_set_gain(LsdPlayer *p, float gain);
LINPHONE_PUBLIC LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);

LINPHONE_PUBLIC LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels);
LINPHONE_PUBLIC LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
LINPHONE_PUBLIC void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer);
LINPHONE_PUBLIC void linphone_sound_daemon_stop_all_players(LinphoneSoundDaemon *obj);
LINPHONE_PUBLIC void linphone_sound_daemon_release_all_players(LinphoneSoundDaemon *obj);
LINPHONE_PUBLIC void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
LINPHONE_PUBLIC void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
51

Simon Morlat's avatar
Simon Morlat committed
52

53 54 55 56 57
/*These typedefs are deprecated, but we don't mark them LINPHONE_DEPRECATED otherwise we get deprecation warnings with
 * the deprecated linphone_core_start_echo_calibration() that make use of them*/
typedef void (*LinphoneEcCalibrationCallback)(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data);
typedef void (*LinphoneEcCalibrationAudioInit)(void *data);
typedef void (*LinphoneEcCalibrationAudioUninit)(void *data);
Simon Morlat's avatar
Simon Morlat committed
58 59

/**
60 61 62 63 64
 * @brief Starts an echo calibration of the sound devices, in order to find adequate settings for the echo canceler automatically.
 * @deprecated Use #linphone_core_start_echo_canceller_calibration() instead. To set the callbacks create or get an already instantiated
 * #LinphoneCoreCbs and call #linphone_core_cbs_set_ec_calibration_result(), #linphone_core_cbs_set_ec_calibration_audio_init() and
 * #linphone_core_cbs_set_ec_callibration_audio_uninit(). Deprecated since 2017-10-16.
 * @ingroup misc
65
 * @donotwrap
Simon Morlat's avatar
Simon Morlat committed
66
**/
67
LINPHONE_DEPRECATED LINPHONE_PUBLIC int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb,
68
					 LinphoneEcCalibrationAudioInit audio_init_cb, LinphoneEcCalibrationAudioUninit audio_uninit_cb, void *cb_data);
69

70 71 72 73 74 75 76 77
/**
 * @brief Starts an echo calibration of the sound devices, in order to find adequate settings for the echo canceler automatically.
 * @param[in] lc #LinphoneCore object.
 * @return #LinphoneStatus whether calibration has started or not.
 * @ingroup misc
**/
LINPHONE_PUBLIC LinphoneStatus linphone_core_start_echo_canceller_calibration(LinphoneCore *lc);

Erwan Croze's avatar
Erwan Croze committed
78 79
/**
 * Start the simulation of call to test the latency with an external device
80 81
 * @param lc The core.
 * @param rate Sound sample rate.
82
 * @ingroup misc
Erwan Croze's avatar
Erwan Croze committed
83
**/
84
LINPHONE_PUBLIC LinphoneStatus linphone_core_start_echo_tester(LinphoneCore *lc, unsigned int rate);
85

Erwan Croze's avatar
Erwan Croze committed
86 87
/**
 * Stop the simulation of call
88
 * @ingroup misc
Erwan Croze's avatar
Erwan Croze committed
89
**/
90
LINPHONE_PUBLIC LinphoneStatus linphone_core_stop_echo_tester(LinphoneCore *lc);
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

/**
 * Check whether the device is flagged has crappy opengl
 * @returns TRUE if crappy opengl flag is set, FALSE otherwise
 * @ingroup misc
**/
LINPHONE_PUBLIC bool_t linphone_core_has_crappy_opengl(LinphoneCore *lc);

/**
 * Check whether the device has a hardware echo canceller
 * @returns TRUE if it does, FALSE otherwise
 * @ingroup misc
**/
LINPHONE_PUBLIC bool_t linphone_core_has_builtin_echo_canceller(LinphoneCore *lc);

/**
 * Check whether the device is echo canceller calibration is required
 * @returns TRUE if it is required, FALSE otherwise
 * @ingroup misc
**/
LINPHONE_PUBLIC bool_t linphone_core_is_echo_canceller_calibration_required(LinphoneCore *lc);

113
/**
jehan's avatar
jehan committed
114 115
 * @ingroup IOS
 * Special function to warm up  dtmf feeback stream. #linphone_core_stop_dtmf_stream must() be called before entering FG mode
116
 */
117
LINPHONE_PUBLIC void linphone_core_start_dtmf_stream(LinphoneCore* lc);
118
/**
jehan's avatar
jehan committed
119 120
 * @ingroup IOS
 * Special function to stop dtmf feed back function. Must be called before entering BG mode
121
 */
122
LINPHONE_PUBLIC void linphone_core_stop_dtmf_stream(LinphoneCore* lc);
123

Simon Morlat's avatar
Simon Morlat committed
124 125 126

typedef bool_t (*LinphoneCoreIterateHook)(void *data);

127
LINPHONE_PUBLIC void linphone_core_add_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
Simon Morlat's avatar
Simon Morlat committed
128

129
LINPHONE_PUBLIC void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
130

jehan's avatar
jehan committed
131 132 133
#ifdef __cplusplus
}
#endif
Simon Morlat's avatar
Simon Morlat committed
134

135
#endif /* LINPHONE_CORE_UTILS_H_ */