Mercurial > projects > dstep
view dstep/corevideo/CVPixelBuffer.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Sep 24, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.corevideo.CVPixelBuffer; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.corefoundation.CFDictionary; import dstep.corevideo.CVImageBuffer; import dstep.objc.bridge.TypeEncoding; alias CVImageBufferRef CVPixelBufferRef; extern (C) { alias void function (void*, void*, size_t, size_t, void**) CVPixelBufferReleasePlanarBytesCallback; alias void function (void*, void*) CVPixelBufferReleaseBytesCallback; } extern (C) { extern { const CFStringRef kCVPixelBufferPixelFormatTypeKey; const CFStringRef kCVPixelBufferMemoryAllocatorKey; const CFStringRef kCVPixelBufferWidthKey; const CFStringRef kCVPixelBufferHeightKey; const CFStringRef kCVPixelBufferExtendedPixelsLeftKey; const CFStringRef kCVPixelBufferExtendedPixelsTopKey; const CFStringRef kCVPixelBufferExtendedPixelsRightKey; const CFStringRef kCVPixelBufferExtendedPixelsBottomKey; const CFStringRef kCVPixelBufferBytesPerRowAlignmentKey; const CFStringRef kCVPixelBufferCGBitmapContextCompatibilityKey; const CFStringRef kCVPixelBufferCGImageCompatibilityKey; const CFStringRef kCVPixelBufferOpenGLCompatibilityKey; } } // This is needed otherwise the enums will fail compiling with gdc version (GNU) { private { const __kCVPixelFormatType_16LE555 = getOSType!("L555"); const __kCVPixelFormatType_16LE5551 = getOSType!("5551"); const __kCVPixelFormatType_16BE565 = getOSType!("B565"); const __kCVPixelFormatType_16LE565 = getOSType!("L565"); const __kCVPixelFormatType_24BGR = getOSType!("24BG"); const __kCVPixelFormatType_32BGRA = getOSType!("BGRA"); const __kCVPixelFormatType_32ABGR = getOSType!("ABGR"); const __kCVPixelFormatType_32RGBA = getOSType!("RGBA"); const __kCVPixelFormatType_64ARGB = getOSType!("b64a"); const __kCVPixelFormatType_48RGB = getOSType!("b48r"); const __kCVPixelFormatType_32AlphaGray = getOSType!("b32a"); const __kCVPixelFormatType_16Gray = getOSType!("b16g"); const __kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"); const __kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"); const __kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"); const __kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"); const __kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"); const __kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"); const __kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"); const __kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420"); } } enum { kCVPixelFormatType_1Monochrome = 0x00000001, kCVPixelFormatType_2Indexed = 0x00000002, kCVPixelFormatType_4Indexed = 0x00000004, kCVPixelFormatType_8Indexed = 0x00000008, kCVPixelFormatType_1IndexedGray_WhiteIsZero = 0x00000021, kCVPixelFormatType_2IndexedGray_WhiteIsZero = 0x00000022, kCVPixelFormatType_4IndexedGray_WhiteIsZero = 0x00000024, kCVPixelFormatType_8IndexedGray_WhiteIsZero = 0x00000028, kCVPixelFormatType_16BE555 = 0x00000010, kCVPixelFormatType_16LE555 = getOSType!("L555"), kCVPixelFormatType_16LE5551 = getOSType!("5551"), kCVPixelFormatType_16BE565 = getOSType!("B565"), kCVPixelFormatType_16LE565 = getOSType!("L565"), kCVPixelFormatType_24RGB = 0x00000018, kCVPixelFormatType_24BGR = getOSType!("24BG"), kCVPixelFormatType_32ARGB = 0x00000020, kCVPixelFormatType_32BGRA = getOSType!("BGRA"), kCVPixelFormatType_32ABGR = getOSType!("ABGR"), kCVPixelFormatType_32RGBA = getOSType!("RGBA"), kCVPixelFormatType_64ARGB = getOSType!("b64a"), kCVPixelFormatType_48RGB = getOSType!("b48r"), kCVPixelFormatType_32AlphaGray = getOSType!("b32a"), kCVPixelFormatType_16Gray = getOSType!("b16g"), kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"), kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"), kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"), kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"), kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"), kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"), kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"), kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420") } struct CVPlanarComponentInfo { int offset; uint rowBytes; } struct CVPlanarPixelBufferInfo { CVPlanarComponentInfo* componentInfo; } struct CVPlanarPixelBufferInfo_YCbCrPlanar { CVPlanarComponentInfo componentInfoY; CVPlanarComponentInfo componentInfoCb; CVPlanarComponentInfo componentInfoCr; } extern (C) { uint CVPixelBufferGetTypeID (); CVPixelBufferRef CVPixelBufferRetain (CVPixelBufferRef texture); void CVPixelBufferRelease (CVPixelBufferRef texture); int CVPixelBufferCreateResolvedAttributesDictionary (CFAllocatorRef allocator, CFArrayRef attributes, CFDictionaryRef* resolvedDictionaryOut); int CVPixelBufferCreate (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); int CVPixelBufferCreateWithBytes (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, void* baseAddress, size_t bytesPerRow, CVPixelBufferReleaseBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); int CVPixelBufferCreateWithPlanarBytes (CFAllocatorRef allocator, size_t width, size_t height, uint pixelFormatType, void* dataPtr, size_t dataSize, size_t numberOfPlanes, void** planeBaseAddress, size_t* planeWidth, size_t* planeHeight, size_t* planeBytesPerRow, CVPixelBufferReleasePlanarBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut); int CVPixelBufferLockBaseAddress (CVPixelBufferRef pixelBuffer, ulong lockFlags); int CVPixelBufferUnlockBaseAddress (CVPixelBufferRef pixelBuffer, ulong unlockFlags); size_t CVPixelBufferGetWidth (CVPixelBufferRef pixelBuffer); size_t CVPixelBufferGetHeight (CVPixelBufferRef pixelBuffer); uint CVPixelBufferGetPixelFormatType (CVPixelBufferRef pixelBuffer); void* CVPixelBufferGetBaseAddress (CVPixelBufferRef pixelBuffer); size_t CVPixelBufferGetBytesPerRow (CVPixelBufferRef pixelBuffer); size_t CVPixelBufferGetDataSize (CVPixelBufferRef pixelBuffer); ubyte CVPixelBufferIsPlanar (CVPixelBufferRef pixelBuffer); size_t CVPixelBufferGetPlaneCount (CVPixelBufferRef pixelBuffer); size_t CVPixelBufferGetWidthOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); size_t CVPixelBufferGetHeightOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); void* CVPixelBufferGetBaseAddressOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); size_t CVPixelBufferGetBytesPerRowOfPlane (CVPixelBufferRef pixelBuffer, size_t planeIndex); void CVPixelBufferGetExtendedPixels (CVPixelBufferRef pixelBuffer, size_t* extraColumnsOnLeft, size_t* extraColumnsOnRight, size_t* extraRowsOnTop, size_t* extraRowsOnBottom); int CVPixelBufferFillExtendedPixels (CVPixelBufferRef pixelBuffer); }