diff --git a/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist b/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist index c59027f..b495384 100644 --- a/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/SwiftProject/Pods/Pods.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ Alamofire.xcscheme_^#shared#^_ orderHint - 7 + 8 CocoaAsyncSocket.xcscheme_^#shared#^_ @@ -17,52 +17,52 @@ DeviceKit.xcscheme_^#shared#^_ orderHint - 14 + 16 FirebaseCore.xcscheme_^#shared#^_ orderHint - 15 + 0 FirebaseCoreExtension.xcscheme_^#shared#^_ orderHint - 5 + 11 FirebaseCoreInternal.xcscheme_^#shared#^_ orderHint - 17 + 5 FirebaseCrashlytics.xcscheme_^#shared#^_ orderHint - 2 + 10 FirebaseInstallations.xcscheme_^#shared#^_ orderHint - 21 + 13 FirebaseMessaging.xcscheme_^#shared#^_ orderHint - 10 + 6 FirebaseSessions.xcscheme_^#shared#^_ orderHint - 12 + 18 GoogleDataTransport.xcscheme_^#shared#^_ orderHint - 20 + 14 GoogleUtilities.xcscheme_^#shared#^_ orderHint - 9 + 4 KTVHTTPCache.xcscheme_^#shared#^_ @@ -72,52 +72,52 @@ Kingfisher-Kingfisher.xcscheme_^#shared#^_ orderHint - 6 + 15 Kingfisher.xcscheme_^#shared#^_ orderHint - 3 + 7 LLCycleScrollView.xcscheme_^#shared#^_ orderHint - 4 + 17 Pods-SwiftProject.xcscheme_^#shared#^_ orderHint - 19 + 1 PromisesObjC.xcscheme_^#shared#^_ orderHint - 16 + 19 PromisesSwift.xcscheme_^#shared#^_ orderHint - 0 + 2 SVProgressHUD.xcscheme_^#shared#^_ orderHint - 13 + 20 SnapKit.xcscheme_^#shared#^_ orderHint - 18 + 3 TZImagePickerController.xcscheme_^#shared#^_ orderHint - 1 + 12 nanopb.xcscheme_^#shared#^_ orderHint - 11 + 9 diff --git a/SwiftProject/SwiftProject.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist b/SwiftProject/SwiftProject.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist index 4992101..a637b81 100644 --- a/SwiftProject/SwiftProject.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/SwiftProject/SwiftProject.xcodeproj/xcuserdata/aaa.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ SwiftProject.xcscheme_^#shared#^_ orderHint - 8 + 21 diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate index f317c37..b9dfeb1 100644 Binary files a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 321f3e3..b8b310e 100644 --- a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -158,8 +158,8 @@ filePath = "SwiftProject/Project/Controller/RecordingVideo/VRPhotoTransformController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "153" - endingLineNumber = "153" + startingLineNumber = "175" + endingLineNumber = "175" landmarkName = "viewDidLoad()" landmarkType = "7"> diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift index dd8cc51..b902221 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift @@ -323,7 +323,7 @@ class CCSpatialVideoDisplayController: BaseController, AVPlayerViewControllerDel case .parallelEyes://平行眼 while let nextSampleBuffer = self.assetOutput!.copyNextSampleBuffer() { -// print("平心眼...") + } self.assetOutput?.reset(forReadingTimeRanges:[NSValue(timeRange: tr)]) @@ -503,16 +503,6 @@ class CCSpatialVideoDisplayController: BaseController, AVPlayerViewControllerDel } - //播放 -// func play(){ -// -// let playerItem = AVPlayerItem(asset: videoOriginalAsset) -// playerLay.player = AVPlayer(playerItem: playerItem) -// playerLay.player!.play() -// playerLay.backgroundColor = UIColor.clear.cgColor -// } - - //MARK: - action @objc public func navgationButtonClick2(sender:UIButton){ @@ -591,46 +581,6 @@ class CCSpatialVideoDisplayController: BaseController, AVPlayerViewControllerDel // player!.play() self.selectedIndex = rsi - - - - //空间视频 -// if(selectedIndex == 1){ -//// Task { -//// try await videoConverter.convertStereoscopicVideoToSpatialVideo(sourceVideoURL: sourceVideoURL!,outputVideoURL: outputVideoURL!){[weak self] progress in -//// print(progress) -//// DispatchQueue.main.async { [weak self] in -//// self!.btn3!.setTitle("进度=" + String(progress), for: UIControl.State.normal) -//// if(progress > 0.99){ -//// self!.videoTempAsset = AVAsset(url: self!.outputVideoURL!) -//// self!.play() -//// } -//// } -//// } -//// } -// } - - //高斯模糊 -// if(selectedIndex == 4){ -// Task { -// convertor2.type = 4 -// -// try await convertor2.convertVideo(asset: videoTempAsset!, outputFile: outputVideoURL! ) { [self] progress in -// print(progress) -// DispatchQueue.main.async { [weak self] in -// self?.progressView.setProgress(progress, animated: true) -// if(progress > 0.99){ -// self!.videoTempAsset = AVAsset(url: self!.outputVideoURL!) -// self!.play() -// } -// } -// -// } -// } -// } } - - - } diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift index 05d758d..1fb8ed2 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift @@ -563,11 +563,16 @@ class VRVideoTransformController: BaseController { extension VRVideoTransformController { @objc private func videoTransformAction() { -// let path = Bundle.main.path(forResource: "IMG_0071", ofType: "MOV") -// let videoURL = URL.init(filePath: path!) - self.showProgress() self.mAvPlayer?.player?.pause() - let videoURL = sourceVideoURL + + let videoOriginalAsset:AVAsset? = AVAsset(url: sourceVideoURL!) + if !ZZHHelper.isSpatialVideo(asset: videoOriginalAsset!) { + SVProgressHUD.showInfo(withStatus: "非空间视频不能转码") + return + } + + self.showProgress() + let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! let outputURL = documentsDirectory.appendingPathComponent("output_path.mov") @@ -594,7 +599,7 @@ extension VRVideoTransformController { let horizontalDisparity: Float = 0.0 let horizontalFieldOfView: Float = 90.0 let outputVideoURL = URL.documentsDirectory.appending(path:"convertor_one.mov") - let videoOriginalAsset:AVAsset? = AVAsset(url: sourceVideoURL!) + Task { try await spatialVideoConver.convertVideo(asset: videoOriginalAsset!, outputFile: outputVideoURL ,type: self.selected3DFormat) { [weak self] (progress,state) in if(state){ diff --git a/SwiftProject/SwiftProject/Project/Util/ZZHHelper.swift b/SwiftProject/SwiftProject/Project/Util/ZZHHelper.swift index ea1e16b..7b84ac0 100644 --- a/SwiftProject/SwiftProject/Project/Util/ZZHHelper.swift +++ b/SwiftProject/SwiftProject/Project/Util/ZZHHelper.swift @@ -37,18 +37,29 @@ class ZZHHelper { //MARK: 检查是否为空间视频 class func isSpatialVideo(asset: AVAsset) -> Bool { - for track in asset.tracks { - if track.mediaType == .video { - for formatDesc in track.formatDescriptions { - let dic = CMFormatDescriptionGetExtensions(formatDesc as! CMFormatDescription) as! Dictionary - let fromatName = dic["FormatName"] as? String - if let fn = fromatName,fn == "HEVC"{ - return true - } - } +// for track in asset.tracks { +// if track.mediaType == .video { +// for formatDesc in track.formatDescriptions { +// let dic = CMFormatDescriptionGetExtensions(formatDesc as! CMFormatDescription) as! Dictionary +// let fromatName = dic["FormatName"] as? String +// if let fn = fromatName,fn == "HEVC"{ +// return true +// } +// } +// } +// } +// return false + + + let metadata = asset.metadata(forFormat: AVMetadataFormat.quickTimeMetadata) + let isSpatialVideo = metadata.contains { item in + if let identifier = item.identifier?.rawValue { + return identifier == "mdta/com.apple.quicktime.spatial.format-version" } + return false } - return false + return isSpatialVideo + } //设置曝光时间