From ecf4ba1b5cb669d419d776d2cb7b8e511d194346 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 2 Feb 2015 14:25:57 +0100 Subject: [PATCH] Enable setting a different video window id for each call. --- coreapi/linphonecall.c | 25 ++++++++++++++++++++++++- coreapi/linphonecore.h | 13 +++++++++++++ coreapi/private.h | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5b2ffe19e..e6dc3cb56 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2394,7 +2394,9 @@ static void linphone_call_start_video_stream(LinphoneCall *call, bool_t all_inpu video_stream_set_fps(call->videostream,linphone_core_get_preferred_framerate(lc)); video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); - if (lc->video_window_id!=0) + if (call->video_window_id != 0) + video_stream_set_native_window_id(call->videostream,call->video_window_id); + else if (lc->video_window_id!=0) video_stream_set_native_window_id(call->videostream,lc->video_window_id); if (lc->preview_window_id!=0) video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id); @@ -3596,3 +3598,24 @@ void linphone_call_cancel_dtmfs(LinphoneCall *call) { call->dtmf_sequence = NULL; } } + +unsigned long linphone_call_get_native_video_window_id(const LinphoneCall *call) { + if (call->video_window_id) { + /* The video id was previously set by the app. */ + return call->video_window_id; + } +#ifdef VIDEO_ENABLED + else if (call->videostream) { + /* It was not set but we want to get the one automatically created by mediastreamer2 (desktop versions only). */ + return video_stream_get_native_window_id(call->videostream); + } +#endif + return 0; +} + +void linphone_call_set_native_video_window_id(LinphoneCall *call, unsigned long id) { + call->video_window_id = id; + if (call->videostream) { + video_stream_set_native_window_id(call->videostream, id); + } +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 8297eb61e..6997c3470 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -757,6 +757,19 @@ LINPHONE_PUBLIC int linphone_call_send_dtmfs(LinphoneCall *call,char *dtmfs); **/ LINPHONE_PUBLIC void linphone_call_cancel_dtmfs(LinphoneCall *call); +/** + * Get the native window handle of the video window, casted as an unsigned long. + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC unsigned long linphone_call_get_native_video_window_id(const LinphoneCall *call); + +/** + * Set the native video window id where the video is to be displayed. + * For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given. + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, unsigned long id); + /** * Return TRUE if this call is currently part of a conference * @param call #LinphoneCall diff --git a/coreapi/private.h b/coreapi/private.h index 8778f1020..13bc91456 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -226,7 +226,7 @@ struct _LinphoneCall{ StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/ struct _AudioStream *audiostream; /**/ struct _VideoStream *videostream; - + unsigned long video_window_id; MSAudioEndpoint *endpoint; /*used for conferencing*/ char *refer_to; LinphoneCallParams *params;