Commit e10297ba authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added new zoom method on call which doesn't use reference to floats

parent db683ee6
......@@ -272,11 +272,21 @@ LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state (LinphoneCall
* @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.
*
* @deprecated use linphone_call_zoom instead
* cx and cy are updated in return in case their coordinates were too excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.
**/
LINPHONE_PUBLIC void linphone_call_zoom_video (LinphoneCall *call, float zoom_factor, float *cx, float *cy);
/**
* Perform a zoom of the video displayed during a call.
* The zoom ensures that all the screen is fullfilled with the video.
* @param call the 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.
**/
LINPHONE_PUBLIC void linphone_call_zoom (LinphoneCall *call, float zoom_factor, float cx, float cy);
/**
* Send the specified dtmf.
*
......
......@@ -765,6 +765,10 @@ void linphone_call_zoom_video (LinphoneCall* call, float zoom_factor, float* cx,
L_GET_CPP_PTR_FROM_C_OBJECT(call)->zoomVideo(zoom_factor, cx, cy);
}
void linphone_call_zoom (LinphoneCall *call, float zoom_factor, float cx, float cy) {
L_GET_CPP_PTR_FROM_C_OBJECT(call)->zoomVideo(zoom_factor, cx, cy);
}
LinphoneStatus linphone_call_send_dtmf (LinphoneCall *call, char dtmf) {
#if 0
if (!call){
......
......@@ -315,6 +315,10 @@ LinphoneStatus Call::update (const MediaSessionParams *msp) {
}
void Call::zoomVideo (float zoomFactor, float *cx, float *cy) {
zoomVideo(zoomFactor, *cx, *cy);
}
void Call::zoomVideo (float zoomFactor, float cx, float cy) {
L_D();
static_cast<MediaSession *>(d->getActiveSession().get())->zoomVideo(zoomFactor, cx, cy);
}
......
......@@ -64,6 +64,7 @@ public:
LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr);
LinphoneStatus update (const MediaSessionParams *msp = nullptr);
void zoomVideo (float zoomFactor, float *cx, float *cy);
void zoomVideo (float zoomFactor, float cx, float cy);
bool cameraEnabled () const;
bool echoCancellationEnabled () const;
......
......@@ -4381,20 +4381,24 @@ LinphoneStatus MediaSession::takeVideoSnapshot (const string& file) {
}
void MediaSession::zoomVideo (float zoomFactor, float *cx, float *cy) {
zoomVideo(zoomFactor, *cx, *cy);
}
void MediaSession::zoomVideo (float zoomFactor, float cx, float cy) {
L_D();
if (d->videoStream && d->videoStream->output) {
if (zoomFactor < 1)
zoomFactor = 1;
float halfsize = 0.5f * 1.0f / zoomFactor;
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;
float zoom[3] = { zoomFactor, *cx, *cy };
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;
float zoom[3] = { zoomFactor, cx, cy };
ms_filter_call_method(d->videoStream->output, MS_VIDEO_DISPLAY_ZOOM, &zoom);
} else
lWarning() << "Could not apply zoom: video output wasn't activated";
......
......@@ -58,6 +58,7 @@ public:
LinphoneStatus takePreviewSnapshot (const std::string& file);
LinphoneStatus takeVideoSnapshot (const std::string& file);
void zoomVideo (float zoomFactor, float *cx, float *cy);
void zoomVideo (float zoomFactor, float cx, float cy);
bool cameraEnabled () const;
bool echoCancellationEnabled () const;
......
......@@ -231,11 +231,12 @@ eval "$SED_START 's/getCountryName()/getCountry()/g' $SED_END"
eval "$SED_START 's/getMSFactory()/getMediastreamerFactory()/g' $SED_END"
eval "$SED_START 's/accountCreator.getPrefix(/org.linphone.core.Utils::getPrefixFromE164(/g' $SED_END"
eval "$SED_START 's/proxyConfig.lookupCCCFromIso(/org.linphone.core.Utils::getCccFromIso(/g' $SED_END"
eval "$SED_START 's/linkPhoneNumberWithAccount()/linkAccount()/g' $SED_END"
eval "$SED_START 's/zoomVideo(/zoom(/g' $SED_END"
#Changes in library required
#Tunnel
#LinphoneBuffer
#Call.zoomVideo()
#AccountCreator.updatePassword
#Android specifics not wrapped automatically
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment