diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index 117a9f648..0d7340568 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -23,7 +23,7 @@ #import #include "UILinphone.h" #import "UIToggleVideoButton.h" - +#import "VideoZoomHandler.h" @class VideoViewController; @interface IncallViewController : UIViewController { @@ -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; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 130b9dd5b..588b289c5 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -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; diff --git a/Classes/LinphoneUI/VideoZoomHandler.h b/Classes/LinphoneUI/VideoZoomHandler.h new file mode 100644 index 000000000..6065d2453 --- /dev/null +++ b/Classes/LinphoneUI/VideoZoomHandler.h @@ -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 + +@interface VideoZoomHandler : NSObject { + float zoomLevel, cx, cy; + UIView* videoView; +} +-(void) setup: (UIView*) videoView; +-(void) resetZoom; + +@end diff --git a/Classes/LinphoneUI/VideoZoomHandler.m b/Classes/LinphoneUI/VideoZoomHandler.m new file mode 100644 index 000000000..fb238fc69 --- /dev/null +++ b/Classes/LinphoneUI/VideoZoomHandler.m @@ -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 diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index f520e0f6e..1a7baa1bd 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -234,6 +234,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 */; }; @@ -638,6 +640,8 @@ 3418845214C6F66F00EA48C7 /* status_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_red.png; path = Resources/status_red.png; sourceTree = ""; }; 3418845B14C7077400EA48C7 /* status_gray.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_gray.png; path = Resources/status_gray.png; sourceTree = ""; }; 341FCA8D149798210084BC26 /* linphonerc-ipad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linphonerc-ipad"; sourceTree = ""; }; + 34216F3E1547EBCD00EA9777 /* VideoZoomHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoZoomHandler.h; path = LinphoneUI/VideoZoomHandler.h; sourceTree = ""; }; + 34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VideoZoomHandler.m; path = LinphoneUI/VideoZoomHandler.m; sourceTree = ""; }; 3422AA4F14975EC9000D4E8A /* InCallViewController-ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "InCallViewController-ipad.xib"; sourceTree = ""; }; 3422AA5214978352000D4E8A /* PhoneViewController-ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "PhoneViewController-ipad.xib"; sourceTree = ""; }; 344ABD71147FC438007420B6 /* ConferenceCallDetailView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConferenceCallDetailView.xib; sourceTree = ""; }; @@ -830,6 +834,8 @@ 3418844514C6CAD300EA48C7 /* StatusSubViewController.h */, 3418844614C6CAD300EA48C7 /* StatusSubViewController.m */, 3418844714C6CAD300EA48C7 /* StatusSubViewController.xib */, + 34216F3E1547EBCD00EA9777 /* VideoZoomHandler.h */, + 34216F3F1547EBCD00EA9777 /* VideoZoomHandler.m */, ); path = Classes; sourceTree = ""; @@ -1582,6 +1588,7 @@ 34A6ED0614D1440300460C04 /* BuschJaegerAppDelegate.m in Sources */, 34ACD0AC14D80D4100EE0B0A /* UILightButton.m in Sources */, 340751E7150F38FD00B89C47 /* UIToggleVideoButton.m in Sources */, + 34216F401547EBCD00EA9777 /* VideoZoomHandler.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1618,6 +1625,7 @@ 3418844914C6CAD300EA48C7 /* StatusSubViewController.m in Sources */, 34ACD0AD14D80D4100EE0B0A /* UILightButton.m in Sources */, 340751E8150F38FD00B89C47 /* UIToggleVideoButton.m in Sources */, + 34216F411547EBCD00EA9777 /* VideoZoomHandler.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/submodules/externals/libvpx b/submodules/externals/libvpx index c8df1656b..97495c5c5 160000 --- a/submodules/externals/libvpx +++ b/submodules/externals/libvpx @@ -1 +1 @@ -Subproject commit c8df1656bd94928059204242e778bd5b8b9dc7aa +Subproject commit 97495c5c5ced0ab5839a3026e0e528fa22c15d5a