From 9a55ff10f0a4693a38220e36793fb903ab3a35cd Mon Sep 17 00:00:00 2001 From: Tony Bussieres Date: Sat, 26 Oct 2013 22:56:36 -0400 Subject: [PATCH] - Added a public call (linphone_core_set_play_file_with_cb), so that the linphone API user can receive a callback when the file played is completed. - Moved two variable declaration so that when you compile with --enable-video=no, the compilation doesn't fail because of unused variable --- coreapi/linphonecore.c | 18 ++++++++++++++---- coreapi/linphonecore.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 94a242a..587ee04 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4907,14 +4907,14 @@ unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){ /* unsets the video id for all calls (indeed it may be kept by filters or videostream object itself by paused calls)*/ static void unset_video_window_id(LinphoneCore *lc, bool_t preview, unsigned long id){ - LinphoneCall *call; - MSList *elem; if (id!=0 && id!=-1) { ms_error("Invalid use of unset_video_window_id()"); return; } #ifdef VIDEO_ENABLED + MSList *elem; + LinphoneCall *call; for(elem=lc->calls;elem!=NULL;elem=elem->next){ call=(LinphoneCall *) elem->data; if (call->videostream){ @@ -5160,7 +5160,7 @@ void linphone_core_use_files(LinphoneCore *lc, bool_t yesno){ * * The file must be a 16 bit linear wav file. **/ -void linphone_core_set_play_file(LinphoneCore *lc, const char *file){ +void linphone_core_set_play_file_with_cb(LinphoneCore *lc, const char *file,MSFilterNotifyFunc cb){ LinphoneCall *call=linphone_core_get_current_call(lc); if (lc->play_file!=NULL){ ms_free(lc->play_file); @@ -5168,9 +5168,19 @@ void linphone_core_set_play_file(LinphoneCore *lc, const char *file){ } if (file!=NULL) { lc->play_file=ms_strdup(file); - if (call && call->audiostream && call->audiostream->ms.ticker) + if (call && call->audiostream && call->audiostream->ms.ticker) { audio_stream_play(call->audiostream,file); + if (cb != NULL) + ms_filter_set_notify_callback(call->audiostream->soundread,cb,NULL); + + + } } + +} + +void linphone_core_set_play_file(LinphoneCore *lc, const char *file){ + linphone_core_set_play_file_with_cb(lc,file,NULL); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index dbf3779..928d924 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1921,6 +1921,7 @@ void linphone_core_show_video(LinphoneCore *lc, bool_t show); /*play/record support: use files instead of soundcard*/ void linphone_core_use_files(LinphoneCore *lc, bool_t yesno); LINPHONE_PUBLIC void linphone_core_set_play_file(LinphoneCore *lc, const char *file); +LINPHONE_PUBLIC void linphone_core_set_play_file_with_cb(LinphoneCore *lc, const char *file, MSFilterNotifyFunc cb); void linphone_core_set_record_file(LinphoneCore *lc, const char *file); LINPHONE_PUBLIC void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms); -- 1.8.1.2