From 213a7e39a2ebcd333dc17beece46ad6176e8d92f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 11 Oct 2010 12:11:01 +0200 Subject: [PATCH] use 2 video windows, work in progress --- coreapi/linphonecall.c | 7 ++++++- coreapi/linphonecore.c | 44 +++++++++++++++++++++++++++++++++++++++++- coreapi/linphonecore.h | 5 +++++ coreapi/private.h | 3 +++ mediastreamer2 | 2 +- 5 files changed, 58 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 62d4fa6c2..8139bbdb2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -824,7 +824,12 @@ static void _linphone_call_start_media_streams(LinphoneCall *call, bool_t send_e 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) + 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); + video_stream_use_preview_video_window (call->videostream,lc->use_preview_window); + if (stream->dir==SalStreamSendOnly && lc->video_conf.capture ){ cam=get_nowebcam_device(); dir=VideoStreamSendOnly; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5339e4b3b..4a937538e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3269,7 +3269,49 @@ unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){ if (lc->previewstream) return video_stream_get_native_window_id(lc->previewstream); #endif - return 0; + return lc->video_window_id; +} + +/** + * Set the native video window id where the video is to be displayed. + * If not set the core will create its own window. +**/ +void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id){ + lc->video_window_id=id; +} + +/** + * Returns the native window handle of the video preview window, casted as an unsigned long. + * + * @ingroup media_parameters +**/ +unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc){ +#ifdef VIDEO_ENABLED + LinphoneCall *call=linphone_core_get_current_call (lc); + if (call && call->videostream) + return video_stream_get_native_preview_window_id(call->videostream); + if (lc->previewstream) + return video_stream_get_native_preview_window_id(lc->previewstream); +#endif + return lc->preview_window_id; +} + +/** + * Set the native window id where the preview video (local camera) is to be displayed. + * This has to be used in conjonction with linphone_core_use_preview_window(). + * If not set the core will create its own window. +**/ +void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){ + lc->preview_window_id=id; +} + +/** + * Tells the core to use a separate window for local camera preview video, instead of + * inserting local view within the remote video window. + * +**/ +void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno){ + lc->use_preview_window=yesno; } static MSVideoSizeDef supported_resolutions[]={ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 6dd4acc36..dfe227874 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -964,7 +964,12 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc); /*function to be used for eventually setting window decorations (icons, title...)*/ unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc); +void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id); +unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc); +void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id); + +void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno); /*play/record support: use files instead of soundcard*/ void linphone_core_use_files(LinphoneCore *lc, bool_t yesno); diff --git a/coreapi/private.h b/coreapi/private.h index b0c95485e..a1a0f2fd7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -408,6 +408,8 @@ struct _LinphoneCore int audio_bw; LinphoneWaitingCallback wait_cb; void *wait_ctx; + unsigned long video_window_id; + unsigned long preview_window_id; bool_t use_files; bool_t apply_nat_settings; bool_t ready; @@ -415,6 +417,7 @@ struct _LinphoneCore bool_t preview_finished; bool_t auto_net_state_mon; bool_t network_reachable; + bool_t use_preview_window; }; bool_t linphone_core_can_we_add_call(LinphoneCore *lc); diff --git a/mediastreamer2 b/mediastreamer2 index 20da8f413..8868e7ce0 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 20da8f413994f0959ab81b391894defa70eaa1f6 +Subproject commit 8868e7ce004ba99afd20ff21cd0c7ef25ffbef06