增加平行眼转码功能
This commit is contained in:
parent
06ab0e319d
commit
2429df6010
@ -446,8 +446,22 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//平行眼
|
//平行眼
|
||||||
if(self.selectedIndex == .crossedEyes){
|
if(self.selectedIndex == .parallelEyes){
|
||||||
|
Task {
|
||||||
|
convertor2.type = 5
|
||||||
|
|
||||||
|
try await convertor2.convertVideo(asset: videoOriginalAsset!, 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -156,6 +156,20 @@ class VideoConvertor2 {
|
|||||||
try await Task.sleep(nanoseconds: 3_000_000)
|
try await Task.sleep(nanoseconds: 3_000_000)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//平行眼
|
||||||
|
if (type == 5){
|
||||||
|
let newpb = joinImages( leftImage: rciImage, rightImage:lciImage )
|
||||||
|
let time = CMSampleBufferGetOutputPresentationTimeStamp(nextSampleBuffer)
|
||||||
|
|
||||||
|
_ = vw!.add(image: newpb, presentationTime: time)
|
||||||
|
print( "Added frame at \(time)")
|
||||||
|
|
||||||
|
// callback with progress
|
||||||
|
progress?( Float(time.value)/Float(duration.value))
|
||||||
|
|
||||||
|
// This sleep is needed to stop memory blooming - keeps around 280Mb rather than spiraling up to 8+Gig!
|
||||||
|
try await Task.sleep(nanoseconds: 3_000_000)
|
||||||
|
}
|
||||||
|
|
||||||
//红蓝立体
|
//红蓝立体
|
||||||
if(type == 3){
|
if(type == 3){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user