comparison dstep/quartzcore/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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.quartzcore.CVPixelBuffer;
8
9 import dstep.corefoundation.CFArray;
10 import dstep.corefoundation.CFBase;
11 import dstep.corefoundation.CFDictionary;
12 import dstep.corevideo.CVImageBuffer;
13 import dstep.corevideo.CVPixelBuffer;
14 import dstep.objc.bridge.Bridge;
15 import dstep.objc.bridge.TypeEncoding;
16 import dstep.objc.objc;
17
18 //import bindings = dstep.quartzcore.CVPixelBuffer_bindings;
19
20 alias CVImageBufferRef CVPixelBufferRef;
21
22 extern (C)
23 {
24 alias void function (void*, void*, uint, uint, void**) CVPixelBufferReleasePlanarBytesCallback;
25 alias void function (void*, void*) CVPixelBufferReleaseBytesCallback;
26 }
27
28 extern (C)
29 {
30 extern
31 {
32 const CFStringRef kCVPixelBufferPixelFormatTypeKey;
33 const CFStringRef kCVPixelBufferMemoryAllocatorKey;
34 const CFStringRef kCVPixelBufferWidthKey;
35 const CFStringRef kCVPixelBufferHeightKey;
36 const CFStringRef kCVPixelBufferExtendedPixelsLeftKey;
37 const CFStringRef kCVPixelBufferExtendedPixelsTopKey;
38 const CFStringRef kCVPixelBufferExtendedPixelsRightKey;
39 const CFStringRef kCVPixelBufferExtendedPixelsBottomKey;
40 const CFStringRef kCVPixelBufferBytesPerRowAlignmentKey;
41 const CFStringRef kCVPixelBufferCGBitmapContextCompatibilityKey;
42 const CFStringRef kCVPixelBufferCGImageCompatibilityKey;
43 const CFStringRef kCVPixelBufferOpenGLCompatibilityKey;
44 }
45 }
46
47 // This is needed otherwise the enums will fail compiling with gdc
48 version (GNU)
49 {
50 private
51 {
52 const __kCVPixelFormatType_16LE555 = getOSType!("L555");
53 const __kCVPixelFormatType_16LE5551 = getOSType!("5551");
54 const __kCVPixelFormatType_16BE565 = getOSType!("B565");
55 const __kCVPixelFormatType_16LE565 = getOSType!("L565");
56 const __kCVPixelFormatType_24BGR = getOSType!("24BG");
57 const __kCVPixelFormatType_32BGRA = getOSType!("BGRA");
58 const __kCVPixelFormatType_32ABGR = getOSType!("ABGR");
59 const __kCVPixelFormatType_32RGBA = getOSType!("RGBA");
60 const __kCVPixelFormatType_64ARGB = getOSType!("b64a");
61 const __kCVPixelFormatType_48RGB = getOSType!("b48r");
62 const __kCVPixelFormatType_32AlphaGray = getOSType!("b32a");
63 const __kCVPixelFormatType_16Gray = getOSType!("b16g");
64 const __kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy");
65 const __kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408");
66 const __kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408");
67 const __kCVPixelFormatType_444YpCbCr8 = getOSType!("v308");
68 const __kCVPixelFormatType_422YpCbCr16 = getOSType!("v216");
69 const __kCVPixelFormatType_422YpCbCr10 = getOSType!("v210");
70 const __kCVPixelFormatType_444YpCbCr10 = getOSType!("v410");
71 const __kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420");
72 }
73 }
74
75 enum
76 {
77 kCVPixelFormatType_1Monochrome = 0x00000001,
78 kCVPixelFormatType_2Indexed = 0x00000002,
79 kCVPixelFormatType_4Indexed = 0x00000004,
80 kCVPixelFormatType_8Indexed = 0x00000008,
81 kCVPixelFormatType_1IndexedGray_WhiteIsZero = 0x00000021,
82 kCVPixelFormatType_2IndexedGray_WhiteIsZero = 0x00000022,
83 kCVPixelFormatType_4IndexedGray_WhiteIsZero = 0x00000024,
84 kCVPixelFormatType_8IndexedGray_WhiteIsZero = 0x00000028,
85 kCVPixelFormatType_16BE555 = 0x00000010,
86 kCVPixelFormatType_16LE555 = getOSType!("L555"),
87 kCVPixelFormatType_16LE5551 = getOSType!("5551"),
88 kCVPixelFormatType_16BE565 = getOSType!("B565"),
89 kCVPixelFormatType_16LE565 = getOSType!("L565"),
90 kCVPixelFormatType_24RGB = 0x00000018,
91 kCVPixelFormatType_24BGR = getOSType!("24BG"),
92 kCVPixelFormatType_32ARGB = 0x00000020,
93 kCVPixelFormatType_32BGRA = getOSType!("BGRA"),
94 kCVPixelFormatType_32ABGR = getOSType!("ABGR"),
95 kCVPixelFormatType_32RGBA = getOSType!("RGBA"),
96 kCVPixelFormatType_64ARGB = getOSType!("b64a"),
97 kCVPixelFormatType_48RGB = getOSType!("b48r"),
98 kCVPixelFormatType_32AlphaGray = getOSType!("b32a"),
99 kCVPixelFormatType_16Gray = getOSType!("b16g"),
100 kCVPixelFormatType_422YpCbCr8 = getOSType!("2vuy"),
101 kCVPixelFormatType_4444YpCbCrA8 = getOSType!("v408"),
102 kCVPixelFormatType_4444YpCbCrA8R = getOSType!("r408"),
103 kCVPixelFormatType_444YpCbCr8 = getOSType!("v308"),
104 kCVPixelFormatType_422YpCbCr16 = getOSType!("v216"),
105 kCVPixelFormatType_422YpCbCr10 = getOSType!("v210"),
106 kCVPixelFormatType_444YpCbCr10 = getOSType!("v410"),
107 kCVPixelFormatType_420YpCbCr8Planar = getOSType!("y420")
108 }
109
110 struct CVPlanarComponentInfo
111 {
112 int offset;
113 uint rowBytes;
114 }
115
116
117 struct CVPlanarPixelBufferInfo
118 {
119 CVPlanarComponentInfo* componentInfo;
120 }
121
122
123 struct CVPlanarPixelBufferInfo_YCbCrPlanar
124 {
125 CVPlanarComponentInfo componentInfoY;
126 CVPlanarComponentInfo componentInfoCb;
127 CVPlanarComponentInfo componentInfoCr;
128 }
129
130 extern (C)
131 {
132 uint CVPixelBufferGetTypeID ();
133 CVPixelBufferRef CVPixelBufferRetain (CVPixelBufferRef texture);
134 void CVPixelBufferRelease (CVPixelBufferRef texture);
135 int CVPixelBufferCreateResolvedAttributesDictionary (CFAllocatorRef allocator, CFArrayRef attributes, CFDictionaryRef* resolvedDictionaryOut);
136 int CVPixelBufferCreate (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut);
137 int CVPixelBufferCreateWithBytes (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, void* baseAddress, uint bytesPerRow, CVPixelBufferReleaseBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut);
138 int CVPixelBufferCreateWithPlanarBytes (CFAllocatorRef allocator, uint width, uint height, uint pixelFormatType, void* dataPtr, uint dataSize, uint numberOfPlanes, void** planeBaseAddress, size_t* planeWidth, size_t* planeHeight, size_t* planeBytesPerRow, CVPixelBufferReleasePlanarBytesCallback releaseCallback, void* releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef* pixelBufferOut);
139 int CVPixelBufferLockBaseAddress (CVPixelBufferRef pixelBuffer, ulong lockFlags);
140 int CVPixelBufferUnlockBaseAddress (CVPixelBufferRef pixelBuffer, ulong unlockFlags);
141 uint CVPixelBufferGetWidth (CVPixelBufferRef pixelBuffer);
142 uint CVPixelBufferGetHeight (CVPixelBufferRef pixelBuffer);
143 uint CVPixelBufferGetPixelFormatType (CVPixelBufferRef pixelBuffer);
144 void* CVPixelBufferGetBaseAddress (CVPixelBufferRef pixelBuffer);
145 uint CVPixelBufferGetBytesPerRow (CVPixelBufferRef pixelBuffer);
146 uint CVPixelBufferGetDataSize (CVPixelBufferRef pixelBuffer);
147 ubyte CVPixelBufferIsPlanar (CVPixelBufferRef pixelBuffer);
148 uint CVPixelBufferGetPlaneCount (CVPixelBufferRef pixelBuffer);
149 uint CVPixelBufferGetWidthOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex);
150 uint CVPixelBufferGetHeightOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex);
151 void* CVPixelBufferGetBaseAddressOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex);
152 uint CVPixelBufferGetBytesPerRowOfPlane (CVPixelBufferRef pixelBuffer, uint planeIndex);
153 void CVPixelBufferGetExtendedPixels (CVPixelBufferRef pixelBuffer, size_t* extraColumnsOnLeft, size_t* extraColumnsOnRight, size_t* extraRowsOnTop, size_t* extraRowsOnBottom);
154 int CVPixelBufferFillExtendedPixels (CVPixelBufferRef pixelBuffer);
155 }