1.修正视频格式写入:metadata方式;

2.修正判断空间视频格式的方法;
3.修复首页home pagecontrol的位置居中;
This commit is contained in:
bluesea 2024-03-22 11:33:38 +08:00
parent ae2160979a
commit 6605d7bc4b
7 changed files with 201 additions and 85 deletions

View File

@ -623,7 +623,7 @@ extension LLCycleScrollView {
case.right:
customPageControl?.frame = CGRect.init(x: UIScreen.main.bounds.width - (oldFrame?.size.width)! - pageControlLeadingOrTrialingContact * 0.5, y: y, width: (oldFrame?.size.width)!, height: 10)
default:
customPageControl?.frame = CGRect.init(x: (oldFrame?.origin.x)!, y: y, width: (oldFrame?.size.width)!, height: 10)
customPageControl?.frame = CGRect.init(x: (self.bounds.width - (oldFrame?.size.width)!)*0.5, y: y, width: (oldFrame?.size.width)!, height: 10)
}
}

View File

@ -857,7 +857,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.5;
CURRENT_PROJECT_VERSION = 1.7;
DEVELOPMENT_TEAM = 8DQD6BV6H9;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SwiftProject/Info.plist;
@ -898,7 +898,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.5;
CURRENT_PROJECT_VERSION = 1.7;
DEVELOPMENT_TEAM = 8DQD6BV6H9;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SwiftProject/Info.plist;

View File

