Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save sampleBuffer in array (AVFoundation)

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)] ];}
like image 848
Snilleblixten Avatar asked May 19 '26 22:05

Snilleblixten


1 Answers

Why not just use a CFArray and directly put the CMSampleBufferRef objects in there?

like image 114
Icydog Avatar answered May 22 '26 13:05

Icydog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!