【发布时间】:2015-10-27 16:59:00
【问题描述】:
所以我从网络回调(voip 应用程序)获取了 3 个单独数组中的原始 YUV 数据。据我了解,根据here,您无法使用CVPixelBufferCreateWithPlanarBytes 创建支持IOSurface 的像素缓冲区
重要提示:您不能使用 CVPixelBufferCreateWithBytes() 或 CVPixelBufferCreateWithPlanarBytes() 与 kCVPixelBufferIOSurfacePropertiesKey。打电话 CVPixelBufferCreateWithBytes() 或 CVPixelBufferCreateWithPlanarBytes() 将导致不支持 IOSurface 的 CVPixelBuffers
因此您必须使用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 来渲染视频。人们如何从您创建数据时将数据“放入”缓冲区?
【问题讨论】:
标签: ios objective-c video opengl-es glkit