comparison dstep/qtkit/QTCaptureDevice.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 b9de51448c6b
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 28, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.qtkit.QTCaptureDevice;
8
9 import dstep.foundation.Foundation;
10 import dstep.objc.bridge.Bridge;
11 import dstep.objc.objc;
12 import dstep.qtkit.QTKitDefines;
13
14 import bindings = dstep.qtkit.QTCaptureDevice_bindings;
15
16 alias NSUInteger QTCaptureDeviceAVCTransportControlsPlaybackMode;
17 alias NSInteger QTCaptureDeviceAVCTransportControlsSpeed;
18
19 private
20 {
21 NSString QTCaptureDeviceWasConnectedNotification_;
22 NSString QTCaptureDeviceWasDisconnectedNotification_;
23 NSString QTCaptureDeviceFormatDescriptionsWillChangeNotification_;
24 NSString QTCaptureDeviceFormatDescriptionsDidChangeNotification_;
25 NSString QTCaptureDeviceAttributeWillChangeNotification_;
26 NSString QTCaptureDeviceAttributeDidChangeNotification_;
27 NSString QTCaptureDeviceChangedAttributeKey_;
28 NSString QTCaptureDeviceSuspendedAttribute_;
29 NSString QTCaptureDeviceLinkedDevicesAttribute_;
30 NSString QTCaptureDeviceAvailableInputSourcesAttribute_;
31 NSString QTCaptureDeviceInputSourceIdentifierAttribute_;
32 NSString QTCaptureDeviceInputSourceIdentifierKey_;
33 NSString QTCaptureDeviceInputSourceLocalizedDisplayNameKey_;
34 NSString QTCaptureDeviceAVCTransportControlsAttribute_;
35 NSString QTCaptureDeviceAVCTransportControlsPlaybackModeKey_;
36 NSString QTCaptureDeviceAVCTransportControlsSpeedKey_;
37 }
38
39 NSString QTCaptureDeviceWasConnectedNotification ()
40 {
41 if (QTCaptureDeviceWasConnectedNotification_)
42 return QTCaptureDeviceWasConnectedNotification_;
43
44 return QTCaptureDeviceWasConnectedNotification_ = new NSString(bindings.QTCaptureDeviceWasConnectedNotification);
45 }
46
47 NSString QTCaptureDeviceWasDisconnectedNotification ()
48 {
49 if (QTCaptureDeviceWasDisconnectedNotification_)
50 return QTCaptureDeviceWasDisconnectedNotification_;
51
52 return QTCaptureDeviceWasDisconnectedNotification_ = new NSString(bindings.QTCaptureDeviceWasDisconnectedNotification);
53 }
54
55 NSString QTCaptureDeviceFormatDescriptionsWillChangeNotification ()
56 {
57 if (QTCaptureDeviceFormatDescriptionsWillChangeNotification_)
58 return QTCaptureDeviceFormatDescriptionsWillChangeNotification_;
59
60 return QTCaptureDeviceFormatDescriptionsWillChangeNotification_ = new NSString(bindings.QTCaptureDeviceFormatDescriptionsWillChangeNotification);
61 }
62
63 NSString QTCaptureDeviceFormatDescriptionsDidChangeNotification ()
64 {
65 if (QTCaptureDeviceFormatDescriptionsDidChangeNotification_)
66 return QTCaptureDeviceFormatDescriptionsDidChangeNotification_;
67
68 return QTCaptureDeviceFormatDescriptionsDidChangeNotification_ = new NSString(bindings.QTCaptureDeviceFormatDescriptionsDidChangeNotification);
69 }
70
71 NSString QTCaptureDeviceAttributeWillChangeNotification ()
72 {
73 if (QTCaptureDeviceAttributeWillChangeNotification_)
74 return QTCaptureDeviceAttributeWillChangeNotification_;
75
76 return QTCaptureDeviceAttributeWillChangeNotification_ = new NSString(bindings.QTCaptureDeviceAttributeWillChangeNotification);
77 }
78
79 NSString QTCaptureDeviceAttributeDidChangeNotification ()
80 {
81 if (QTCaptureDeviceAttributeDidChangeNotification_)
82 return QTCaptureDeviceAttributeDidChangeNotification_;
83
84 return QTCaptureDeviceAttributeDidChangeNotification_ = new NSString(bindings.QTCaptureDeviceAttributeDidChangeNotification);
85 }
86
87 NSString QTCaptureDeviceChangedAttributeKey ()
88 {
89 if (QTCaptureDeviceChangedAttributeKey_)
90 return QTCaptureDeviceChangedAttributeKey_;
91
92 return QTCaptureDeviceChangedAttributeKey_ = new NSString(bindings.QTCaptureDeviceChangedAttributeKey);
93 }
94
95 NSString QTCaptureDeviceSuspendedAttribute ()
96 {
97 if (QTCaptureDeviceSuspendedAttribute_)
98 return QTCaptureDeviceSuspendedAttribute_;
99
100 return QTCaptureDeviceSuspendedAttribute_ = new NSString(bindings.QTCaptureDeviceSuspendedAttribute);
101 }
102
103 NSString QTCaptureDeviceLinkedDevicesAttribute ()
104 {
105 if (QTCaptureDeviceLinkedDevicesAttribute_)
106 return QTCaptureDeviceLinkedDevicesAttribute_;
107
108 return QTCaptureDeviceLinkedDevicesAttribute_ = new NSString(bindings.QTCaptureDeviceLinkedDevicesAttribute);
109 }
110
111 NSString QTCaptureDeviceAvailableInputSourcesAttribute ()
112 {
113 if (QTCaptureDeviceAvailableInputSourcesAttribute_)
114 return QTCaptureDeviceAvailableInputSourcesAttribute_;
115
116 return QTCaptureDeviceAvailableInputSourcesAttribute_ = new NSString(bindings.QTCaptureDeviceAvailableInputSourcesAttribute);
117 }
118
119 NSString QTCaptureDeviceInputSourceIdentifierAttribute ()
120 {
121 if (QTCaptureDeviceInputSourceIdentifierAttribute_)
122 return QTCaptureDeviceInputSourceIdentifierAttribute_;
123
124 return QTCaptureDeviceInputSourceIdentifierAttribute_ = new NSString(bindings.QTCaptureDeviceInputSourceIdentifierAttribute);
125 }
126
127 NSString QTCaptureDeviceInputSourceIdentifierKey ()
128 {
129 if (QTCaptureDeviceInputSourceIdentifierKey_)
130 return QTCaptureDeviceInputSourceIdentifierKey_;
131
132 return QTCaptureDeviceInputSourceIdentifierKey_ = new NSString(bindings.QTCaptureDeviceInputSourceIdentifierKey);
133 }
134
135 NSString QTCaptureDeviceInputSourceLocalizedDisplayNameKey ()
136 {
137 if (QTCaptureDeviceInputSourceLocalizedDisplayNameKey_)
138 return QTCaptureDeviceInputSourceLocalizedDisplayNameKey_;
139
140 return QTCaptureDeviceInputSourceLocalizedDisplayNameKey_ = new NSString(bindings.QTCaptureDeviceInputSourceLocalizedDisplayNameKey);
141 }
142
143 NSString QTCaptureDeviceAVCTransportControlsAttribute ()
144 {
145 if (QTCaptureDeviceAVCTransportControlsAttribute_)
146 return QTCaptureDeviceAVCTransportControlsAttribute_;
147
148 return QTCaptureDeviceAVCTransportControlsAttribute_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsAttribute);
149 }
150
151 NSString QTCaptureDeviceAVCTransportControlsPlaybackModeKey ()
152 {
153 if (QTCaptureDeviceAVCTransportControlsPlaybackModeKey_)
154 return QTCaptureDeviceAVCTransportControlsPlaybackModeKey_;
155
156 return QTCaptureDeviceAVCTransportControlsPlaybackModeKey_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsPlaybackModeKey);
157 }
158
159 NSString QTCaptureDeviceAVCTransportControlsSpeedKey ()
160 {
161 if (QTCaptureDeviceAVCTransportControlsSpeedKey_)
162 return QTCaptureDeviceAVCTransportControlsSpeedKey_;
163
164 return QTCaptureDeviceAVCTransportControlsSpeedKey_ = new NSString(bindings.QTCaptureDeviceAVCTransportControlsSpeedKey);
165 }
166
167 enum
168 {
169 QTCaptureDeviceAVCTransportControlsNotPlayingMode = 0,
170 QTCaptureDeviceAVCTransportControlsPlayingMode = 1
171 }
172
173 enum
174 {
175 QTCaptureDeviceAVCTransportControlsFastestReverseSpeed = -19000,
176 QTCaptureDeviceAVCTransportControlsVeryFastReverseSpeed = -16000,
177 QTCaptureDeviceAVCTransportControlsFastReverseSpeed = -13000,
178 QTCaptureDeviceAVCTransportControlsNormalReverseSpeed = -10000,
179 QTCaptureDeviceAVCTransportControlsSlowReverseSpeed = -7000,
180 QTCaptureDeviceAVCTransportControlsVerySlowReverseSpeed = -4000,
181 QTCaptureDeviceAVCTransportControlsSlowestReverseSpeed = -1000,
182 QTCaptureDeviceAVCTransportControlsStoppedSpeed = 0,
183 QTCaptureDeviceAVCTransportControlsSlowestForwardSpeed = 1000,
184 QTCaptureDeviceAVCTransportControlsVerySlowForwardSpeed = 4000,
185 QTCaptureDeviceAVCTransportControlsSlowForwardSpeed = 7000,
186 QTCaptureDeviceAVCTransportControlsNormalForwardSpeed = 10000,
187 QTCaptureDeviceAVCTransportControlsFastForwardSpeed = 13000,
188 QTCaptureDeviceAVCTransportControlsVeryFastForwardSpeed = 16000,
189 QTCaptureDeviceAVCTransportControlsFastestForwardSpeed = 19000
190 }
191
192 class QTCaptureDevice : NSObject, INSCoding
193 {
194 mixin (ObjcWrap);
195
196 static NSArray inputDevices ()
197 {
198 return invokeObjcSelfClass!(NSArray, "inputDevices");
199 }
200
201 static NSArray inputDevicesWithMediaType (NSString mediaType)
202 {
203 return invokeObjcSelfClass!(NSArray, "inputDevicesWithMediaType:", NSString)(mediaType);
204 }
205
206 static QTCaptureDevice defaultInputDeviceWithMediaType (NSString mediaType)
207 {
208 return invokeObjcSelfClass!(QTCaptureDevice, "defaultInputDeviceWithMediaType:", NSString)(mediaType);
209 }
210
211 static QTCaptureDevice deviceWithUniqueID (NSString deviceUniqueID)
212 {
213 return invokeObjcSelfClass!(QTCaptureDevice, "deviceWithUniqueID:", NSString)(deviceUniqueID);
214 }
215
216 NSString uniqueID ()
217 {
218 return invokeObjcSelf!(NSString, "uniqueID");
219 }
220
221 NSString modelUniqueID ()
222 {
223 return invokeObjcSelf!(NSString, "modelUniqueID");
224 }
225
226 NSString localizedDisplayName ()
227 {
228 return invokeObjcSelf!(NSString, "localizedDisplayName");
229 }
230
231 NSArray formatDescriptions ()
232 {
233 return invokeObjcSelf!(NSArray, "formatDescriptions");
234 }
235
236 bool hasMediaType (NSString mediaType)
237 {
238 return invokeObjcSelf!(bool, "hasMediaType:", NSString)(mediaType);
239 }
240
241 NSDictionary deviceAttributes ()
242 {
243 return invokeObjcSelf!(NSDictionary, "deviceAttributes");
244 }
245
246 void setDeviceAttributes (NSDictionary deviceAttributes)
247 {
248 return invokeObjcSelf!(void, "setDeviceAttributes:", NSDictionary)(deviceAttributes);
249 }
250
251 bool attributeIsReadOnly (NSString attributeKey)
252 {
253 return invokeObjcSelf!(bool, "attributeIsReadOnly:", NSString)(attributeKey);
254 }
255
256 Object attributeForKey (NSString attributeKey)
257 {
258 return invokeObjcSelf!(Object, "attributeForKey:", NSString)(attributeKey);
259 }
260
261 void setAttribute (Object attribute, NSString attributeKey)
262 {
263 return invokeObjcSelf!(void, "setAttribute:forKey:", Object, NSString)(attribute, attributeKey);
264 }
265
266 bool isConnected ()
267 {
268 return invokeObjcSelf!(bool, "isConnected");
269 }
270
271 bool isInUseByAnotherApplication ()
272 {
273 return invokeObjcSelf!(bool, "isInUseByAnotherApplication");
274 }
275
276 bool isOpen ()
277 {
278 return invokeObjcSelf!(bool, "isOpen");
279 }
280
281 bool open (ref NSError errorPtr)
282 {
283 id error;
284
285 if (errorPtr)
286 error = errorPtr.objcObject;
287
288 bool result = invokeObjcSelf!(bool, "open:", id*)(&error);
289
290 if (error)
291 errorPtr = new NSError(error);
292
293 return result;
294 }
295
296 void close ()
297 {
298 return invokeObjcSelf!(void, "close");
299 }
300
301 void encodeWithCoder (NSCoder aCoder)
302 {
303 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
304 }
305
306 QTCaptureDevice initWithCoder (NSCoder aDecoder)
307 {
308 return invokeObjcSelf!(QTCaptureDevice, "initWithCoder:", NSCoder)(aDecoder);
309 }
310 }