因此,我从网络回调(voip 应用程序)中获取 3 个独立数组中的原始 YUV 数据。据我了解,您无法使用以下命令创建 IOSurface 支持的像素缓冲区CVPixelBufferCreateWithPlanarBytes
根据here
重要提示:您不能使用 CVPixelBufferCreateWithBytes() 或
CVPixelBufferCreateWithPlanarBytes() 与
kCVPixelBufferIOSurfacePropertiesKey。呼唤
CVPixelBufferCreateWithBytes() 或 CVPixelBufferCreateWithPlanarBytes()
将导致 CVPixelBuffer 不受 IOSurface 支持
因此你必须用以下命令创建它CVPixelBufferCreate
,但是如何将数据从回调传输回CVPixelBufferRef
你创造的?
- (void)videoCallBack(uint8_t *yPlane, uint8_t *uPlane, uint8_t *vPlane, size_t width, size_t height, size_t stride yStride,
size_t uStride, size_t vStride)
NSDictionary *pixelAttributes = @{(id)kCVPixelBufferIOSurfacePropertiesKey : @{}};
CVPixelBufferRef pixelBuffer = NULL;
CVReturn result = CVPixelBufferCreate(kCFAllocatorDefault,
width,
height,
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
(__bridge CFDictionaryRef)(pixelAttributes),
&pixelBuffer);
我不确定之后在这里做什么?最终我想将其转换为 CIImage,然后我可以使用 GLKView 来渲染视频。当您创建数据时,人们如何将数据“放入”缓冲区中?