我试图使用AVFoundation框架快速捕获来自AVCaptureStillImageOutput的"系列"静止图像,就像某些相机中的连拍模式一样.我想使用完成处理程序,
[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
Run Code Online (Sandbox Code Playgroud)
并将imageSampleBuffer传递给NSOperation对象以供以后处理.但是我找不到在NSOperation类中保留缓冲区的方法.
[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
//Add to queue
SaveImageDataOperation *saveOperation = [[SaveImageDataOperation alloc] initWithImageBuffer:imageSampleBuffer];
[_saveDataQueue addOperation:saveOperation];
[saveOperation release];
//Continue
[self captureCompleted];
}];
Run Code Online (Sandbox Code Playgroud)
有谁知道我在这里做错了什么?有没有更好的方法来做到这一点?
小智 8
"重要信息:CMSampleBuffer的客户端必须通过调用CFRetain和CFRelease显式管理保留计数,即使在使用垃圾收集的进程中也是如此."
消息来源:CoreMedia.Framework CMSampleBuffer.h
| 归档时间: |
|
| 查看次数: |
2216 次 |
| 最近记录: |