How to identify & use OSType in Cocoa
In Cocoa/Mac OSX 10.6
OSType IOSurfaceGetPixelFormat(IOSurfaceRef buffer)
returns a type OSType
where can I find some documentation/reference on the supported OSType with regard to the context of this function.
What sort OSType should 开发者_StackOverflowI expect with IOSurfaceGetPixelFormat? do you have any ideas on the various expected values from this function?
From MacTypes.h
:
typedef FourCharCode OSType;
typedef UInt32 FourCharCode;
typedef unsigned long UInt32; //or unsigned int, depending on architecture
Try the pixel format type constants defined in CVPixelBuffer.h in the Core Video framework. That header conditionally includes IOSurface.h; to me, that implies that they're related.
Do keep in mind that IOSurface is little more than a friendly wrapper around shared memory. As such, IOSurfaceGetPixelFormat simply returns whatever was specified when the IOSurface was created, or 0 if no pixel format was specified.
精彩评论