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