我从ARSessionDelegate获取了一个CVPixelBuffer:
但是我应用程序的另一部分(我无法更改)使用CMSampleBuffer。
CMSampleBuffer是CVPixelBuffer的容器。
为了创建CMSampleBuffer,我可以使用此函数:
func session(_ session: ARSession, didUpdate frame: ARFrame) {
frame.capturedImage // CVPixelBufferRef
}
但是我应用程序的另一部分(我无法更改)使用CMSampleBuffer。
CMSampleBuffer是CVPixelBuffer的容器。
为了创建CMSampleBuffer,我可以使用此函数:
func CMSampleBufferCreateReadyWithImageBuffer(_ allocator: CFAllocator?,
_ imageBuffer: CVImageBuffer,
_ formatDescription: CMVideoFormatDescription,
_ sampleTiming: UnsafePointer<CMSampleTimingInfo>,
_ sBufOut: UnsafeMutablePointer<CMSampleBuffer?>) -> OSStatus
对我来说唯一缺失的参数是 sampleTiming
- 我如何从 CVPixelBuffer 中提取它?