mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 16:09:20 +00:00
Split zoom handling to a new file
This commit is contained in:
parent
3bf2f14af1
commit
dfaeaba47f
6 changed files with 136 additions and 82 deletions
|
|
@ -23,7 +23,7 @@
|
|||
#import <AddressBookUI/ABPeoplePickerNavigationController.h>
|
||||
#include "UILinphone.h"
|
||||
#import "UIToggleVideoButton.h"
|
||||
|
||||
#import "VideoZoomHandler.h"
|
||||
@class VideoViewController;
|
||||
|
||||
@interface IncallViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate,LinphoneUICallDelegate, UITableViewDelegate, UITableViewDataSource, UIActionSheetCustomDelegate> {
|
||||
|
|
@ -89,9 +89,9 @@
|
|||
UIImage* verified, *unverified;
|
||||
UIImage* stat_sys_signal_0, *stat_sys_signal_1, *stat_sys_signal_2, *stat_sys_signal_3, *stat_sys_signal_4;
|
||||
UIActionSheet* visibleActionSheet;
|
||||
|
||||
|
||||
NSTimer* hideControlsTimer;
|
||||
float zoomLevel, cx, cy;
|
||||
VideoZoomHandler* videoZoomHandler;
|
||||
}
|
||||
|
||||
-(void)displayStatus:(NSString*) message;
|
||||
|
|
|
|||
|
|
@ -242,8 +242,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
|
|||
-(void) enableVideoDisplay {
|
||||
[self orientationChanged:nil];
|
||||
|
||||
zoomLevel = 1;
|
||||
cx = cy = 0.5;
|
||||
[videoZoomHandler resetZoom];
|
||||
|
||||
[UIView beginAnimations:nil context:nil];
|
||||
[UIView setAnimationDuration:1.0];
|
||||
|
|
@ -376,66 +375,6 @@ void addAnimationFadeTransition(UIView* view, float duration) {
|
|||
}
|
||||
}
|
||||
|
||||
-(void) zoomInOut:(UITapGestureRecognizer*) reco {
|
||||
if (zoomLevel != 1)
|
||||
zoomLevel = 1;
|
||||
else
|
||||
zoomLevel = 2;
|
||||
|
||||
if (zoomLevel != 1) {
|
||||
CGPoint point = [reco locationInView:videoGroup];
|
||||
cx = point.x / videoGroup.frame.size.width;
|
||||
cy = 1 - point.y / videoGroup.frame.size.height;
|
||||
} else {
|
||||
cx = cy = 0.5;
|
||||
}
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, cx, cy);
|
||||
}
|
||||
|
||||
-(void) videoPan:(UIPanGestureRecognizer*) reco {
|
||||
if (zoomLevel <= 1.0)
|
||||
return;
|
||||
|
||||
float x,y;
|
||||
CGPoint translation = [reco translationInView:videoGroup];
|
||||
if ([reco state] == UIGestureRecognizerStateEnded) {
|
||||
cx -= translation.x / videoGroup.frame.size.width;
|
||||
cy += translation.y / videoGroup.frame.size.height;
|
||||
x = cx;
|
||||
y = cy;
|
||||
} else if ([reco state] == UIGestureRecognizerStateChanged) {
|
||||
x = cx - translation.x / videoGroup.frame.size.width;
|
||||
y = cy + translation.y / videoGroup.frame.size.height;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, x, y);
|
||||
}
|
||||
|
||||
-(void) pinch:(UIPinchGestureRecognizer*) reco {
|
||||
float s = zoomLevel;
|
||||
// CGPoint point = [reco locationInView:videoGroup];
|
||||
// float ccx = cx + (point.x / videoGroup.frame.size.width - 0.5) / s;
|
||||
// float ccy = cy - (point.y / videoGroup.frame.size.height - 0.5) / s;
|
||||
if ([reco state] == UIGestureRecognizerStateEnded) {
|
||||
zoomLevel = MAX(MIN(zoomLevel * reco.scale, 3.0), 1.0);
|
||||
s = zoomLevel;
|
||||
// cx = ccx;
|
||||
// cy = ccy;
|
||||
} else if ([reco state] == UIGestureRecognizerStateChanged) {
|
||||
s = zoomLevel * reco.scale;
|
||||
s = MAX(MIN(s, 3.0), 1.0);
|
||||
} else if ([reco state] == UIGestureRecognizerStateBegan) {
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), s, cx, cy);
|
||||
}
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
|
@ -483,23 +422,11 @@ void addAnimationFadeTransition(UIView* view, float duration) {
|
|||
UITapGestureRecognizer* singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)];
|
||||
[singleFingerTap setNumberOfTapsRequired:1];
|
||||
[videoGroup addGestureRecognizer:singleFingerTap];
|
||||
|
||||
UITapGestureRecognizer* doubleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomInOut:)];
|
||||
[doubleFingerTap setNumberOfTapsRequired:2];
|
||||
[doubleFingerTap setNumberOfTouchesRequired:1];
|
||||
[videoGroup addGestureRecognizer:doubleFingerTap];
|
||||
|
||||
UIPanGestureRecognizer* pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(videoPan:)];
|
||||
[videoGroup addGestureRecognizer:pan];
|
||||
UIPinchGestureRecognizer* pinchReco = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
|
||||
[videoGroup addGestureRecognizer:pinchReco];
|
||||
videoGroup.alpha = 0;
|
||||
|
||||
[singleFingerTap release];
|
||||
[doubleFingerTap release];
|
||||
[pan release];
|
||||
[pinchReco release];
|
||||
cx = cy = 0.5;
|
||||
|
||||
videoZoomHandler = [[VideoZoomHandler alloc] init];
|
||||
[videoZoomHandler setup:videoGroup];
|
||||
videoGroup.alpha = 0;
|
||||
|
||||
mVideoShown=FALSE;
|
||||
mIncallViewIsReady=FALSE;
|
||||
|
|
|
|||
18
Classes/LinphoneUI/VideoZoomHandler.h
Normal file
18
Classes/LinphoneUI/VideoZoomHandler.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// VideoZoomHandler.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Pierre-Eric Pelloux-Prayer on 25/04/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface VideoZoomHandler : NSObject {
|
||||
float zoomLevel, cx, cy;
|
||||
UIView* videoView;
|
||||
}
|
||||
-(void) setup: (UIView*) videoView;
|
||||
-(void) resetZoom;
|
||||
|
||||
@end
|
||||
101
Classes/LinphoneUI/VideoZoomHandler.m
Normal file
101
Classes/LinphoneUI/VideoZoomHandler.m
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// VideoZoomHandler.m
|
||||
// linphone
|
||||
//
|
||||
// Created by Pierre-Eric Pelloux-Prayer on 25/04/12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "VideoZoomHandler.h"
|
||||
#include "linphonecore.h"
|
||||
#import "LinphoneManager.h"
|
||||
|
||||
@implementation VideoZoomHandler
|
||||
|
||||
|
||||
-(void) zoomInOut:(UITapGestureRecognizer*) reco {
|
||||
if (zoomLevel != 1)
|
||||
zoomLevel = 1;
|
||||
else
|
||||
zoomLevel = 2;
|
||||
|
||||
if (zoomLevel != 1) {
|
||||
CGPoint point = [reco locationInView:videoView];
|
||||
cx = point.x / videoView.frame.size.width;
|
||||
cy = 1 - point.y / videoView.frame.size.height;
|
||||
} else {
|
||||
cx = cy = 0.5;
|
||||
}
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, cx, cy);
|
||||
}
|
||||
|
||||
-(void) videoPan:(UIPanGestureRecognizer*) reco {
|
||||
if (zoomLevel <= 1.0)
|
||||
return;
|
||||
|
||||
float x,y;
|
||||
CGPoint translation = [reco translationInView:videoView];
|
||||
if ([reco state] == UIGestureRecognizerStateEnded) {
|
||||
cx -= translation.x / videoView.frame.size.width;
|
||||
cy += translation.y / videoView.frame.size.height;
|
||||
x = cx;
|
||||
y = cy;
|
||||
} else if ([reco state] == UIGestureRecognizerStateChanged) {
|
||||
x = cx - translation.x / videoView.frame.size.width;
|
||||
y = cy + translation.y / videoView.frame.size.height;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, x, y);
|
||||
}
|
||||
|
||||
-(void) pinch:(UIPinchGestureRecognizer*) reco {
|
||||
float s = zoomLevel;
|
||||
// CGPoint point = [reco locationInView:videoGroup];
|
||||
// float ccx = cx + (point.x / videoGroup.frame.size.width - 0.5) / s;
|
||||
// float ccy = cy - (point.y / videoGroup.frame.size.height - 0.5) / s;
|
||||
if ([reco state] == UIGestureRecognizerStateEnded) {
|
||||
zoomLevel = MAX(MIN(zoomLevel * reco.scale, 3.0), 1.0);
|
||||
s = zoomLevel;
|
||||
// cx = ccx;
|
||||
// cy = ccy;
|
||||
} else if ([reco state] == UIGestureRecognizerStateChanged) {
|
||||
s = zoomLevel * reco.scale;
|
||||
s = MAX(MIN(s, 3.0), 1.0);
|
||||
} else if ([reco state] == UIGestureRecognizerStateBegan) {
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), s, cx, cy);
|
||||
}
|
||||
|
||||
-(void) resetZoom {
|
||||
zoomLevel = 1;
|
||||
cx = cy = 0.5;
|
||||
}
|
||||
|
||||
|
||||
-(void) setup: (UIView*) view {
|
||||
videoView = view;
|
||||
|
||||
UITapGestureRecognizer* doubleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomInOut:)];
|
||||
[doubleFingerTap setNumberOfTapsRequired:2];
|
||||
[doubleFingerTap setNumberOfTouchesRequired:1];
|
||||
[videoView addGestureRecognizer:doubleFingerTap];
|
||||
|
||||
UIPanGestureRecognizer* pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(videoPan:)];
|
||||
[videoView addGestureRecognizer:pan];
|
||||
UIPinchGestureRecognizer* pinchReco = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
|
||||
[videoView addGestureRecognizer:pinchReco];
|
||||
|
||||
[doubleFingerTap release];
|
||||
[pan release];
|
||||
[pinchReco release];
|
||||
|
||||
[self resetZoom];
|
||||
}
|
||||
@end
|
||||
|
|
@ -238,6 +238,8 @@
|
|||
3418845D14C7077400EA48C7 /* status_gray.png in Resources */ = {isa = PBXBuildFile; fileRef = 3418845B14C7077400EA48C7 /* status_gray.png */; };
|
||||
341FCA8E149798210084BC26 /* linphonerc-ipad in Resources */ = {isa = PBXBuildFile; fileRef = 341FCA8D149798210084BC26 /* linphonerc-ipad */; };
|
||||
341FCA8F149798210084BC26 /* linphonerc-ipad in Resources */ = {isa = PBXBuildFile; fileRef = 341FCA8D149798210084BC26 /* linphonerc-ipad */; };
|
||||
34216F401547EBCD00EA9777 /* VideoZoomHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */; };
|
||||
34216F411547EBCD00EA9777 /* VideoZoomHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */; };
|
||||
3422AA5014975EC9000D4E8A /* InCallViewController-ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3422AA4F14975EC9000D4E8A /* InCallViewController-ipad.xib */; };
|
||||
3422AA5114975EC9000D4E8A /* InCallViewController-ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3422AA4F14975EC9000D4E8A /* InCallViewController-ipad.xib */; };
|
||||
3422AA5314978352000D4E8A /* PhoneViewController-ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3422AA5214978352000D4E8A /* PhoneViewController-ipad.xib */; };
|
||||
|
|
@ -628,6 +630,8 @@
|
|||
3418845214C6F66F00EA48C7 /* status_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_red.png; path = Resources/status_red.png; sourceTree = "<group>"; };
|
||||
3418845B14C7077400EA48C7 /* status_gray.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_gray.png; path = Resources/status_gray.png; sourceTree = "<group>"; };
|
||||
341FCA8D149798210084BC26 /* linphonerc-ipad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linphonerc-ipad"; sourceTree = "<group>"; };
|
||||
34216F3E1547EBCD00EA9777 /* VideoZoomHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoZoomHandler.h; path = LinphoneUI/VideoZoomHandler.h; sourceTree = "<group>"; };
|
||||
34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VideoZoomHandler.m; path = LinphoneUI/VideoZoomHandler.m; sourceTree = "<group>"; };
|
||||
3422AA4F14975EC9000D4E8A /* InCallViewController-ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "InCallViewController-ipad.xib"; sourceTree = "<group>"; };
|
||||
3422AA5214978352000D4E8A /* PhoneViewController-ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "PhoneViewController-ipad.xib"; sourceTree = "<group>"; };
|
||||
344ABD71147FC438007420B6 /* ConferenceCallDetailView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConferenceCallDetailView.xib; sourceTree = "<group>"; };
|
||||
|
|
@ -801,6 +805,8 @@
|
|||
3418844514C6CAD300EA48C7 /* StatusSubViewController.h */,
|
||||
3418844614C6CAD300EA48C7 /* StatusSubViewController.m */,
|
||||
3418844714C6CAD300EA48C7 /* StatusSubViewController.xib */,
|
||||
34216F3E1547EBCD00EA9777 /* VideoZoomHandler.h */,
|
||||
34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */,
|
||||
);
|
||||
path = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -1511,6 +1517,7 @@
|
|||
34CA8539148F692A00503C01 /* MainScreenWithVideoPreview.m in Sources */,
|
||||
3418844814C6CAD300EA48C7 /* StatusSubViewController.m in Sources */,
|
||||
340751E7150F38FD00B89C47 /* UIToggleVideoButton.m in Sources */,
|
||||
34216F401547EBCD00EA9777 /* VideoZoomHandler.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -1546,6 +1553,7 @@
|
|||
34CA853A148F692A00503C01 /* MainScreenWithVideoPreview.m in Sources */,
|
||||
3418844914C6CAD300EA48C7 /* StatusSubViewController.m in Sources */,
|
||||
340751E8150F38FD00B89C47 /* UIToggleVideoButton.m in Sources */,
|
||||
34216F411547EBCD00EA9777 /* VideoZoomHandler.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
2
submodules/externals/libvpx
vendored
2
submodules/externals/libvpx
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit c8df1656bd94928059204242e778bd5b8b9dc7aa
|
||||
Subproject commit 97495c5c5ced0ab5839a3026e0e528fa22c15d5a
|
||||
Loading…
Add table
Reference in a new issue