1
我想從攝像頭獲得openGL兼容緩衝區。 我設立AVCaptureVideoDataOutput這樣的:AVCaptureVideoDataOutput videoSettings與kCVPixelBufferOpenGLESCompatibilityKey
_videoDataOutput = [[AVCaptureVideoDataOutput alloc] init];
[_videoDataOutput setSampleBufferDelegate:self queue:_sessionQueue];
// NSArray *pixelsFormats = _videoDataOutput.availableVideoCVPixelFormatTypes;
[_videoDataOutput setVideoSettings:@{
(NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA),
// Flag to enable emitting openGL frames from camera.
(NSString *)kCVPixelBufferOpenGLESCompatibilityKey : @(YES)
}];
_videoDataOutput.alwaysDiscardsLateVideoFrames = YES;
但我得到這個錯誤:
[AVCaptureVideoDataOutput setVideoSettings:] - videoSettings dictionary contains one or more unsupported (ignored) keys: (
OpenGLESCompatibility
)
我可以使用kCVPixelBufferOpenGLESCompatibilityKey與AVCaptureVideoDataOutput? 如果不是從相機發出OpenGL兼容幀的最佳方式是什麼?
我已經考慮從CVImageBufferRef創建CVOpenGLESTextureRef,但是需要從CPU到GPU的緩衝區副本。我試圖避免這種情況。
注意:我嘗試從設置中刪除kCVPixelFormatType_32BGRA。但仍然有相同的錯誤。
謝謝我不知道在iOS上GPU和CPU共享相同的地址空間。 – user1150393