From 7e2ea826339cbc75e8089c31ebdcbb9038805069 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 25 Sep 2010 22:06:19 +0200 Subject: [PATCH] work in progress for dynamic video enablement (2) --- coreapi/linphonecall.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 03ee842dc..acc18bfe2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -31,6 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/msvolume.h" #include "mediastreamer2/msequalizer.h" +static MSWebCam *get_nowebcam_device(){ + return ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture"); +} static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, bool_t only_one_codec){ @@ -440,6 +443,14 @@ int linphone_call_get_duration(const LinphoneCall *call){ * Indicate whether camera input should be sent to remote end. **/ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){ + if (call->videostream!=NULL && call->videostream->ticker!=NULL){ + LinphoneCore *lc=call->core; + MSWebCam *nowebcam=get_nowebcam_device(); + if (call->camera_active!=enable && lc->video_conf.device!=nowebcam){ + video_stream_change_camera(call->videostream, + enable ? lc->video_conf.device : nowebcam); + } + } call->camera_active=enable; } @@ -753,7 +764,7 @@ void linphone_call_start_media_streams(LinphoneCall *call){ video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); if (stream->dir==SalStreamSendOnly && lc->video_conf.capture ){ - cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture"); + cam=get_nowebcam_device(); dir=VideoStreamSendOnly; }else if (stream->dir==SalStreamRecvOnly && lc->video_conf.display ){ dir=VideoStreamRecvOnly; @@ -769,6 +780,9 @@ void linphone_call_start_media_streams(LinphoneCall *call){ /*either inactive or incompatible with local capabilities*/ is_inactive=TRUE; } + if (call->camera_active==FALSE){ + cam=get_nowebcam_device(); + } if (!is_inactive){ video_stream_set_direction (call->videostream, dir); video_stream_start(call->videostream,