diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 452447232..0befb3cd4 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5930,7 +5930,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_presence_model_unref(lc->presence_model); } linphone_core_free_payload_types(lc); - + if (lc->supported_formats) ms_free(lc->supported_formats); linphone_core_message_storage_close(lc); ms_exit(); linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index dd0ff311a..89fd4723a 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2602,6 +2602,14 @@ LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, * */ LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url); +/** + * Returns a null terminated table of strings containing the file format extension supported for call recording. + * @param core the core + * @return the supported formats, typically 'wav' and 'mkv' + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneCore *core); + #ifdef __cplusplus } #endif diff --git a/coreapi/misc.c b/coreapi/misc.c index 43b3a3139..a058db102 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1522,3 +1522,18 @@ const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){ lc->rtp_conf.srtp_suites=result; return result; } + + + +const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){ + static const char *mkv="mkv"; + static const char *wav="wav"; + if (core->supported_formats==NULL){ + core->supported_formats=ms_malloc0(3*sizeof(char*)); + core->supported_formats[0]=wav; + if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(),MS_MKV_WRITER_ID)){ + core->supported_formats[1]=mkv; + } + } + return core->supported_formats; +} diff --git a/coreapi/private.h b/coreapi/private.h index b59ccd906..49e3fb72e 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -726,6 +726,7 @@ struct _LinphoneCore MSList *tones; LinphoneReason chat_deny_code; char *file_transfer_server; + const char **supported_formats; }; diff --git a/gtk/main.c b/gtk/main.c index c1a52cda4..c987b4f9e 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -983,6 +983,9 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_ char date[64]={0}; time_t curtime=time(NULL); struct tm loctime; + const char **fmts=linphone_core_get_supported_file_formats(linphone_gtk_get_core()); + int i; + const char *ext="wav"; #ifdef WIN32 loctime=*localtime(&curtime); @@ -991,19 +994,26 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_ #endif snprintf(date,sizeof(date)-1,"%i%02i%02i-%02i%02i",loctime.tm_year+1900,loctime.tm_mon+1,loctime.tm_mday, loctime.tm_hour, loctime.tm_min); + for (i=0;fmts[i]!=NULL;++i){ + if (strcmp(fmts[i],"mkv")==0){ + ext="mkv"; + break; + } + } + if (address){ id=linphone_address_get_username(address); if (id==NULL) id=linphone_address_get_domain(address); } if (is_conference){ - snprintf(filename,sizeof(filename)-1,"%s-conference-%s.wav", + snprintf(filename,sizeof(filename)-1,"%s-conference-%s.%s", linphone_gtk_get_ui_config("title","Linphone"), - date); + date,ext); }else{ - snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.wav", + snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.%s", linphone_gtk_get_ui_config("title","Linphone"), date, - id); + id,ext); } if (!dir) { ms_message ("No directory for music, using [%s] instead",dir=getenv("HOME")); diff --git a/mediastreamer2 b/mediastreamer2 index df42f0d73..a7846bc24 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit df42f0d73d930079c43ef92808529a4716e72d99 +Subproject commit a7846bc24f3e5bb1cc89faf879f6d64638665585