@ -14,8 +14,8 @@
filePath = "SwiftProject/Project/Controller/CCHomeController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "515"
endingLineNumber = "515"
startingLineNumber = "495"
endingLineNumber = "495"
landmarkName = "CCHomeController"
landmarkType = "21">
</BreakpointContent>
@ -30,8 +30,8 @@
filePath = "SwiftProject/Project/Controller/CCHomeController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "507"
endingLineNumber = "507"
startingLineNumber = "487"
endingLineNumber = "487"
landmarkName = "photoLibrary()"
landmarkType = "7">
</BreakpointContent>
@ -84,38 +84,6 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "AA40D723-9487-476D-AECC-FEBC6B24B259"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Pods/LLCycleScrollView/Lib/LLCycleScrollView/LLCycleScrollView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "608"
endingLineNumber = "608"
landmarkName = "layoutSubviews()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3369F177-5EF4-4185-9855-0AD73846AA47"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Pods/LLCycleScrollView/Lib/LLCycleScrollView/LLCycleScrollView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "602"
endingLineNumber = "602"
landmarkName = "layoutSubviews()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@ -142,8 +110,8 @@
filePath = "SwiftProject/Project/Controller/CCHomeController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "471"
endingLineNumber = "471"
startingLineNumber = "451"
endingLineNumber = "451"
landmarkName = "gotoPhotoTransformVC(data:url:asset:)"
landmarkType = "7">
</BreakpointContent>
@ -637,5 +605,161 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "679B28C9-4889-4546-A3C6-246F045B6896"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "85"
endingLineNumber = "85"
landmarkName = "writeSpatialVideo(leftEyeVideoURL:rightEyeVideoURL:outputVideoURL:completion:)"
landmarkType = "7">
<Locations>
<Location
uuid = "679B28C9-4889-4546-A3C6-246F045B6896 - ad91d10e3e2f72cf"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
endingLineNumber = "92"
offsetFromSymbolStart = "4848">
</Location>
<Location
uuid = "679B28C9-4889-4546-A3C6-246F045B6896 - ad91d10e3e2f73d7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "84"
endingLineNumber = "84"
offsetFromSymbolStart = "4544">
</Location>
<Location
uuid = "679B28C9-4889-4546-A3C6-246F045B6896 - ad91d10e3e2f73f4"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "85"
endingLineNumber = "85"
offsetFromSymbolStart = "4532">
</Location>
<Location
uuid = "679B28C9-4889-4546-A3C6-246F045B6896 - ad91d10e3e2f7253"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "88"
endingLineNumber = "88"
offsetFromSymbolStart = "3468">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "82615B78-E63E-4A1B-BDE7-151EC8CAECFE"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "78"
endingLineNumber = "78"
landmarkName = "writeSpatialVideo(leftEyeVideoURL:rightEyeVideoURL:outputVideoURL:completion:)"
landmarkType = "7">
<Locations>
<Location
uuid = "82615B78-E63E-4A1B-BDE7-151EC8CAECFE - ad91d10e3e2f731d"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "78"
endingLineNumber = "78"
offsetFromSymbolStart = "4652">
</Location>
<Location
uuid = "82615B78-E63E-4A1B-BDE7-151EC8CAECFE - ad91d10e3e2f731d"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "78"
endingLineNumber = "78"
offsetFromSymbolStart = "4348">
</Location>
<Location
uuid = "82615B78-E63E-4A1B-BDE7-151EC8CAECFE - ad91d10e3e2f733a"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "79"
endingLineNumber = "79"
offsetFromSymbolStart = "4348">
</Location>
<Location
uuid = "82615B78-E63E-4A1B-BDE7-151EC8CAECFE - ad91d10e3e2f7253"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SwiftProject.SpatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: Foundation.URL, rightEyeVideoURL: Foundation.URL, outputVideoURL: Foundation.URL, completion: (Swift.Bool, Swift.Optional&lt;Swift.Error&gt;) -&gt; ()) -&gt; ()"
moduleName = "SwiftProject"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/SpatialVideoWriter.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "88"
endingLineNumber = "88"
offsetFromSymbolStart = "3468">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -66,25 +66,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
self.checkAirPlayStatus()
}
// func isExternalDeviceConnected() -> Bool {
// let screens = UIScreen.screens
//
// // 1
// if screens.count > 1 {
// return true
// }
//
// //
// for screen in screens {
// if !screen.isEqual(UIScreen.main) {
// return true
// }
// }
//
// //
// return false
// }
override func viewDidLoad() {
super.viewDidLoad()
@ -184,7 +166,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
//345*200
cycleScrollView = LLCycleScrollView()
cycleScrollView?.frame = CGRect.init(x: 24, y: Int(SafeAreaTop_Height) + 35, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345)
cycleScrollView?.frame = CGRect.init(x: 24, y: Int(SafeAreaTop_Height) + 35, width: Int(SCREEN_Width)-48 , height: (Int(SCREEN_Width) - 48) * 200/345)
cycleScrollView!.delegate = self
//
cycleScrollView!.autoScroll = true
@ -214,6 +196,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
// view
self.view.addSubview(cycleScrollView!)
//
cycleScrollView!.imagePaths = ["Banner_01","Banner_02","Banner_03"]
@ -243,7 +226,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
//
func cycleScrollView(_ cycleScrollView: LLCycleScrollView, scrollTo index: NSInteger) {
print("当前页面索引:\(index)")
// print("\(index)")
let arr1 = ["Tips.1 拍摄空间照片以及视频","Tips.2 视频转码","Tips.3 直连VR设备"]
let arr2 = ["一键拍摄空间格式的照片以及视频,留住美好瞬间",
"可以将任意格式视频转码为 VR 或 3D 格式",
@ -448,10 +431,7 @@ extension CCHomeController: TZImagePickerControllerDelegate,UINavigationControll
func spaceAlbum() {
KWindow?.addSubview(spaceAlbumPopView)
spaceAlbumPopView.show()
//
spaceAlbumPopView.selectedImageHandler = { [self] data,asset in
gotoPhotoTransformVC(data: data, url: nil,asset: asset)

View File

@ -56,22 +56,36 @@ class SpatialVideoWriter {
//
let metadataItem_1 = AVMutableMetadataItem()
metadataItem_1.identifier = .quickTimeMetadataDescription
metadataItem_1.identifier = .quickTimeMetadataSpatialOverCaptureQualityScoringVersion
metadataItem_1.dataType = kCMMetadataDataType_QuickTimeMetadataDirection as String
metadataItem_1.value = String("ff") as (NSCopying & NSObjectProtocol)
metadataItem_1.extraAttributes = [.info:"vpexport"]
// let metadataItem_2 = AVMutableMetadataItem()
// metadataItem_2.identifier = .quickTimeMetadataSpatialOverCaptureQualityScoringVersion
// metadataItem_2.dataType = kCMMetadataDataType_QuickTimeMetadataDirection as String
// metadataItem_2.value = String("ff") as (NSCopying & NSObjectProtocol)
// metadataItem_2.extraAttributes = [.info:"vpexport"]
let metadataItem_2 = AVMutableMetadataItem()
metadataItem_2.identifier = .quickTimeMetadataInformation
metadataItem_2.dataType = kCMMetadataDataType_QuickTimeMetadataDirection as String
metadataItem_2.value = String("ff") as (NSCopying & NSObjectProtocol)
// let atmg:AVMutableTimedMetadataGroup = AVMutableTimedMetadataGroup(items: [metadataItem_1,metadataItem_2], timeRange: CMTimeRange(start: .zero, duration: .positiveInfinity))
// let desc:CMMetadataFormatDescription? = atmg.copyFormatDescription()
// let asaArray = AVOutputSettingsAssistant.availableOutputSettingsPresets()
// asaArray.forEach { preset in
// var asa = AVOutputSettingsAssistant(preset: preset)
// print("asa:\n\(asa?.videoSettings) \n\(asa?.audioSettings)\n")
// }
//
// let input_metadata = AVAssetWriterInput.init(mediaType: .metadata, outputSettings: nil, sourceFormatHint: desc)
//// let input_metadata = AVAssetWriterInput.init(mediaType: .metadata, outputSettings: nil)
// let metadataAdaptor = AVAssetWriterInputMetadataAdaptor(assetWriterInput: input_metadata)
// if assetWriter.canAdd(input_metadata) {
// assetWriter.add(input_metadata)
// }
// else {
// print("assetwriter can't add input_metadata....")
// }
let atmg:AVMutableTimedMetadataGroup = AVMutableTimedMetadataGroup(items: [metadataItem_1,metadataItem_2], timeRange: CMTimeRange(start: .zero, duration: .positiveInfinity))
let desc:CMMetadataFormatDescription? = atmg.copyFormatDescription()
let input_metadata = AVAssetWriterInput.init(mediaType: .metadata, outputSettings: nil, sourceFormatHint: desc)
let metadataAdaptor = AVAssetWriterInputMetadataAdaptor(assetWriterInput: input_metadata)
assetWriter.add(input_metadata)
assetWriter.metadata = [metadataItem_1]
@ -185,9 +199,9 @@ class SpatialVideoWriter {
self.addAudio(assetTrackOutput: output_audio_left, audio_input: writerInput_Audio_left)
//
let appendATMGResult = metadataAdaptor.append(atmg)
print("atmg result:\(appendATMGResult)")
// let appendATMGResult = metadataAdaptor.append(atmg)
//
// print("atmg result:\(appendATMGResult)")
//
print("完成写入")

View File

@ -41,10 +41,7 @@ class ZZHHelper {
// if track.mediaType == .video {
// for formatDesc in track.formatDescriptions {
// let dic = CMFormatDescriptionGetExtensions(formatDesc as! CMFormatDescription) as! Dictionary<String, Any>
// let fromatName = dic["FormatName"] as? String
// if let fn = fromatName,fn == "HEVC"{
// return true
// }
// print("fromatdesc:\n\(dic)\n\n")
// }
// }
// }
@ -53,8 +50,9 @@ class ZZHHelper {
let metadata = asset.metadata(forFormat: AVMetadataFormat.quickTimeMetadata)
let isSpatialVideo = metadata.contains { item in
print("item:\n\(item) \n\n\n")
if let identifier = item.identifier?.rawValue {
return identifier == "mdta/com.apple.quicktime.spatial.format-version"
return (identifier == "mdta/com.apple.quicktime.spatial.format-version") || (identifier == "mdta/com.apple.quicktime.spatial-overcapture.quality-scoring-version")
}
return false
}