Merge branch 'video' into carplay

This commit is contained in:
leminlimez committed 2025-06-21 16:45:40 -04:00
commit aac867c83a
1 file changed
+13 -11
+13 -11
View File
@@ -140,17 +140,19 @@ class VideoHandler {
while let sampleBuffer = readerOutput.copyNextSampleBuffer(), while let sampleBuffer = readerOutput.copyNextSampleBuffer(),
let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) { let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
let name = "\(frameCount).jpg" try? autoreleasepool {
let filePathName = "assets/\(name)" let name = "\(frameCount).jpg"
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName)) let filePathName = "assets/\(name)"
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName))
let ciImage = CIImage(cvPixelBuffer: imageBuffer)
let context = CIContext() let ciImage = CIImage(cvPixelBuffer: imageBuffer)
if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) { let context = CIContext()
if let img = cgImage.jpg { if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) {
try img.write(to: assetsFolder.appendingPathComponent(name)) if let img = cgImage.jpg {
camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n" try img.write(to: assetsFolder.appendingPathComponent(name))
frameCount += 1 camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n"
frameCount += 1
}
} }
} }
} }