linphonecore_utils.h 4.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef LINPHONECORE_UTILS_H
#define LINPHONECORE_UTILS_H

#ifdef IN_LINPHONE
#include "linphonecore.h"
#else
#include "linphone/linphonecore.h"
#endif
jehan's avatar
jehan committed
28 29 30
#ifdef __cplusplus
extern "C" {
#endif
31 32 33 34 35 36 37 38

typedef struct _LsdPlayer LsdPlayer;
typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon;

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

void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
39
void *lsd_player_get_user_pointer(const LsdPlayer *p);
40 41 42
int lsd_player_play(LsdPlayer *p, const char *filename);
int lsd_player_stop(LsdPlayer *p);
void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
43
bool_t lsd_player_loop_enabled(const LsdPlayer *p);
Simon Morlat's avatar
Simon Morlat committed
44
void lsd_player_set_gain(LsdPlayer *p, float gain);
Simon Morlat's avatar
Simon Morlat committed
45
LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);
46

47
LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname, int rate, int nchannels);
48 49
LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
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 53 54
void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);

Simon Morlat's avatar
Simon Morlat committed
55 56 57 58
/**
 * Enum describing the result of the echo canceller calibration process.
**/
typedef enum {
59 60 61 62
	LinphoneEcCalibratorInProgress,	/**< The echo canceller calibration process is on going. */
	LinphoneEcCalibratorDone,	/**< The echo canceller calibration has been performed and produced an echo delay measure. */
	LinphoneEcCalibratorFailed,	/**< The echo canceller calibration process has failed. */
	LinphoneEcCalibratorDoneNoEcho	/**< The echo canceller calibration has been performed and no echo has been detected. */
Simon Morlat's avatar
Simon Morlat committed
63 64 65 66
}LinphoneEcCalibratorStatus;


typedef void (*LinphoneEcCalibrationCallback)(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data);
67 68
typedef void (*LinphoneEcCalibrationAudioInit)(void *data);
typedef void (*LinphoneEcCalibrationAudioUninit)(void *data);
Simon Morlat's avatar
Simon Morlat committed
69 70

/**
jehan's avatar
jehan committed
71
 *
Simon Morlat's avatar
Simon Morlat committed
72 73
 * Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceller automatically.
**/
74
LINPHONE_PUBLIC int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb,
75
					 LinphoneEcCalibrationAudioInit audio_init_cb, LinphoneEcCalibrationAudioUninit audio_uninit_cb, void *cb_data);
76
/**
jehan's avatar
jehan committed
77 78
 * @ingroup IOS
 * Special function to warm up  dtmf feeback stream. #linphone_core_stop_dtmf_stream must() be called before entering FG mode
79
 */
jehan's avatar
jehan committed
80
void linphone_core_start_dtmf_stream(LinphoneCore* lc);
81
/**
jehan's avatar
jehan committed
82 83
 * @ingroup IOS
 * Special function to stop dtmf feed back function. Must be called before entering BG mode
84
 */
jehan's avatar
jehan committed
85
void linphone_core_stop_dtmf_stream(LinphoneCore* lc);
86

Simon Morlat's avatar
Simon Morlat committed
87 88 89 90 91 92

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

void linphone_core_add_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);

void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
93 94 95 96 97 98
/**
 * @ingroup misc
 *Function to get  call country code from  ISO 3166-1 alpha-2 code, ex: FR returns 33
 *@param iso country code alpha2
 *@return call country code or -1 if not found
 */
99
LINPHONE_PUBLIC	int linphone_dial_plan_lookup_ccc_from_iso(const char* iso); 
100 101 102 103 104 105
/**
 * @ingroup misc
 *Function to get  call country code from  an e164 number, ex: +33952650121 will return 33
 *@param e164 phone number
 *@return call country code or -1 if not found
 */
106
LINPHONE_PUBLIC	int linphone_dial_plan_lookup_ccc_from_e164(const char* e164);
107

jehan's avatar
jehan committed
108 109 110
#ifdef __cplusplus
}
#endif
111
#endif
Simon Morlat's avatar
Simon Morlat committed
112