]> sjero.net Git - linphone/blob - coreapi/linphonecore_utils.h
cc0a6f692ad420071682b4505c443d26348dd6d2
[linphone] / coreapi / linphonecore_utils.h
1 /*
2 linphone
3 Copyright (C) 2010 Simon MORLAT (simon.morlat@linphone.org)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19
20 #ifndef LINPHONECORE_UTILS_H
21 #define LINPHONECORE_UTILS_H
22
23 #ifdef IN_LINPHONE
24 #include "linphonecore.h"
25 #else
26 #include "linphone/linphonecore.h"
27 #endif
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 typedef struct _LsdPlayer LsdPlayer;
33 typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon;
34
35 typedef void (*LsdEndOfPlayCallback)(LsdPlayer *p);
36
37 void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
38 void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
39 void *lsd_player_get_user_pointer(const LsdPlayer *p);
40 int lsd_player_play(LsdPlayer *p, const char *filename);
41 int lsd_player_stop(LsdPlayer *p);
42 void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
43 bool_t lsd_player_loop_enabled(const LsdPlayer *p);
44 void lsd_player_set_gain(LsdPlayer *p, float gain);
45 LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);
46
47 LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname, int rate, int nchannels);
48 LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
49 void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer);
50 void linphone_sound_daemon_stop_all_players(LinphoneSoundDaemon *obj);
51 void linphone_sound_daemon_release_all_players(LinphoneSoundDaemon *obj);
52 void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
53 void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
54
55 /**
56  * Enum describing the result of the echo canceller calibration process.
57 **/
58 typedef enum {
59         LinphoneEcCalibratorInProgress, /**< The echo canceller calibration process is on going. */
60         LinphoneEcCalibratorDone,       /**< The echo canceller calibration has been performed and produced an echo delay measure. */
61         LinphoneEcCalibratorFailed,     /**< The echo canceller calibration process has failed. */
62         LinphoneEcCalibratorDoneNoEcho  /**< The echo canceller calibration has been performed and no echo has been detected. */
63 }LinphoneEcCalibratorStatus;
64
65
66 typedef void (*LinphoneEcCalibrationCallback)(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data);
67
68 /**
69  *
70  * Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceller automatically.
71 **/
72 int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb, void *cb_data);
73 /**
74  * @ingroup IOS
75  * Special function to warm up  dtmf feeback stream. #linphone_core_stop_dtmf_stream must() be called before entering FG mode
76  */
77 void linphone_core_start_dtmf_stream(LinphoneCore* lc);
78 /**
79  * @ingroup IOS
80  * Special function to stop dtmf feed back function. Must be called before entering BG mode
81  */
82 void linphone_core_stop_dtmf_stream(LinphoneCore* lc);
83
84
85 typedef bool_t (*LinphoneCoreIterateHook)(void *data);
86
87 void linphone_core_add_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
88
89 void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
90 /**
91  * @ingroup misc
92  *Function to get  call country code from  ISO 3166-1 alpha-2 code, ex: FR returns 33
93  *@param iso country code alpha2
94  *@return call country code or -1 if not found
95  */
96 int linphone_dial_plan_lookup_ccc_from_iso(const char* iso); 
97 /**
98  * @ingroup misc
99  *Function to get  call country code from  an e164 number, ex: +33952650121 will return 33
100  *@param e164 phone number
101  *@return call country code or -1 if not found
102  */
103 int linphone_dial_plan_lookup_ccc_from_e164(const char* e164);
104
105 #ifdef __cplusplus
106 }
107 #endif
108 #endif
109