From e78a360a87fa332a5034e27d742718f5d86f29a2 Mon Sep 17 00:00:00 2001 From: Svalorzen Date: Fri, 12 Feb 2016 16:55:46 +0100 Subject: [PATCH] Modified soundcard show command to show whether we are using files or not --- console/commands.c | 16 ++++++++++------ coreapi/linphonecore.c | 12 ++++++++---- coreapi/linphonecore.h | 9 +++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/console/commands.c b/console/commands.c index 490e6d400..eaabc392f 100644 --- a/console/commands.c +++ b/console/commands.c @@ -1243,12 +1243,16 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *args) if (strcmp(arg1, "show")==0) { - linphonec_out("Ringer device: %s\n", - linphone_core_get_ringer_device(lc)); - linphonec_out("Playback device: %s\n", - linphone_core_get_playback_device(lc)); - linphonec_out("Capture device: %s\n", - linphone_core_get_capture_device(lc)); + if (linphone_core_get_use_files(lc)) { + linphonec_out("Using files.\n"); + } else { + linphonec_out("Ringer device: %s\n", + linphone_core_get_ringer_device(lc)); + linphonec_out("Playback device: %s\n", + linphone_core_get_playback_device(lc)); + linphonec_out("Capture device: %s\n", + linphone_core_get_capture_device(lc)); + } return 1; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f1f808514..e04b8d52d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1235,7 +1235,7 @@ static MSList *add_missing_supported_codecs(LinphoneCore *lc, const MSList *defa if (!elem2){ PayloadType *pt=(PayloadType*)elem->data; /*this codec from default list should be inserted in the list*/ - + if (!linphone_core_codec_supported(lc, payload_type_get_stream_type(pt), pt->mime_type)) continue; if (!last_inserted){ l=ms_list_prepend(l,pt); @@ -1712,14 +1712,14 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up"); ortp_init(); linphone_core_activate_log_serialization_if_needed(); - + lc->factory = ms_factory_new_with_voip(); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ /* This allows to run event's callback in linphone_core_iterate() */ lc->msevq=ms_factory_create_event_queue(lc->factory); - + lc->sal=sal_init(lc->factory); sal_set_http_proxy_host(lc->sal, linphone_core_get_http_proxy_host(lc)); sal_set_http_proxy_port(lc->sal, linphone_core_get_http_proxy_port(lc)); @@ -5884,6 +5884,10 @@ void linphone_core_set_use_files(LinphoneCore *lc, bool_t yesno){ lc->use_files=yesno; } +bool_t linphone_core_get_use_files(LinphoneCore *lc) { + return lc->use_files; +} + const char * linphone_core_get_play_file(const LinphoneCore *lc) { return lc->play_file; } @@ -6466,7 +6470,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); linphone_core_deactivate_log_serialization_if_needed(); ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy); - + ms_factory_destroy(lc->factory); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index c14178aab..772f82276 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -3685,6 +3685,15 @@ void linphone_core_show_video(LinphoneCore *lc, bool_t show); **/ LINPHONE_PUBLIC void linphone_core_set_use_files(LinphoneCore *lc, bool_t yesno); +/** + * Gets whether linphone is currently streaming audio from and to files, rather + * than using the soundcard. + * @ingroup media_parameters + * @param[in] lc LinphoneCore object + * @return A boolean value representing whether linphone is streaming audio from and to files or not. +**/ +LINPHONE_PUBLIC bool_t linphone_core_get_use_files(LinphoneCore *lc); + /** * Get the wav file that is played when putting somebody on hold, * or when files are used instead of soundcards (see linphone_core_set_use_files()). -- 2.21.0