I am creating a pixel buffer using QTPixelBufferContextCreate with the native size for current movie. Then opening the movie on the context and cue to required frame, checking using QTVisualContextIsNewImageAvailable. Then calling QTVisualContextCopyImageForTime to readback the frame for further cpu based image processing.
This has all been working fine for all movie resolutions using k32ARGBPixelFormat or k422YpCbCr8CodecType as the kCVPixelBufferPixelFormatTypeKey.
Now I switch the kCVPixelBufferPixelFormatTypeKey to k422YpCbCr10CodecType or k64ARGBPixelFormat and QTVisualContextCopyImageForTime fails for certain larger movie resolutions. The QTPixelBufferContextCreate works and QTVisualContextIsNewImageAvailable says there is a frame available.
Decoding movies less than 1280 wide is all OK (720, 960, 1216 etc).
When decoding wider movies like 1280 or 1920 QTVisualContextCopyImageForTime returns -6683 or kCVReturnPixelBufferNotOpenGLCo开发者_JAVA技巧mpatible The header file says 'The pixel buffer is not compatible with OpenGL due to an unsupported buffer size, pixel format, or attribute' I'm using Core Image Pixel Buffers rather than OpenGL textures so OpenGL should not be involved.
Reverting to k32ARGBPixelFormat and all works again. When calling QTPixelBufferContextCreate I can include or exclude kCVPixelBufferWidthKey and kCVPixelBufferHeightKey and it makes no difference. I want native unscaled size to be returned and the source movies are 10bit uncompressed or ProRes and again this doesn't change the result.
So it appears to be a combination of wider movies and the deeper Pixel formats causing the failure.
Any ideas would be much appreciated as all is working with SD movies, it was just when testing with HD movies that I discovered the problem.
Thanks,
Adam
精彩评论