将sampleBuffer保存在数组中(AVFoundation) [英] Save sampleBuffer in array (AVFoundation)
问题描述
我尝试将样本缓冲区而不是UIImage保存到数组中,以便稍后进行转换。这样可以加快图像捕获速度,也可能无法获得内存警告。我只是无法弄清楚如何将它保存到数组然后再次使用它来调用[self imageFromSampleBuffer:sampleBuffer]。我试过这样的东西,但是如何将数据转换回CMSampleBufferRef对象?
I try to save the sample buffer instead of an UIImage to an array, to convert it later on. This to speed up the image capturing and maybe not get memory warnings. I just can't figure out how to save it to the array and then use it again to call [self imageFromSampleBuffer:sampleBuffer]. I tried something like this, but how do I convert the data back to a CMSampleBufferRef object?
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection {
// Create a UIImage from the sample buffer data
// UIImage *image = [self imageFromSampleBuffer:sampleBuffer];
// [arrCaptures addObject:image];
[arrImageBuffer addObject:[NSData dataWithBytes:sampleBuffer length:sizeof(sampleBuffer)] ];}
推荐答案
为什么不直接使用CFArray并将CMSampleBufferRef对象直接放在那里?
Why not just use a CFArray and directly put the CMSampleBufferRef objects in there?
这篇关于将sampleBuffer保存在数组中(AVFoundation)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!