From e5d63effa20da11bb8c341d92f6446b6756fc1b8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 17 Oct 2012 14:35:34 +0200 Subject: [PATCH] document linphone_call_zoom_video and put it in the right place. --- coreapi/linphonecall.c | 35 +++++++++++++++++++++++++++++++++++ coreapi/linphonecore.c | 25 +------------------------ coreapi/linphonecore.h | 3 +-- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a930b1be..32dc9d59 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2092,3 +2092,38 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat bool_t linphone_call_is_in_conference(const LinphoneCall *call) { return call->params.in_conference; } + + +/** + * Perform a zoom of the video displayed during a call. + * @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied. + * @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0. + * @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0. + * + * cx and cy are updated in return in case their coordinates were to excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video. +**/ +void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { + VideoStream* vstream = call->videostream; + if (vstream) { + float zoom[3]; + + if (zoom_factor < 1) + zoom_factor = 1; + float halfsize = 0.5 * 1.0 / zoom_factor; + + if ((*cx - halfsize) < 0) + *cx = 0 + halfsize; + if ((*cx + halfsize) > 1) + *cx = 1 - halfsize; + if ((*cy - halfsize) < 0) + *cy = 0 + halfsize; + if ((*cy + halfsize) > 1) + *cy = 1 - halfsize; + + zoom[0] = zoom_factor; + zoom[1] = *cx; + zoom[2] = *cy; + ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); + }else ms_warning("Could not apply zoom: video output wasn't activated."); +} + diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7159edd6..d96a1905 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5181,30 +5181,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->in_conference=FALSE; } -void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { - VideoStream* vstream = call->videostream; - if (vstream) { - float zoom[3]; - - if (zoom_factor < 1) - zoom_factor = 1; - float halfsize = 0.5 * 1.0 / zoom_factor; - - if ((*cx - halfsize) < 0) - *cx = 0 + halfsize; - if ((*cx + halfsize) > 1) - *cx = 1 - halfsize; - if ((*cy - halfsize) < 0) - *cy = 0 + halfsize; - if ((*cy + halfsize) > 1) - *cy = 1 - halfsize; - - zoom[0] = zoom_factor; - zoom[1] = *cx; - zoom[2] = *cy; - ms_filter_call_method(vstream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom); - }else ms_warning("Could not apply zoom: video output wasn't activated."); -} + void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) { if (lc->device_id) ms_free(lc->device_id); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 1849c083..ad52c559 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -390,6 +390,7 @@ void *linphone_call_get_user_pointer(LinphoneCall *call); void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer); void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data); LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call); +void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy); /** * Return TRUE if this call is currently part of a conference *@param call #LinphoneCall @@ -1428,8 +1429,6 @@ typedef struct LinphoneTunnel LinphoneTunnel; */ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc); -void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy); - void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp); int linphone_core_get_sip_dscp(const LinphoneCore *lc); -- 2.39.2