|
@@ -186,7 +186,7 @@
|
|
|
|
|
|
__weak typeof(self) weakself = self;
|
|
|
[self.modeList reloadWith:self.operationNodesArray];
|
|
|
- self.modeList.indexChangedHandler = ^BOOL(NSUInteger newIndex, NSUInteger oldIndex) {
|
|
|
+ self.modeList.indexChangedHandler = ^BOOL(NSUInteger newMode, NSUInteger oldMode, NSUInteger newIndex) {
|
|
|
__strong typeof(weakself) strongSelf = weakself;
|
|
|
|
|
|
if ([SDKParameters shared].retainedMode == SDK_DATA_RETAINED_CLEAR) {
|
|
@@ -257,15 +257,15 @@
|
|
|
}
|
|
|
self.modeList.index = newIndex;
|
|
|
[self.modeList updateItemsConstraints];
|
|
|
- [strongSelf modeWillChange:newIndex oldIndex:oldIndex];
|
|
|
+ [strongSelf modeWillChange:newMode oldIndex:oldMode];
|
|
|
|
|
|
id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
|
|
|
- PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newIndex);
|
|
|
+ PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
|
|
|
strongSelf.mode = mode;
|
|
|
|
|
|
self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
- [strongSelf modeDidChange:newIndex oldIndex:oldIndex];
|
|
|
- [strongSelf updateCaptureSessionWith:oldIndex];
|
|
|
+ [strongSelf modeDidChange:newMode oldIndex:oldMode];
|
|
|
+ [strongSelf updateCaptureSessionWith:oldMode];
|
|
|
if([oldModelNode respondsToSelector:@selector(didQuit)]){
|
|
|
[oldModelNode didQuit];
|
|
|
}
|
|
@@ -277,15 +277,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- [strongSelf modeWillChange:newIndex oldIndex:oldIndex];
|
|
|
+ [strongSelf modeWillChange:newMode oldIndex:oldMode];
|
|
|
|
|
|
id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
|
|
|
- PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newIndex);
|
|
|
+ PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
|
|
|
strongSelf.mode = mode;
|
|
|
|
|
|
self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
- [strongSelf modeDidChange:newIndex oldIndex:oldIndex];
|
|
|
- [strongSelf updateCaptureSessionWith:oldIndex];
|
|
|
+ [strongSelf modeDidChange:newMode oldIndex:oldMode];
|
|
|
+ [strongSelf updateCaptureSessionWith:oldMode];
|
|
|
if([oldModelNode respondsToSelector:@selector(didQuit)]){
|
|
|
[oldModelNode didQuit];
|
|
|
}
|
|
@@ -553,6 +553,7 @@
|
|
|
if(self.mode != SDK_CAPTURE_MODE_SINGLE) {
|
|
|
PCSPreviewViewController *vc = [[PCSPreviewViewController alloc]init];
|
|
|
vc.model = self.resourceModel;
|
|
|
+ vc.selectIndex = self.mode;
|
|
|
vc.dataChangeBlock = ^{
|
|
|
[self updateViewStatus];
|
|
|
};
|
|
@@ -949,11 +950,13 @@
|
|
|
}
|
|
|
|
|
|
- (void)takeStillPhoto:(AVCaptureVideoPreviewLayer*)previewLayer {
|
|
|
-
|
|
|
+ if ([self showAuthorCamerIfNeed]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
AVCaptureConnection *connection = [self.photoOutput connectionWithMediaType:AVMediaTypeVideo];
|
|
|
|
|
|
if(connection == nil){
|
|
|
- [self showAlertForAuthorization];
|
|
|
+// [self showAlertForAuthorization];
|
|
|
return;
|
|
|
}
|
|
|
if (connection.supportsVideoOrientation) {
|
|
@@ -1036,7 +1039,62 @@
|
|
|
}
|
|
|
|
|
|
- (void)showAlertForAuthorization{
|
|
|
-// [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
+ [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
+}
|
|
|
+
|
|
|
+- (BOOL)showAuthorCamerIfNeed {
|
|
|
+ __block BOOL showAlert = NO;
|
|
|
+ switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) {
|
|
|
+
|
|
|
+ case AVAuthorizationStatusNotDetermined:{
|
|
|
+ [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
|
|
|
+ if(!granted){
|
|
|
+ [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
+ showAlert = YES;
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case AVAuthorizationStatusDenied:{
|
|
|
+ [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
+ showAlert = YES;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ showAlert = NO;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return showAlert;
|
|
|
+}
|
|
|
+
|
|
|
+- (BOOL)showAudioCamerIfNeed {
|
|
|
+ __block BOOL showAlert = NO;
|
|
|
+
|
|
|
+ switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio]) {
|
|
|
+
|
|
|
+ case AVAuthorizationStatusNotDetermined:{
|
|
|
+ [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
|
|
|
+ if(!granted){
|
|
|
+ [self setupMicrophone];
|
|
|
+ [self showAlertForAuthorizationWithText:@"请在系统设置里打开麦克风访问权限后重试"];
|
|
|
+ showAlert = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case AVAuthorizationStatusDenied:{
|
|
|
+ [self showAlertForAuthorizationWithText:@"请在系统设置里打开麦克风访问权限后重试"];
|
|
|
+ showAlert = YES;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ default:
|
|
|
+ showAlert = NO;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return showAlert;
|
|
|
}
|
|
|
|
|
|
#pragma mark - Capture
|
|
@@ -1045,7 +1103,12 @@
|
|
|
}
|
|
|
|
|
|
- (BOOL)startRecording{
|
|
|
-
|
|
|
+ if ([self showAuthorCamerIfNeed]) {
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+ if ([self showAudioCamerIfNeed]) {
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
if(self.movieFileOutput.isRecording){
|
|
|
return NO;
|
|
|
}
|
|
@@ -1144,7 +1207,7 @@
|
|
|
if([self configureVideoWritter]){
|
|
|
AVCaptureConnection *connection = [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo];
|
|
|
if(connection == nil){
|
|
|
- [self showAlertForAuthorization];
|
|
|
+// [self showAlertForAuthorization];
|
|
|
return;
|
|
|
}
|
|
|
[connection setVideoOrientation:orientation];
|
|
@@ -1574,6 +1637,8 @@
|
|
|
- (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) {
|
|
@@ -1597,6 +1662,8 @@
|
|
|
break;
|
|
|
case PanoramaOrientationViewAny: {
|
|
|
self.panoramaGuideView.hidden = YES;
|
|
|
+// self.ai_fullView.hidden = YES;
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -2485,14 +2552,14 @@
|
|
|
- (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
|
|
|
@autoreleasepool {
|
|
|
if (connection == [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo]) {
|
|
|
- NSLog(@"11111");
|
|
|
+
|
|
|
[self.stitchkLock lock];
|
|
|
// dispatch_semaphore_wait(self.videoStitchSemaphore, DISPATCH_TIME_FOREVER);
|
|
|
OperationNodeVideoBase *base = nil;
|
|
|
if ([self.currentOperationNode isKindOfClass:[OperationNodeVideoBase class]]) {
|
|
|
base = (OperationNodeVideoBase *)self.currentOperationNode;
|
|
|
}
|
|
|
- NSLog(@"2222");
|
|
|
+
|
|
|
|
|
|
if (self.isVideoStitchStopedWhenRecording &&
|
|
|
(self.stitchResult != LenVideoStitchResultFail && self.stitchResult != LenVideoStitchResultStitchFail)) {
|
|
@@ -2505,7 +2572,7 @@
|
|
|
isStop:self.isVideoStitchStopedWhenRecording
|
|
|
complete:^(LenVideoStitchResult result, LenVideoStitchNeedSave needSave) {
|
|
|
self.stitchResult = result;
|
|
|
- NSLog(@"333");
|
|
|
+
|
|
|
|
|
|
self.isVideoStitchStopedWhenRecording = NO;
|
|
|
UIImage *image = [LenStitcher getCurrentPanoramaShowImage];
|
|
@@ -2617,11 +2684,11 @@
|
|
|
[SVProgressHUD dismissWithDelay:3 completion:^{
|
|
|
}];
|
|
|
} else if(result == LenVideoStitchResultSlowMore) {
|
|
|
- [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"特征点变少,放慢速度"];
|
|
|
+ [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"移动速度过快,请匀速拍摄"];
|
|
|
} else if (result == LenVideoStitchResultSlow) {
|
|
|
- [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"特征点极少,即将失败"];
|
|
|
+ [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"图像中目标物体较少,请对准货架进行拍摄"];
|
|
|
} else {
|
|
|
- [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请勿往反方向移动"];
|
|
|
+// [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请勿往反方向移动"];
|
|
|
}
|
|
|
}
|
|
|
|