|
@@ -9,7 +9,6 @@
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
#import "Masonry.h"
|
|
|
#import "CameraManager.h"
|
|
|
-#import "AVCapturePhotoOutput+VersionAdaptor.h"
|
|
|
#import "PCSRoundButton.h"
|
|
|
#import "PCSModeList.h"
|
|
|
#import "UIImage+ext.h"
|
|
@@ -32,7 +31,6 @@
|
|
|
#import "Renderer.h"
|
|
|
#import "CameraTextureRenderPass.h"
|
|
|
#import "LenzSDKConstant.h"
|
|
|
-#import "TensorFlowWrapper.h"
|
|
|
#import "DBManager.h"
|
|
|
#import <Photos/Photos.h>
|
|
|
#import "BaseViewTapGestureDelegate.h"
|
|
@@ -294,15 +292,12 @@
|
|
|
PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
|
|
|
strongSelf.mode = mode;
|
|
|
|
|
|
-// self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
self.ai_fullView.hidden = YES;
|
|
|
[strongSelf modeDidChange:newMode oldIndex:oldMode];
|
|
|
[strongSelf updateCaptureSessionWith:oldMode];
|
|
|
if([oldModelNode respondsToSelector:@selector(didQuit)]){
|
|
|
[oldModelNode didQuit];
|
|
|
}
|
|
|
-
|
|
|
-// [alertController dismissViewControllerAnimated:NO completion:^{}];
|
|
|
// }];
|
|
|
|
|
|
return NO;
|
|
@@ -314,8 +309,6 @@
|
|
|
id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
|
|
|
PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
|
|
|
strongSelf.mode = mode;
|
|
|
-
|
|
|
-// self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
self.ai_fullView.hidden = YES;
|
|
|
[strongSelf modeDidChange:newMode oldIndex:oldMode];
|
|
|
[strongSelf updateCaptureSessionWith:oldMode];
|
|
@@ -361,15 +354,7 @@
|
|
|
|
|
|
self.savePhotoButton.titleLabel.textColor = [UIColor whiteColor];
|
|
|
self.discardPhotoButton.titleLabel.textColor = [UIColor whiteColor];
|
|
|
-
|
|
|
-
|
|
|
-// [self.takePhotoButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.centerX.equalTo(self.view);
|
|
|
-// make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
|
|
|
-// }];
|
|
|
-
|
|
|
[self updateUIByMode];
|
|
|
-
|
|
|
self.panoramOrientationGuideView.delegate = self;
|
|
|
|
|
|
|
|
@@ -381,19 +366,14 @@
|
|
|
[self.ablumImageView addGestureRecognizer:tap];
|
|
|
self.ablumImageView.userInteractionEnabled = YES;
|
|
|
self.ablumImageView.hidden = YES;
|
|
|
-// self.ablumImageView.backgroundColor = [UIColor redColor];
|
|
|
self.ablumImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
[self.ablumImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.centerY.mas_equalTo(self.takePhotoButton);
|
|
|
make.left.mas_equalTo(20);
|
|
|
make.width.height.mas_equalTo(60);
|
|
|
-// make.top.left.mas_equalTo(50);
|
|
|
-// make.width.height.mas_equalTo(300);
|
|
|
}];
|
|
|
-
|
|
|
|
|
|
UILongPressGestureRecognizer *ges = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressGes:)];
|
|
|
-// ges.numberOfTapsRequired = 1;
|
|
|
ges.minimumPressDuration = 1;
|
|
|
[self.takePhotoButton addGestureRecognizer:ges];
|
|
|
|
|
@@ -720,7 +700,7 @@
|
|
|
item.limitRecordTime = [recTime integerValue];
|
|
|
}
|
|
|
|
|
|
- item.keyFrame = dict[@"keyframe"];
|
|
|
+ item.keyFrame = @(1);
|
|
|
item.isRemake = [dict[@"isRemake"] boolValue];
|
|
|
NSNumber *quantity = dict[@"quantity"];
|
|
|
if (quantity) {
|
|
@@ -808,9 +788,6 @@
|
|
|
_captureSession.sessionPreset = AVCaptureSessionPresetInputPriority;
|
|
|
|
|
|
_movieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
|
|
|
-// _movieFileOutput.maxRecordedDuration = CMTimeMake(self.parameters.limitRecordTime, 1);
|
|
|
-
|
|
|
- // setup video data output for panoramic
|
|
|
_videoDataQueue = dispatch_queue_create("video data", DISPATCH_QUEUE_SERIAL);
|
|
|
_videoDataOutput = [[AVCaptureVideoDataOutput alloc] init];
|
|
|
_videoDataOutput.alwaysDiscardsLateVideoFrames = YES;
|
|
@@ -898,14 +875,11 @@
|
|
|
LenVideoStitchDirction dir = (LenVideoStitchDirction)wearSelf.panoramOrientationGuideView.selectedItemIndex;
|
|
|
if (dir == LenVideoStitchDirctionLeft || dir == LenVideoStitchDirctionRight) {
|
|
|
if (fabs(x) < 3) {
|
|
|
-// NSLog(@"~~~~~~~~~~水平");
|
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirCenter dir:dir];
|
|
|
} else {
|
|
|
if (x > 0) {
|
|
|
-// NSLog(@"~~~~~~~~~~向下");
|
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirDown dir:dir];
|
|
|
} else {
|
|
|
-// NSLog(@"~~~~~~~~~~向上");
|
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirUp dir:dir];
|
|
|
}
|
|
|
}
|
|
@@ -1045,7 +1019,6 @@
|
|
|
connection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeAuto;
|
|
|
}
|
|
|
if(connection == nil){
|
|
|
-// [self showAlertForAuthorization];
|
|
|
return;
|
|
|
}
|
|
|
if (connection.supportsVideoOrientation) {
|
|
@@ -1059,7 +1032,6 @@
|
|
|
if ([self.photoOutput.availablePhotoCodecTypes containsObject:AVVideoCodecTypeJPEG]) {
|
|
|
NSDictionary *format = @{AVVideoCodecKey: AVVideoCodecTypeJPEG};
|
|
|
photoSettings = [AVCapturePhotoSettings photoSettingsWithFormat:format];
|
|
|
-// NSLog(@"-----:%ld",(long)self.currentCameraInput.device.position);
|
|
|
if (self.currentCameraInput.device.position == SDK_CAMERA_PISITION_BACK) {
|
|
|
photoSettings.flashMode = self.outputSettings.flashMode;
|
|
|
|
|
@@ -1079,13 +1051,8 @@
|
|
|
|
|
|
#pragma mark - Notification
|
|
|
- (void)orientationWillChange: (NSNotification*)noti{
|
|
|
- NSLog(@"orientationWillChange");
|
|
|
}
|
|
|
- (void)willEnterForeground: (NSNotification*)noti{
|
|
|
-// if(self.broken){
|
|
|
-// [self.player play];
|
|
|
-// self.broken = NO;
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
//UIBackgroundTaskIdentifier _bgTaskToken;
|
|
@@ -1100,7 +1067,6 @@
|
|
|
}
|
|
|
|
|
|
- (void)orientationDidChange: (NSNotification*)noti{
|
|
|
- NSLog(@"orientationDidChange");
|
|
|
if([self.currentOperationNode respondsToSelector:@selector(stop)])
|
|
|
[self.currentOperationNode stop];
|
|
|
}
|
|
@@ -1110,16 +1076,12 @@
|
|
|
[QuitMultipleModeAlertViewController show:self title:@"" text:text leftBtnTitle:@"取消" rightBtnTitle:@"确认" withLeftButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
|
|
|
[alertController dismissViewControllerAnimated:YES completion:^{
|
|
|
-// [self dismissViewControllerAnimated:YES completion:^{
|
|
|
-//
|
|
|
-// }];
|
|
|
}];
|
|
|
} rightButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
[alertController dismissViewControllerAnimated:YES completion:^{
|
|
|
NSURL* url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
|
|
if(url != nil){
|
|
|
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
|
|
|
-// NSLog(succ)
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -1173,8 +1135,6 @@
|
|
|
case AVAuthorizationStatusDenied:{
|
|
|
[self.authView showAutherWith:PCSAuthPhone];
|
|
|
self.panGesture.enabled = NO;
|
|
|
-
|
|
|
-// [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
showAlert = YES;
|
|
|
break;
|
|
|
}
|
|
@@ -1193,7 +1153,6 @@
|
|
|
case AVAuthorizationStatusDenied:{
|
|
|
[self.authView showAutherWith:PCSAuthMir];
|
|
|
self.panGesture.enabled = NO;
|
|
|
-// [self showAlertForAuthorizationWithText:@"请在系统设置里打开麦克风访问权限后重试"];
|
|
|
showAlert = YES;
|
|
|
break;
|
|
|
}
|
|
@@ -1246,7 +1205,6 @@
|
|
|
connection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeAuto;
|
|
|
}
|
|
|
if(connection == nil){
|
|
|
-// [self showAlertForAuthorization];
|
|
|
return NO;
|
|
|
}
|
|
|
|
|
@@ -1326,7 +1284,6 @@
|
|
|
connection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeAuto;
|
|
|
}
|
|
|
if(connection == nil){
|
|
|
-// [self showAlertForAuthorization];
|
|
|
return;
|
|
|
}
|
|
|
[connection setVideoOrientation:orientation];
|
|
@@ -1376,19 +1333,15 @@
|
|
|
self.panoramaGuideView.hidden = YES;
|
|
|
} else {
|
|
|
self.panoramOrientationGuideView.hidden = isSaveIng;
|
|
|
-// self.ai_fullView.hidden = isSaveIng;
|
|
|
self.ai_fullView.hidden = YES;
|
|
|
self.panoramaGuideView.hidden = isSaveIng;
|
|
|
}
|
|
|
self.modeList.hidden = isSaveIng;
|
|
|
self.savePhotoButton.hidden = isSaveIng;
|
|
|
self.takePhotoButton.hidden = isSaveIng;
|
|
|
-// self.switchButton.hidden = isSaveIng;
|
|
|
self.discardPhotoButton.hidden = isSaveIng;
|
|
|
self.backButton.hidden = !isSaveIng;
|
|
|
self.ablumImageView.hidden = isSaveIng;
|
|
|
-// self.timerLabel.hidden = isSaveIng;
|
|
|
-
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -1396,9 +1349,7 @@
|
|
|
- (void)updateViewStatusWhenStitchFail {
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
self.stitchView.hidden = YES;
|
|
|
-
|
|
|
self.flashButton.hidden = NO;
|
|
|
-
|
|
|
self.modeList.hidden = NO;
|
|
|
self.savePhotoButton.hidden = NO;
|
|
|
self.takePhotoButton.hidden = NO;
|
|
@@ -1407,19 +1358,14 @@
|
|
|
self.panoramOrientationGuideView.hidden = YES;
|
|
|
self.panoramaGuideView.hidden = YES;
|
|
|
} else {
|
|
|
-// self.ai_fullView.hidden = NO;
|
|
|
self.ai_fullView.hidden = YES;
|
|
|
self.panoramOrientationGuideView.hidden = NO;
|
|
|
self.panoramaGuideView.hidden = NO;
|
|
|
}
|
|
|
-// self.switchButton.hidden = isSaveIng;
|
|
|
self.discardPhotoButton.hidden = NO;
|
|
|
self.backButton.hidden = YES;
|
|
|
self.ablumImageView.hidden = NO;
|
|
|
[self.takePhotoButton setImage:[UIImage loadNamed:@"take-photo-btn"] forState:UIControlStateNormal];
|
|
|
-
|
|
|
-// self.timerLabel.hidden = isSaveIng;
|
|
|
-
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1439,7 +1385,6 @@
|
|
|
[[NSFileManager defaultManager] removeItemAtURL:tmpMovieFileUrl error:nil];
|
|
|
self.videoWriter = [[AVAssetWriter alloc] initWithURL:tmpMovieFileUrl fileType:AVFileTypeQuickTimeMovie error:&err];
|
|
|
if(err != nil){
|
|
|
- NSLog(@"%@", err);
|
|
|
self.videoWriter = nil;
|
|
|
return NO;
|
|
|
}
|
|
@@ -1578,17 +1523,8 @@
|
|
|
self.albumButton.hidden = YES;
|
|
|
self.numberOfImagesLabel.hidden = YES;
|
|
|
self.modeLabel.text = self.currentOperationNode.modeTitleString;
|
|
|
-// self.ai_fullView.hidden = !(self.mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
self.ai_fullView.hidden = YES;
|
|
|
self.panGesture.enabled = YES;
|
|
|
-
|
|
|
-// self.controller.savePhotoButton.hidden = !self.hasCache;
|
|
|
-// self.controller.discardPhotoButton.hidden = !self.hasCache;
|
|
|
-//
|
|
|
-// self.controller.albumButton.hidden = !self.hasCache;
|
|
|
-// self.controller.backButton.hidden = self.hasCache;
|
|
|
-
|
|
|
-
|
|
|
if([self.currentOperationNode respondsToSelector:@selector(updateUI)]){
|
|
|
[self.currentOperationNode updateUI];
|
|
|
}
|
|
@@ -1661,48 +1597,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- (void)modeDidChange: (NSUInteger)newIndex oldIndex: (NSUInteger)oldIndex{
|
|
|
|
|
|
if(newIndex >= INT_MAX){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-// self.modeList.userInteractionEnabled = NO;
|
|
|
-// [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]
|
|
|
if(self.effectView.superview != nil){
|
|
|
-// self.effectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
self.effectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
|
|
}];
|
|
|
}
|
|
|
-// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
- if(newIndex != SDK_CAPTURE_MODE_MOVIE){
|
|
|
- [[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
- if (obj.model == self.mode) {
|
|
|
- [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionBack with:obj.resolution.height];
|
|
|
- [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionFront with:obj.resolution.height];
|
|
|
- }
|
|
|
- }];
|
|
|
-
|
|
|
- }
|
|
|
- else{
|
|
|
- [[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
- if (obj.model == self.mode) {
|
|
|
- [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionBack with:obj.videoResolution.height];
|
|
|
- [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionFront with:obj.videoResolution.height];
|
|
|
- }
|
|
|
- }];
|
|
|
-
|
|
|
- }
|
|
|
+ if(newIndex != SDK_CAPTURE_MODE_MOVIE){
|
|
|
+ [[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.model == self.mode) {
|
|
|
+ [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionBack with:obj.resolution.height];
|
|
|
+ [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionFront with:obj.resolution.height];
|
|
|
+ }
|
|
|
+ }];
|
|
|
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.model == self.mode) {
|
|
|
+ [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionBack with:obj.videoResolution.height];
|
|
|
+ [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionFront with:obj.videoResolution.height];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
-// dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
-// self.modeList.userInteractionEnabled = YES;
|
|
|
- self.effectView.effect = nil;
|
|
|
-// });
|
|
|
-// });
|
|
|
+ self.effectView.effect = nil;
|
|
|
[self updateUIByMode];
|
|
|
[self switchDevicePositionBack];
|
|
|
[self updateNumberLabel];
|
|
@@ -1758,11 +1683,7 @@
|
|
|
|
|
|
#pragma mark 方向调用的代理
|
|
|
- (void)panoramaOrientationViewslt:(PanoramaOrientationViewDirectionEnum)direction{
|
|
|
-// NSLog(@"方向%ld",direction);
|
|
|
self.panoramaGuideView.hidden = NO;
|
|
|
-// self.ai_fullView.hidden = NO;
|
|
|
-
|
|
|
-// [LenStitcher videoResetPath];
|
|
|
[UIView animateWithDuration:0.25 animations:^{
|
|
|
[self.panoramaGuideView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
switch (direction) {
|
|
@@ -1785,8 +1706,6 @@
|
|
|
break;
|
|
|
case PanoramaOrientationViewAny: {
|
|
|
self.panoramaGuideView.hidden = YES;
|
|
|
-// self.ai_fullView.hidden = YES;
|
|
|
-
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -1874,7 +1793,6 @@
|
|
|
NSError *err = nil;
|
|
|
AVCaptureDeviceInput *newVideoInput = [[AVCaptureDeviceInput alloc] initWithDevice:newCamera error:&err];
|
|
|
if(newVideoInput == nil || err != nil){
|
|
|
- NSLog(@"Error creating capture device input: %@", err.localizedDescription);
|
|
|
}
|
|
|
else if([self.captureSession canAddInput:newVideoInput]){
|
|
|
[self.captureSession addInput:newVideoInput];
|
|
@@ -1914,7 +1832,6 @@
|
|
|
NSError *err = nil;
|
|
|
AVCaptureDeviceInput *newVideoInput = [[AVCaptureDeviceInput alloc] initWithDevice:newCamera error:&err];
|
|
|
if(newVideoInput == nil || err != nil){
|
|
|
- NSLog(@"Error creating capture device input: %@", err.localizedDescription);
|
|
|
} else if([self.captureSession canAddInput:newVideoInput]){
|
|
|
[self.captureSession addInput:newVideoInput];
|
|
|
}
|
|
@@ -1981,13 +1898,12 @@
|
|
|
|
|
|
OperationNodeAIPanorama *aiPan = nil;
|
|
|
if ([self.currentOperationNode isKindOfClass:[OperationNodeAIPanorama class]]) {
|
|
|
-// self.videoStitchSemaphore = dispatch_semaphore_create(1);
|
|
|
[LenStitcher videoResetPath];
|
|
|
LenzResourceItemModel *itemModel = [[LenzResourceItemModel alloc]init];
|
|
|
+ itemModel.isStitch = YES;
|
|
|
[self.resourceModel.aiPanoramArray addObject:itemModel];
|
|
|
[self startMotion];
|
|
|
aiPan = self.currentOperationNode;
|
|
|
-// self.touchTime = 0;
|
|
|
aiPan.AIType = OperationAITypeLongPress;
|
|
|
[self.currentOperationNode takePhotoButtonTouched];
|
|
|
}
|
|
@@ -2042,7 +1958,6 @@
|
|
|
} rightButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
[self updateViewStatusWhenStitchSave:NO];
|
|
|
[alertController dismissViewControllerAnimated:NO completion:^{
|
|
|
-// [self dismissViewControllerAnimated:YES completion:^{}];
|
|
|
}];
|
|
|
}];
|
|
|
} else {
|
|
@@ -2099,7 +2014,7 @@
|
|
|
idIndex += idx;
|
|
|
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
|
dict[@"id"] = [NSString stringWithFormat:@"%ld", idIndex];
|
|
|
- dict[@"path"] = obj.path;
|
|
|
+ dict[@"mosaicPictureUrl"] = obj.path;
|
|
|
dict[@"cameraMode"] = obj.cameraMode;
|
|
|
dict[@"cameraType"] = obj.cameraType;
|
|
|
dict[@"isRemake"] = @(obj.isRemake);
|
|
@@ -2116,15 +2031,19 @@
|
|
|
idIndex += idx;
|
|
|
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
|
dict[@"id"] = [NSString stringWithFormat:@"%ld", idIndex];
|
|
|
- dict[@"path"] = obj.path;
|
|
|
dict[@"cameraMode"] = obj.cameraMode;
|
|
|
dict[@"cameraType"] = obj.cameraType;
|
|
|
dict[@"isRemake"] = @(obj.isRemake);
|
|
|
- NSMutableArray *keyFrame = [NSMutableArray array];
|
|
|
- [obj.keyFrame enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
- [keyFrame addObject:obj];
|
|
|
- }];
|
|
|
- dict[@"keyFrame"] = keyFrame;
|
|
|
+ if (obj.isStitch) {
|
|
|
+ NSMutableArray *keyFrame = [NSMutableArray array];
|
|
|
+ [obj.keyFrame enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ [keyFrame addObject:obj];
|
|
|
+ }];
|
|
|
+ dict[@"keyFrame"] = keyFrame;
|
|
|
+ dict[@"mosaicPictureUrl"] = obj.path;
|
|
|
+ } else {
|
|
|
+ dict[@"path"] = obj.path;
|
|
|
+ }
|
|
|
[res addObject:dict];
|
|
|
}
|
|
|
}];
|
|
@@ -2138,46 +2057,18 @@
|
|
|
|
|
|
}];
|
|
|
}
|
|
|
-// self.panGesture.enabled = YES;
|
|
|
-// // Access has not been determined.
|
|
|
-// [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
|
|
|
-//
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-// if (status == PHAuthorizationStatusAuthorized) {
|
|
|
-// // Access has been granted.
|
|
|
-// [self.currentOperationNode save];
|
|
|
-// }
|
|
|
-// else {
|
|
|
-// // Access has been denied.
|
|
|
-// [self showAlertForAuthorizationWithText:@"请设置相册权限后重试"];
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }];
|
|
|
}
|
|
|
|
|
|
- (void)discardPhotoResultButtonTouchUpInside:(id)sender{
|
|
|
self.panGesture.enabled = YES;
|
|
|
-// if([self.currentOperationNode respondsToSelector:@selector(discardPhotoResultButtonTouchUpInside)]){
|
|
|
-// [self.currentOperationNode discardPhotoResultButtonTouchUpInside];
|
|
|
-// }
|
|
|
NSString *title = @"返回会清空已拍摄数据,请确认!";
|
|
|
-// if (self.mode == SDK_CAPTURE_MODE_MOVIE) {
|
|
|
-// title = @"返回会清空已拍摄视频,请确认!";
|
|
|
-// } else if (self.mode == SDK_CAPTURE_MODE_PANORAMA || self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA) {
|
|
|
-// title = @"返回会清空已拼接图片,请确认!";
|
|
|
-// }
|
|
|
[QuitMultipleModeAlertViewController show:self title:@"确认提醒" text:title leftBtnTitle:@"取消" rightBtnTitle:@"确定" withLeftButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
[alertController dismissViewControllerAnimated:NO completion:^{}];
|
|
|
} rightButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
-// if (self.mode == SDK_CAPTURE_MODE_CONTINUOUS) {
|
|
|
- [self.resourceModel.continousArray removeAllObjects];
|
|
|
-// } else if (self.mode == SDK_CAPTURE_MODE_MOVIE) {
|
|
|
- [self.resourceModel.movieArray removeAllObjects];
|
|
|
-// } else if (self.mode == SDK_CAPTURE_MODE_PANORAMA) {
|
|
|
- [self.resourceModel.panoramArray removeAllObjects];
|
|
|
-// } else if (self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA) {
|
|
|
- [self.resourceModel.aiPanoramArray removeAllObjects];
|
|
|
-// }
|
|
|
+ [self.resourceModel.continousArray removeAllObjects];
|
|
|
+ [self.resourceModel.movieArray removeAllObjects];
|
|
|
+ [self.resourceModel.panoramArray removeAllObjects];
|
|
|
+ [self.resourceModel.aiPanoramArray removeAllObjects];
|
|
|
[self updateViewStatus];
|
|
|
[alertController dismissViewControllerAnimated:NO completion:^{
|
|
|
|
|
@@ -2188,14 +2079,9 @@
|
|
|
- (void)albumButtonTouchUpInside:(id)sender{
|
|
|
|
|
|
[self performSegueWithIdentifier:@"show-photoalbum" sender:nil];
|
|
|
-// if([self.currentOperationNode respondsToSelector:@selector(segueForAlbum)]){
|
|
|
-// [self performSegueWithIdentifier:self.currentOperationNode.segueForAlbum sender:nil];
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
- (__kindof id<OperationNodeProtocol>)currentOperationNode{
|
|
|
-// NSLog(@"======:%u",self.mode);
|
|
|
-// NSLog(@"------:%@",self.operationNodes);
|
|
|
return self.operationNodes[@(self.mode)];
|
|
|
}
|
|
|
|
|
@@ -2292,23 +2178,12 @@
|
|
|
}
|
|
|
self.resourceModel.lastIndex = self.mode;
|
|
|
[self updateViewStatus];
|
|
|
-
|
|
|
-// [self.cachesArray addObject:image];
|
|
|
-//
|
|
|
-// [self.typeArray addObject:@"photo"];
|
|
|
-//
|
|
|
-// [self.totalArray addObject:image];
|
|
|
-//
|
|
|
-// self.capturedImage = image;
|
|
|
-
|
|
|
|
|
|
|
|
|
[self.currentOperationNode triggered];
|
|
|
if(self.mode == SDK_CAPTURE_MODE_SINGLE){
|
|
|
-// self.panGesture.enabled = NO;
|
|
|
[self stopCaptureSession];
|
|
|
[self performSegueWithIdentifier:@"preview_single" sender:nil];
|
|
|
-// [self showPreviewView:NO];
|
|
|
}
|
|
|
else if(self.mode == SDK_CAPTURE_MODE_CONTINUOUS){
|
|
|
self.discardPhotoButton.hidden = NO;
|
|
@@ -2321,7 +2196,6 @@
|
|
|
- (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhoto:(AVCapturePhoto *)photo error:(NSError *)error{
|
|
|
NSData* imageData = [photo fileDataRepresentation];
|
|
|
if (imageData == nil){
|
|
|
- NSLog(@"%s", "unable to create image data");
|
|
|
return;
|
|
|
}
|
|
|
UIImage *image = [[UIImage alloc] initWithData:imageData];
|
|
@@ -2527,18 +2401,14 @@
|
|
|
- (void)captureOutput:(AVCaptureFileOutput *)output didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray<AVCaptureConnection *> *)connections error:(NSError *)error{
|
|
|
//视频录制
|
|
|
BOOL recordedSuccessfully = YES;
|
|
|
- // A problem occurred: Find out if the recording was successful.
|
|
|
if(error.code == AVErrorMaximumDurationReached){
|
|
|
- NSLog(@"%@", [error localizedDescription]);
|
|
|
}
|
|
|
else if (error.code == AVErrorDiskFull){
|
|
|
- NSLog(@"%@", [error localizedDescription]);
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:LenzSDKNotificationDiskIsFull object:error];
|
|
|
});
|
|
|
}
|
|
|
else if (error.code == AVErrorSessionWasInterrupted){
|
|
|
- NSLog(@"%@", [error localizedDescription]);
|
|
|
}
|
|
|
id value = [[error userInfo] objectForKey:AVErrorRecordingSuccessfullyFinishedKey];
|
|
|
if (value) {
|
|
@@ -2558,7 +2428,6 @@
|
|
|
[self.currentOperationNode takePhotoButtonTouched];
|
|
|
}
|
|
|
}
|
|
|
-// NSString *path = [LenzDataManager saveVideoUrl:outputFileURL model:self.mode];
|
|
|
LenzResourceItemModel *itemModel = [[LenzResourceItemModel alloc]init];
|
|
|
itemModel.path = outputFileURL.absoluteString;
|
|
|
[[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
@@ -2572,9 +2441,6 @@
|
|
|
[self.resourceModel.movieArray addObject:itemModel];
|
|
|
self.resourceModel.lastIndex = self.mode;
|
|
|
|
|
|
-// self.recordedFileUrl = outputFileURL;
|
|
|
-
|
|
|
-// [self.typeArray addObject:@"movie"];
|
|
|
[self updateViewStatus];
|
|
|
[self.timerLabel updateWith:0];
|
|
|
|
|
@@ -2597,7 +2463,6 @@
|
|
|
}
|
|
|
|
|
|
if (self.videoWriter.status == AVAssetWriterStatusFailed) {
|
|
|
- NSLog(@"writer error %@", self.videoWriter.error.localizedDescription);
|
|
|
return NO;
|
|
|
}
|
|
|
|
|
@@ -2635,7 +2500,6 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-// id<OperationNodeProtocol> curr = self.currentOperationNode;
|
|
|
id<OperationNodeProtocol> curr = (__kindof id<OperationNodeProtocol>)self.operationNodes[@(2)];
|
|
|
if([curr respondsToSelector:@selector(deleteCacheForKey:completion:)]){
|
|
|
[curr deleteCacheForKey:model.movieModel.fileUrl.path completion:completion];
|
|
@@ -2645,8 +2509,6 @@
|
|
|
//连拍删除
|
|
|
- (void)deleteImage:(UIImage *)image completion:(nonnull DeleteImageCompletionCallBackType)completion{
|
|
|
|
|
|
-// id<OperationNodeProtocol> curr = self.currentOperationNode;
|
|
|
-
|
|
|
for (int i = 0; i < self.totalArray.count; i ++) {
|
|
|
UIImage *img = self.totalArray[i];
|
|
|
if (img == image) {
|
|
@@ -2659,7 +2521,6 @@
|
|
|
}
|
|
|
|
|
|
id<OperationNodeProtocol> curr = (__kindof id<OperationNodeProtocol>)self.operationNodes[@(0)];
|
|
|
-
|
|
|
if([curr respondsToSelector:@selector(deleteCacheForImage:completion:)]){
|
|
|
[curr deleteCacheForImage:image completion:completion];
|
|
|
}
|
|
@@ -2679,12 +2540,10 @@
|
|
|
if (connection == [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo]) {
|
|
|
|
|
|
[self.stitchkLock lock];
|
|
|
-// dispatch_semaphore_wait(self.videoStitchSemaphore, DISPATCH_TIME_FOREVER);
|
|
|
OperationNodeVideoBase *base = nil;
|
|
|
if ([self.currentOperationNode isKindOfClass:[OperationNodeVideoBase class]]) {
|
|
|
base = (OperationNodeVideoBase *)self.currentOperationNode;
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (self.isVideoStitchStopedWhenRecording &&
|
|
|
(self.stitchResult != LenVideoStitchResultFail && self.stitchResult != LenVideoStitchResultStitchFail)) {
|
|
@@ -2698,7 +2557,6 @@
|
|
|
complete:^(LenVideoStitchResult result, LenVideoStitchNeedSave needSave) {
|
|
|
self.stitchResult = result;
|
|
|
|
|
|
-
|
|
|
self.isVideoStitchStopedWhenRecording = NO;
|
|
|
UIImage *image = [LenStitcher getCurrentPanoramaShowImage];
|
|
|
LenzResourceItemModel *model = nil;
|
|
@@ -2738,13 +2596,12 @@
|
|
|
__block BOOL keyFrame = NO;
|
|
|
[[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
if (obj.model == self.mode) {
|
|
|
- keyFrame = obj.keyFrame;
|
|
|
+ keyFrame = [obj.keyFrame boolValue];
|
|
|
}
|
|
|
}];
|
|
|
|
|
|
if (needSave && keyFrame) {
|
|
|
NSString *path = [LenzDataManager saveImageWith:UIImageJPEGRepresentation(image, .6) mode:self.mode];
|
|
|
-// itemModel.path = path;
|
|
|
if (path) {
|
|
|
[model.keyFrame addObject:path];
|
|
|
}
|
|
@@ -2763,7 +2620,6 @@
|
|
|
} else {
|
|
|
|
|
|
if (!base.isRecording) {
|
|
|
-// [self removeLastStich];
|
|
|
//停止拼接,移除保存中 非success数据
|
|
|
if (self.mode == SDK_CAPTURE_MODE_PANORAMA) {
|
|
|
NSMutableArray *array = [NSMutableArray array];
|
|
@@ -2782,6 +2638,7 @@
|
|
|
}];
|
|
|
self.resourceModel.aiPanoramArray = array;
|
|
|
}
|
|
|
+ [self updateViewStatusWhenStitchSave:NO];
|
|
|
[self updateViewStatus];
|
|
|
[self.stitchkLock unlock];
|
|
|
return;
|
|
@@ -2794,11 +2651,9 @@
|
|
|
}
|
|
|
|
|
|
self.isVideoStitchStopedWhenRecording = NO;
|
|
|
-// base.isRecording = NO;
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[base takePhotoButtonTouched];
|
|
|
[self stopMotion];
|
|
|
-// [self takePhotoButtonTouchUpInside:[NSObject new]];
|
|
|
[self removeLastStich];
|
|
|
[self updateViewStatusWhenStitchFail];
|
|
|
[self.panoramaGuideView clearImage];
|
|
@@ -2818,10 +2673,7 @@
|
|
|
}
|
|
|
|
|
|
[self.stitchkLock unlock];
|
|
|
-
|
|
|
-// dispatch_semaphore_signal(self.videoStitchSemaphore);
|
|
|
}];
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2836,13 +2688,11 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-//*
|
|
|
#pragma mark - Navigation
|
|
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
|
// Get the new view controller using [segue destinationViewController].
|
|
|
- // Pass the selected object to the new view controller.
|
|
|
if([segue.identifier isEqualToString:@"show-photos"]){
|
|
|
if([segue.destinationViewController isKindOfClass:[PhotoListViewController class]]){
|
|
|
PhotoListViewController* dst = segue.destinationViewController;
|
|
@@ -2892,11 +2742,7 @@
|
|
|
dst.movieListVC.movieModels = movieNode.cachedMovies;
|
|
|
dst.movieListVC.delegate = self;
|
|
|
// }
|
|
|
-
|
|
|
- //视频数据
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|