|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <stdio.h> |
|
19 #include <string.h> |
|
20 #include <gst.h> |
|
21 #include <photography.h> |
|
22 #include "xaglobals.h" |
|
23 #include "xastaticcameracapsadaptation.h" |
|
24 #include "xaadptbasectx.h" |
|
25 |
|
26 #define XACAMERAIMPL_DEFAULT_MAX_ZOOM 16000 /* 16x */ |
|
27 #define XACAMERAIMPL_DEFAULT_MAX_ISO 1600 |
|
28 #define XACAMERAIMPL_DEFAULT_MIN_ISO 200 |
|
29 #define XACAMERAIMPL_DEFAULT_MAX_APERTURE 3200 /* f/32 */ |
|
30 #define XACAMERAIMPL_DEFAULT_MIN_APERTURE 75 /* f/0.75 */ |
|
31 |
|
32 static XAStaticCameraCapsData allCameraCaps[] = |
|
33 { |
|
34 #ifdef XA_USE_TEST_PLUGINS |
|
35 { XA_ADAPTID_VIDEOTESTSRC, { (XAchar*)"videotestsrc", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } |
|
36 #else |
|
37 { XA_ADAPTID_V4L2SRC, { (XAchar*)"v4l2src", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } |
|
38 #endif |
|
39 }; |
|
40 |
|
41 /*forward declaration*/ |
|
42 XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID); |
|
43 |
|
44 /* |
|
45 * void XAStaticCameraCaps_Init() |
|
46 */ |
|
47 void XAStaticCameraCaps_Init() |
|
48 { |
|
49 GstElement* element=NULL; |
|
50 GstPhotoCaps photoCaps = GST_PHOTOGRAPHY_CAPS_NONE; |
|
51 GError* gerror=NULL; |
|
52 guint32 i=0; |
|
53 guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); |
|
54 gboolean detected = FALSE; |
|
55 |
|
56 |
|
57 if ( !gst_init_check( NULL, NULL, &gerror ) ) |
|
58 { |
|
59 DEBUG_ERR("Gst Initalization failure."); |
|
60 return; |
|
61 } |
|
62 for(i=0;i<numDevices;i++) |
|
63 { |
|
64 /*init values*/ |
|
65 allCameraCaps[i].XAcaps.orientation = XA_ORIENTATION_UNKNOWN; |
|
66 allCameraCaps[i].XAcaps.featuresSupported = 0; |
|
67 allCameraCaps[i].XAcaps.exposureModesSupported = 0; |
|
68 allCameraCaps[i].XAcaps.flashModesSupported = 0; |
|
69 allCameraCaps[i].XAcaps.focusModesSupported = 0; |
|
70 allCameraCaps[i].XAcaps.meteringModesSupported = 0; |
|
71 allCameraCaps[i].XAcaps.whiteBalanceModesSupported = 0; |
|
72 allCameraCaps[i].XAcaps.maxWidth = 0; |
|
73 allCameraCaps[i].XAcaps.maxHeight = 0; |
|
74 |
|
75 element = gst_element_factory_make((char*)allCameraCaps[i].XAcaps.name,NULL); |
|
76 if(element) |
|
77 { |
|
78 GstPad* srcPad = gst_element_get_static_pad( element, "src"); |
|
79 if (srcPad) |
|
80 { |
|
81 guint32 j = 0, cnt = 0, width = 0, height = 0; |
|
82 GstCaps* srcCaps = gst_pad_get_caps( srcPad ); |
|
83 |
|
84 /* search caps for absolute maximum values */ |
|
85 if(srcCaps) |
|
86 { |
|
87 cnt = gst_caps_get_size( srcCaps ); |
|
88 for( j = 0; j < cnt; j++ ) |
|
89 { |
|
90 G_CONST_RETURN GValue* value = NULL; |
|
91 GstStructure* capsStruct = gst_caps_get_structure( srcCaps, j ); |
|
92 |
|
93 if(capsStruct) |
|
94 { |
|
95 value = gst_structure_get_value( capsStruct, "width" ); |
|
96 if (GST_VALUE_HOLDS_INT_RANGE(value)) |
|
97 { |
|
98 detected = TRUE; |
|
99 width = gst_value_get_int_range_max( value ); |
|
100 if(width > allCameraCaps[i].XAcaps.maxWidth) |
|
101 { |
|
102 allCameraCaps[i].XAcaps.maxWidth = width; |
|
103 } |
|
104 } |
|
105 |
|
106 value = gst_structure_get_value( capsStruct, "height" ); |
|
107 if (GST_VALUE_HOLDS_INT_RANGE(value)) |
|
108 { |
|
109 detected = TRUE; |
|
110 height = gst_value_get_int_range_max( value ); |
|
111 if(height > allCameraCaps[i].XAcaps.maxHeight) |
|
112 { |
|
113 allCameraCaps[i].XAcaps.maxHeight = height; |
|
114 } |
|
115 } |
|
116 } |
|
117 } |
|
118 } |
|
119 } |
|
120 |
|
121 if(!detected) |
|
122 { |
|
123 DEBUG_ERR("Warn: could not get maxWidth and maxHeight from GST!!"); |
|
124 allCameraCaps[i].XAcaps.maxWidth = 0x7FFFFFFF; |
|
125 allCameraCaps[i].XAcaps.maxHeight = 0x7FFFFFFF; |
|
126 } |
|
127 |
|
128 if(GST_IS_PHOTOGRAPHY(element)) |
|
129 { |
|
130 photoCaps = gst_photography_get_capabilities(GST_PHOTOGRAPHY(element)); |
|
131 if( photoCaps & GST_PHOTOGRAPHY_CAPS_FLASH ) |
|
132 { |
|
133 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_FLASH; |
|
134 allCameraCaps[i].XAcaps.flashModesSupported = XA_CAMERA_FLASHMODE_OFF | |
|
135 XA_CAMERA_FLASHMODE_ON | |
|
136 XA_CAMERA_FLASHMODE_AUTO | |
|
137 XA_CAMERA_FLASHMODE_REDEYEREDUCTION | |
|
138 XA_CAMERA_FLASHMODE_FILLIN; |
|
139 } |
|
140 if( photoCaps & GST_PHOTOGRAPHY_CAPS_FOCUS ) |
|
141 { |
|
142 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOFOCUS; |
|
143 allCameraCaps[i].XAcaps.focusModesSupported = XA_CAMERA_FOCUSMODE_AUTO; |
|
144 } |
|
145 if( photoCaps & GST_PHOTOGRAPHY_CAPS_EXPOSURE ) |
|
146 { |
|
147 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALEXPOSURE; |
|
148 allCameraCaps[i].XAcaps.exposureModesSupported = XA_CAMERA_EXPOSUREMODE_AUTO | |
|
149 XA_CAMERA_EXPOSUREMODE_PORTRAIT | |
|
150 XA_CAMERA_EXPOSUREMODE_SPORTS | |
|
151 XA_CAMERA_EXPOSUREMODE_NIGHT; |
|
152 } |
|
153 |
|
154 if( photoCaps & GST_PHOTOGRAPHY_CAPS_ISO_SPEED ) |
|
155 { |
|
156 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALISOSENSITIVITY; |
|
157 } |
|
158 if( photoCaps & GST_PHOTOGRAPHY_CAPS_APERTURE ) |
|
159 { |
|
160 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALAPERTURE; |
|
161 } |
|
162 if( photoCaps & GST_PHOTOGRAPHY_CAPS_WB_MODE ) |
|
163 { |
|
164 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOWHITEBALANCE; |
|
165 allCameraCaps[i].XAcaps.whiteBalanceModesSupported = XA_CAMERA_WHITEBALANCEMODE_AUTO | |
|
166 XA_CAMERA_WHITEBALANCEMODE_SUNLIGHT | |
|
167 XA_CAMERA_WHITEBALANCEMODE_CLOUDY | |
|
168 XA_CAMERA_WHITEBALANCEMODE_TUNGSTEN | |
|
169 XA_CAMERA_WHITEBALANCEMODE_FLUORESCENT | |
|
170 XA_CAMERA_WHITEBALANCEMODE_SUNSET; |
|
171 } |
|
172 if( photoCaps & GST_PHOTOGRAPHY_CAPS_ZOOM ) |
|
173 { |
|
174 allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_DIGITALZOOM; |
|
175 } |
|
176 } |
|
177 } |
|
178 } |
|
179 } |
|
180 |
|
181 /* |
|
182 * XAresult XAStaticCameraCaps_GetCameraCapabilities( |
|
183 * XAuint32* pIndex, |
|
184 * XAuint32* pCameraDeviceID, |
|
185 * XACameraDescriptor* pDescriptor) |
|
186 * |
|
187 */ |
|
188 XAresult XAStaticCameraCaps_GetCameraCapabilities( |
|
189 XAuint32* pIndex, |
|
190 XAuint32* pCameraDeviceID, |
|
191 XACameraDescriptor* pDescriptor) |
|
192 { |
|
193 guint32 idx = 0; |
|
194 guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); |
|
195 |
|
196 if(!pDescriptor) |
|
197 { |
|
198 if(pIndex) /* query number of devices */ |
|
199 { |
|
200 *pIndex = numDevices; |
|
201 DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); |
|
202 return XA_RESULT_SUCCESS; |
|
203 } |
|
204 else |
|
205 { |
|
206 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
207 DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); |
|
208 return XA_RESULT_PARAMETER_INVALID; |
|
209 } |
|
210 } |
|
211 |
|
212 if( !pIndex && pCameraDeviceID ) |
|
213 { |
|
214 /* get index from ID */ |
|
215 idx = XAStaticCameraCaps_IdxFromId(*pCameraDeviceID); |
|
216 } |
|
217 else if( pIndex && pCameraDeviceID ) |
|
218 { |
|
219 idx = *pIndex; |
|
220 } |
|
221 else |
|
222 { |
|
223 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
224 DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); |
|
225 return XA_RESULT_PARAMETER_INVALID; |
|
226 } |
|
227 |
|
228 if( idx >= numDevices ) |
|
229 { |
|
230 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
231 DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); |
|
232 return XA_RESULT_PARAMETER_INVALID; |
|
233 } |
|
234 else |
|
235 { |
|
236 /*fill capabilities*/ |
|
237 memcpy(pDescriptor, &allCameraCaps[idx].XAcaps, sizeof(XACameraDescriptor) ); |
|
238 *pCameraDeviceID = allCameraCaps[idx].deviceID; |
|
239 } |
|
240 |
|
241 DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); |
|
242 return XA_RESULT_SUCCESS; |
|
243 } |
|
244 |
|
245 /* |
|
246 * XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( |
|
247 * XAuint32 cameraDeviceID, |
|
248 * XAuint32* pPatternID, |
|
249 * XAuint32* pFocusPattern, |
|
250 * XAuint32* pCustomPoints1, |
|
251 * XAuint32* pCustomPoints2) |
|
252 */ |
|
253 XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( |
|
254 XAuint32 cameraDeviceID, |
|
255 XAuint32* pPatternID, |
|
256 XAuint32* pFocusPattern, |
|
257 XAuint32* pCustomPoints1, |
|
258 XAuint32* pCustomPoints2) |
|
259 { |
|
260 DEBUG_API("->XAStaticCameraCaps_QueryFocusRegionPatterns"); |
|
261 if( !pFocusPattern ) |
|
262 { /* return number of focus patterns */ |
|
263 if(!pPatternID) |
|
264 { |
|
265 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
266 DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); |
|
267 return XA_RESULT_PARAMETER_INVALID; |
|
268 } |
|
269 /* no support in GST */ |
|
270 DEBUG_INFO("No support in gst"); |
|
271 *pPatternID = 0; |
|
272 } |
|
273 else |
|
274 { |
|
275 if( !(pFocusPattern&&pCustomPoints1&&pCustomPoints2) ) |
|
276 { |
|
277 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
278 DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); |
|
279 return XA_RESULT_PARAMETER_INVALID; |
|
280 } |
|
281 DEBUG_INFO("No support in gst"); |
|
282 *pFocusPattern = 0; |
|
283 *pCustomPoints1 = 0; |
|
284 *pCustomPoints2 = 0; |
|
285 /*no focus patterns, index always out of range*/ |
|
286 DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); |
|
287 return XA_RESULT_PARAMETER_INVALID; |
|
288 } |
|
289 |
|
290 DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); |
|
291 return XA_RESULT_SUCCESS; |
|
292 } |
|
293 |
|
294 /* |
|
295 * XAresult XAStaticCameraCaps_GetSupportedAutoLocks( |
|
296 * XAuint32 cameraDeviceID, |
|
297 * XAuint32* pNumCombinations, |
|
298 * XAuint32** ppLocks) |
|
299 */ |
|
300 XAresult XAStaticCameraCaps_GetSupportedAutoLocks( |
|
301 XAuint32 cameraDeviceID, |
|
302 XAuint32* pNumCombinations, |
|
303 XAuint32** ppLocks) |
|
304 { |
|
305 DEBUG_API("->XAStaticCameraCaps_GetSupportedAutoLocks"); |
|
306 /* No support in gst. |
|
307 * Spec: "If no settings are supported, |
|
308 * this method returns XA_RESULT_FEATURE_UNSUPPORTED." |
|
309 **/ |
|
310 DEBUG_INFO("No support in gst"); |
|
311 if(pNumCombinations) |
|
312 { |
|
313 *pNumCombinations = 0; |
|
314 } |
|
315 DEBUG_API("<-XAStaticCameraCaps_GetSupportedAutoLocks"); |
|
316 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
317 } |
|
318 |
|
319 /* |
|
320 * XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( |
|
321 * XAuint32 cameraDeviceID, |
|
322 * XAboolean macroEnabled, |
|
323 * XAmillimeter* pMinValue, |
|
324 * XAmillimeter* pMaxValue, |
|
325 * XAuint32* pNumSettings, |
|
326 * XAmillimeter** ppSettings) |
|
327 */ |
|
328 XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( |
|
329 XAuint32 cameraDeviceID, |
|
330 XAboolean macroEnabled, |
|
331 XAmillimeter* pMinValue, |
|
332 XAmillimeter* pMaxValue, |
|
333 XAuint32* pNumSettings, |
|
334 XAmillimeter** ppSettings) |
|
335 { |
|
336 DEBUG_API("->XAStaticCameraCaps_GetSupportedFocusManualSettings"); |
|
337 /* No support in gst. |
|
338 * Spec: "If no settings are supported, |
|
339 * this method returns XA_RESULT_FEATURE_UNSUPPORTED." |
|
340 **/ |
|
341 DEBUG_INFO("No support in gst"); |
|
342 if(pNumSettings) |
|
343 { |
|
344 *pNumSettings = 0; |
|
345 } |
|
346 DEBUG_API("<-XAStaticCameraCaps_GetSupportedFocusManualSettings"); |
|
347 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
348 } |
|
349 |
|
350 /* |
|
351 * XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( |
|
352 * XAuint32 cameraDeviceID, |
|
353 * XAuint32* pMinValue, |
|
354 * XAuint32* pMaxValue, |
|
355 * XAuint32* pNumSettings, |
|
356 * XAuint32** ppSettings) |
|
357 */ |
|
358 XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( |
|
359 XAuint32 cameraDeviceID, |
|
360 XAuint32* pMinValue, |
|
361 XAuint32* pMaxValue, |
|
362 XAuint32* pNumSettings, |
|
363 XAuint32** ppSettings) |
|
364 { |
|
365 DEBUG_API("->XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); |
|
366 if( !pNumSettings ) |
|
367 { |
|
368 return XA_RESULT_PARAMETER_INVALID; |
|
369 } |
|
370 if( !ppSettings ) |
|
371 { |
|
372 /* no items in ppSettings array*/ |
|
373 *pNumSettings = 0; |
|
374 } |
|
375 else |
|
376 { |
|
377 if( !(pMinValue && pMaxValue) ) |
|
378 { |
|
379 DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); |
|
380 return XA_RESULT_PARAMETER_INVALID; |
|
381 } |
|
382 /* continuous range */ |
|
383 *pNumSettings = 0; |
|
384 /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ |
|
385 *pMinValue = XACAMERAIMPL_DEFAULT_MIN_ISO; |
|
386 *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ISO; |
|
387 } |
|
388 DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); |
|
389 return XA_RESULT_SUCCESS; |
|
390 } |
|
391 |
|
392 /* |
|
393 * XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( |
|
394 * XAuint32 cameraDeviceID, |
|
395 * XAuint32* pMinValue, |
|
396 * XAuint32* pMaxValue, |
|
397 * XAuint32* pNumSettings, |
|
398 * XAuint32** ppSettings) |
|
399 */ |
|
400 XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( |
|
401 XAuint32 cameraDeviceID, |
|
402 XAuint32* pMinValue, |
|
403 XAuint32* pMaxValue, |
|
404 XAuint32* pNumSettings, |
|
405 XAuint32** ppSettings) |
|
406 { |
|
407 DEBUG_API("->XAStaticCameraCaps_GetSupportedApertureManualSettings"); |
|
408 if( !pNumSettings ) |
|
409 { |
|
410 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
411 DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); |
|
412 return XA_RESULT_PARAMETER_INVALID; |
|
413 } |
|
414 if( !ppSettings ) |
|
415 { |
|
416 /* no items in ppSettings array*/ |
|
417 *pNumSettings = 0; |
|
418 } |
|
419 else |
|
420 { |
|
421 /* continuous range */ |
|
422 *pNumSettings = 0; |
|
423 /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ |
|
424 *pMinValue = XACAMERAIMPL_DEFAULT_MIN_APERTURE; |
|
425 *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_APERTURE; |
|
426 } |
|
427 DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); |
|
428 return XA_RESULT_SUCCESS; |
|
429 } |
|
430 |
|
431 /* |
|
432 * XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( |
|
433 * XAuint32 cameraDeviceID, |
|
434 * XAmicrosecond* pMinValue, |
|
435 * XAmicrosecond* pMaxValue, |
|
436 * XAuint32* pNumSettings, |
|
437 * XAmicrosecond** ppSettings) |
|
438 */ |
|
439 XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( |
|
440 XAuint32 cameraDeviceID, |
|
441 XAmicrosecond* pMinValue, |
|
442 XAmicrosecond* pMaxValue, |
|
443 XAuint32* pNumSettings, |
|
444 XAmicrosecond** ppSettings) |
|
445 { |
|
446 DEBUG_API("->XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); |
|
447 /* No support in gst. |
|
448 * Spec: "If no settings are supported, |
|
449 * this method returns XA_RESULT_FEATURE_UNSUPPORTED." |
|
450 **/ |
|
451 DEBUG_INFO("No support in gst"); |
|
452 if(pNumSettings) |
|
453 { |
|
454 *pNumSettings = 0; |
|
455 } |
|
456 DEBUG_API("<-XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); |
|
457 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
458 } |
|
459 |
|
460 /* |
|
461 * XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( |
|
462 * XAuint32 cameraDeviceID, |
|
463 * XAuint32* pMinValue, |
|
464 * XAuint32* pMaxValue, |
|
465 * XAuint32* pNumSettings, |
|
466 * XAuint32** ppSettings) |
|
467 */ |
|
468 XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( |
|
469 XAuint32 cameraDeviceID, |
|
470 XAuint32* pMinValue, |
|
471 XAuint32* pMaxValue, |
|
472 XAuint32* pNumSettings, |
|
473 XAuint32** ppSettings) |
|
474 { |
|
475 DEBUG_API("->XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); |
|
476 /* No support in gst. |
|
477 * Spec: "If no settings are supported, |
|
478 * this method returns XA_RESULT_FEATURE_UNSUPPORTED." |
|
479 **/ |
|
480 DEBUG_INFO("No support in gst"); |
|
481 if(pNumSettings) |
|
482 { |
|
483 *pNumSettings = 0; |
|
484 } |
|
485 DEBUG_API("<-XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); |
|
486 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
487 } |
|
488 |
|
489 /* |
|
490 * XAresult XAStaticCameraCaps_GetSupportedZoomSettings( |
|
491 * XAuint32 cameraDeviceID, |
|
492 * XAboolean digitalEnabled, |
|
493 * XAboolean macroEnabled, |
|
494 * XApermille* pMaxValue, |
|
495 * XAuint32* pNumSettings, |
|
496 * XApermille** ppSettings, |
|
497 * XAboolean* pSpeedSupported) |
|
498 */ |
|
499 XAresult XAStaticCameraCaps_GetSupportedZoomSettings( |
|
500 XAuint32 cameraDeviceID, |
|
501 XAboolean digitalEnabled, |
|
502 XAboolean macroEnabled, |
|
503 XApermille* pMaxValue, |
|
504 XAuint32* pNumSettings, |
|
505 XApermille** ppSettings, |
|
506 XAboolean* pSpeedSupported) |
|
507 { |
|
508 DEBUG_API("->XAStaticCameraCaps_GetSupportedZoomSettings"); |
|
509 if( !ppSettings ) |
|
510 { |
|
511 if( !pNumSettings ) |
|
512 { |
|
513 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
514 DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); |
|
515 return XA_RESULT_PARAMETER_INVALID; |
|
516 } |
|
517 *pNumSettings = 0; |
|
518 } |
|
519 else |
|
520 { |
|
521 if( !(pMaxValue && pSpeedSupported) ) |
|
522 { |
|
523 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
524 DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); |
|
525 return XA_RESULT_PARAMETER_INVALID; |
|
526 } |
|
527 /*NOTE: no way to query actual max value*/ |
|
528 *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ZOOM; |
|
529 /*no gst support for speed settings*/ |
|
530 *pSpeedSupported = XA_BOOLEAN_FALSE; |
|
531 *pNumSettings = 0; |
|
532 } |
|
533 DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); |
|
534 return XA_RESULT_SUCCESS; |
|
535 } |
|
536 |
|
537 /* |
|
538 * XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) |
|
539 */ |
|
540 XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) |
|
541 { |
|
542 XAuint32 devId = 0; |
|
543 XAuint32 idx = 0; |
|
544 guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); |
|
545 |
|
546 if(cameraDeviceID == XA_DEFAULTDEVICEID_CAMERA) |
|
547 { |
|
548 devId = XACAMERAIMPL_DEFAULT_DEVICE; |
|
549 } |
|
550 else |
|
551 { |
|
552 devId = cameraDeviceID; |
|
553 } |
|
554 |
|
555 /* query capas with id -> find index*/ |
|
556 for(idx=0; idx<numDevices; idx++) |
|
557 { |
|
558 if( devId==allCameraCaps[idx].deviceID ) |
|
559 break; |
|
560 } |
|
561 return idx; |
|
562 } |