diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift index 29be755..cc6684c 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift @@ -268,9 +268,9 @@ class CCSpatialVideoDisplayController: BaseController { break } -// if let ciImg { - request.finish(with: ciImg!, context: nil) -// } + if let ciImg { + request.finish(with: ciImg, context: nil) + } } return temItem } @@ -466,7 +466,11 @@ class CCSpatialVideoDisplayController: BaseController { } func selectedSpatialType(selectedIndex:Int){ - let rsi : SpatialType = SpatialType(rawValue: selectedIndex) ?? .monocular2D + var si = selectedIndex + if self.typeData.count == 2 { + si = selectedIndex + 4 + } + let rsi : SpatialType = SpatialType(rawValue: si) ?? .monocular2D // player!.play() self.selectedIndex = rsi diff --git a/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift b/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift index c3f9600..27749b2 100644 --- a/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift +++ b/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift @@ -50,9 +50,9 @@ class PlayByTransferConvertor { newpb = joinImages_sbs(left: left, right: right, imgWidth: cwidth, imgHeight:cheight ) break case .fsbs: - cwidth = left.size.width*2 + cwidth = left.size.width cheight = left.size.height - newpb = joinImages_sbs(left: left, right: right, imgWidth: cwidth, imgHeight: cheight) + newpb = joinImages_fsbs(left: left, right: right, imgWidth: cwidth, imgHeight: cheight) break case .parallelEyes://平行眼 @@ -131,6 +131,21 @@ class PlayByTransferConvertor { return ci } + //FSBS + func joinImages_fsbs( left:UIImage, right:UIImage,imgWidth:CGFloat,imgHeight:CGFloat) -> CIImage { + let newImageSize = CGSize(width:imgWidth, height: imgHeight);//在播放过程中,务必保证宽、高尺寸不变 + UIGraphicsBeginImageContextWithOptions(newImageSize, false, 1); + left.draw(in: CGRect(x:0, y:imgHeight/4, width:imgWidth/2, height:imgHeight/2)) + right.draw(in: CGRect(x:imgWidth/2, y:imgHeight/4, width:imgWidth/2, height:imgHeight/2)) + let image = UIGraphicsGetImageFromCurrentImageContext()! + UIGraphicsEndImageContext(); + + + let ci = CIImage(cgImage: image.cgImage!) + return ci + } + + //将两张图片合成一张图片 OU func joinImages_ou( left:UIImage, right:UIImage,imgWidth:CGFloat,imgHeight:CGFloat) -> CIImage { let newImageSize = CGSize(width:imgWidth, height: imgHeight); @@ -154,8 +169,8 @@ class PlayByTransferConvertor { let newImageSize = CGSize(width:imageWidth, height: left.size.height); UIGraphicsBeginImageContextWithOptions(newImageSize, false, 1); - left.draw(in: CGRect(x:0, y:0, width:imageWidth/2, height:imageHeight)) - right.draw(in: CGRect(x:imageWidth/2, y:0, width:imageWidth/2, height:imageHeight)) + left.draw(in: CGRect(x:0, y:imageHeight/2, width:imageWidth/2, height:imageHeight)) + right.draw(in: CGRect(x:imageWidth/2, y:imageHeight/2, width:imageWidth/2, height:imageHeight)) let image = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext(); diff --git a/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate index 113ab80..4ee6b6b 100644 Binary files a/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