From ae4298faaf531741fe29f03c448a0b0d3a429c6a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 19 Jun 2014 11:59:49 +0200 Subject: [PATCH 1/4] video recorder in place --- coreapi/linphonecore.c | 2 +- coreapi/linphonecore.h | 8 ++++++++ coreapi/misc.c | 15 +++++++++++++++ coreapi/private.h | 1 + gtk/main.c | 18 ++++++++++++++---- mediastreamer2 | 2 +- 6 files changed, 40 insertions(+), 6 deletions(-) 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 From 960253d058f687a842a5cba818ffdaf586ac70af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 24 Jun 2014 13:22:10 +0200 Subject: [PATCH 2/4] Rename the MKV_WRITER filter into MKV_RECORDER --- coreapi/misc.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index a058db102..0cc6a3ac9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1531,7 +1531,7 @@ const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){ 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)){ + if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(),MS_MKV_RECORDER_ID)){ core->supported_formats[1]=mkv; } } diff --git a/mediastreamer2 b/mediastreamer2 index a7846bc24..c9c803253 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a7846bc24f3e5bb1cc89faf879f6d64638665585 +Subproject commit c9c8032530fd21361cfbe03953fcb20d002dcad5 From f17e70838e469b2d72bf23defb67c4f9eee7bfe1 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 25 Jun 2014 17:54:00 +0200 Subject: [PATCH 3/4] fix build issue --- coreapi/private.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/private.h b/coreapi/private.h index 1aefc667e..4ae799c93 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -375,8 +375,6 @@ void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); -void linphone_call_stop_audio_stream(LinphoneCall *call); -void linphone_call_stop_video_stream(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); void linphone_call_delete_ice_session(LinphoneCall *call); void linphone_call_delete_upnp_session(LinphoneCall *call); From bcf7e96c24989e4eda894303109dddad730b9ab7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 30 Jun 2014 16:35:23 +0200 Subject: [PATCH 4/4] make video recording working --- coreapi/linphonecall.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a714f88b7..50452ef8e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2237,8 +2237,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut } call->current_params.has_video=FALSE; if (call->videostream!=NULL) { - linphone_call_start_video_stream(call,cname,all_inputs_muted); if (call->audiostream) audio_stream_link_video(call->audiostream,call->videostream); + linphone_call_start_video_stream(call,cname,all_inputs_muted); } call->all_muted=all_inputs_muted; diff --git a/mediastreamer2 b/mediastreamer2 index 964c468de..15387edf6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 964c468de35f6f864967ed23c0d9fc9f5d95b521 +Subproject commit 15387edf656f1ec185ecb22786f2361c6bcb0c86