From d63af8a7991556d1384b94b014d3d2093fddd45c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 12 Oct 2017 13:37:01 +0200 Subject: [PATCH] Created replacements for methods returning const char ** using bctbx_lists --- coreapi/linphonecore.c | 18 ++++++++++++++++++ coreapi/lpconfig.c | 13 +++++++++++++ coreapi/misc.c | 9 +++++++++ include/linphone/core.h | 30 ++++++++++++++++++++++++++++++ include/linphone/lpconfig.h | 9 +++++++++ include/linphone/types.h | 2 ++ 6 files changed, 81 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3ce577415..ebd2253a0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4142,6 +4142,24 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc){ return lc->video_conf.cams; } +const bctbx_list_t * linphone_core_get_sound_devices_list(LinphoneCore *lc){ + bctbx_list_t *cards_list = NULL; + const char** cards = lc->sound_conf.cards; + for (const char* c = *cards; c; c=*++cards) { + cards_list = bctbx_list_append(cards_list, (char *)c); + } + return cards_list; +} + +const bctbx_list_t * linphone_core_get_video_devices_list(const LinphoneCore *lc){ + bctbx_list_t *cards_list = NULL; + const char** cards = lc->video_conf.cams; + for (const char* c = *cards; c; c=*++cards) { + cards_list = bctbx_list_append(cards_list, (char *)c); + } + return cards_list; +} + void linphone_core_set_default_sound_devices(LinphoneCore *lc){ linphone_core_set_ringer_device(lc, NULL); linphone_core_set_playback_device(lc, NULL); diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 6e1b5cb60..36c512234 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -1127,6 +1127,19 @@ const char** linphone_config_get_sections_names(LpConfig *lpconfig) { return sections_names; } +const bctbx_list_t * linphone_config_get_sections_names_list(LpConfig *lpconfig) { + const bctbx_list_t *sections = lpconfig->sections; + bctbx_list_t *sections_names = NULL; + int i; + + for (i = 0; sections != NULL; sections = sections->next, i++) { + LpSection *section = (LpSection *)sections->data; + sections_names = bctbx_list_append(sections_names, section->name); + } + + return sections_names; +} + char* linphone_config_dump_as_xml(const LpConfig *lpconfig) { char *buffer; diff --git a/coreapi/misc.c b/coreapi/misc.c index c14a8b4c8..c48265397 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -824,6 +824,15 @@ const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){ return core->supported_formats; } +bctbx_list_t * linphone_core_get_supported_file_formats_list(LinphoneCore *core){ + bctbx_list_t *file_formats = NULL; + file_formats = bctbx_list_append(file_formats, ms_strdup("wav")); + if (ms_factory_lookup_filter_by_id(core->factory,MS_MKV_RECORDER_ID)){ + file_formats = bctbx_list_append(file_formats, ms_strdup("mkv")); + } + return file_formats; +} + bool_t linphone_core_file_format_supported(LinphoneCore *lc, const char *fmt){ const char **formats=linphone_core_get_supported_file_formats(lc); for(;*formats!=NULL;++formats){ diff --git a/include/linphone/core.h b/include/linphone/core.h index e78ba8e4c..fabcdab6c 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -2686,9 +2686,19 @@ LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_get_nat_policy(const LinphoneC * @param[in] lc LinphoneCore object * @return An unmodifiable array of strings contanining the names of the available sound devices that is NULL terminated * @ingroup media_parameters + * @donotwrap + * @deprecated use linphone_core_get_sound_devices_list instead **/ LINPHONE_PUBLIC const char** linphone_core_get_sound_devices(LinphoneCore *lc); +/** + * Gets the list of the available sound devices. + * @param[in] lc LinphoneCore object + * @return \bctbx_list{char *} An unmodifiable array of strings contanining the names of the available sound devices that is NULL terminated + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_sound_devices_list(LinphoneCore *lc); + /** * Use this function when you want to set the default sound devices **/ @@ -3592,9 +3602,19 @@ LINPHONE_PUBLIC void linphone_core_reload_video_devices(LinphoneCore *lc); * @param[in] lc LinphoneCore object * @return An unmodifiable array of strings contanining the names of the available video capture devices that is NULL terminated * @ingroup media_parameters + * @deprecated use linphone_core_get_video_devices_list instead + * @donotwrap **/ LINPHONE_PUBLIC const char** linphone_core_get_video_devices(const LinphoneCore *lc); +/** + * Gets the list of the available video capture devices. + * @param[in] lc LinphoneCore object + * @return \bctbx_list{char *} An unmodifiable array of strings contanining the names of the available video capture devices that is NULL terminated + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_video_devices_list(LinphoneCore *lc); + /** * Sets the active video device. * @param[in] lc LinphoneCore object @@ -4474,9 +4494,19 @@ LINPHONE_PUBLIC const char * linphone_core_get_file_transfer_server(LinphoneCore * @param core the core * @return the supported formats, typically 'wav' and 'mkv' * @ingroup media_parameters + * @deprecated use linphone_core_get_supported_file_formats_list instead + * @donotwrap **/ LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneCore *core); +/** + * Returns a null terminated table of strings containing the file format extension supported for call recording. + * @param core the core + * @return \bctbx_list{char *} the supported formats, typically 'wav' and 'mkv' + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC bctbx_list_t * linphone_core_get_supported_file_formats_list(LinphoneCore *core); + /** * Returns whether a specific file format is supported. * @see linphone_core_get_supported_file_formats diff --git a/include/linphone/lpconfig.h b/include/linphone/lpconfig.h index a68292b87..1a9d17dbf 100644 --- a/include/linphone/lpconfig.h +++ b/include/linphone/lpconfig.h @@ -220,9 +220,18 @@ LINPHONE_PUBLIC void linphone_config_clean_entry(LinphoneConfig *lpconfig, const * Returns the list of sections' names in the LinphoneConfig. * @param[in] lpconfig The LinphoneConfig object * @return a null terminated static array of strings + * @deprecated use linphone_config_get_sections_names_list instead + * @donotwrap **/ LINPHONE_PUBLIC const char** linphone_config_get_sections_names(LinphoneConfig *lpconfig); +/** + * Returns the list of sections' names in the LinphoneConfig. + * @param[in] lpconfig The LinphoneConfig object + * @return \bctbx_list{char *} a null terminated static array of strings +**/ +LINPHONE_PUBLIC const bctbx_list_t * linphone_config_get_sections_names_list(LpConfig *lpconfig); + /** * Call a function for each section present in the configuration. **/ diff --git a/include/linphone/types.h b/include/linphone/types.h index b314051af..c1c46e835 100644 --- a/include/linphone/types.h +++ b/include/linphone/types.h @@ -537,12 +537,14 @@ typedef enum _LinphoneIceState { /** * IM encryption engine. * @ingroup misc + * @donotwrap */ typedef struct _LinphoneImEncryptionEngine LinphoneImEncryptionEngine; /** * An object to handle the callbacks for the handling a LinphoneImEncryptionEngine object. * @ingroup misc + * @donotwrap */ typedef struct _LinphoneImEncryptionEngineCbs LinphoneImEncryptionEngineCbs;