Could you test this new escapi.pbi with camera properties set/get functions ?
Code: Select all
;/* Extremely Simple Capture API */
Structure SimpleCapParams
*mTargetBuf ; Must be at least mWidth * mHeight * SizeOf(int) of size!
mWidth.l
mHeight.l
EndStructure
;/* Return the number of capture devices found */
PrototypeC countCaptureDevicesProc()
; /* initCapture tries To open the video capture device.
; * Returns 0 on failure, 1 on success.
; * Note: Capture parameter values must Not change While capture device
; * is in use (i.e. between initCapture And deinitCapture).
; * Do *Not* free the target buffer, Or change its pointer!
; */
PrototypeC initCaptureProc(deviceno, *aParams.SimpleCapParams)
;/* deinitCapture closes the video capture device. */
PrototypeC deinitCaptureProc(deviceno)
;/* doCapture requests video frame To be captured. */
PrototypeC doCaptureProc(deviceno)
;/* isCaptureDone returns 1 when the requested frame has been captured.*/
PrototypeC isCaptureDoneProc(deviceno)
;/* Get the user-friendly name of a capture device. */
PrototypeC getCaptureDeviceNameProc(deviceno, *namebuffer, bufferlength)
Enumeration CAPTURE_PROPERTIES ;Name corrected
#CAPTURE_BRIGHTNESS = 0
#CAPTURE_CONTRAST
#CAPTURE_HUE
#CAPTURE_SATURATION
#CAPTURE_SHARPNESS
#CAPTURE_GAMMA
#CAPTURE_COLORENABLE
#CAPTURE_WHITEBALANCE
#CAPTURE_BACKLIGHTCOMPENSATION
#CAPTURE_GAIN
#CAPTURE_PAN
#CAPTURE_TILT
#CAPTURE_ROLL
#CAPTURE_ZOOM
#CAPTURE_EXPOSURE
#CAPTURE_IRIS
#CAPTURE_FOCUS
#CAPTURE_PROP_MAX
EndEnumeration
;/* Gets value (0..1) of a camera property (see CAPTURE_PROPERTIES, above) */
PrototypeC.f getCapturePropertyValueProc(deviceno, prop)
;/* Gets whether the property is set To automatic (see CAPTURE_PROPERTIES, above) */
PrototypeC getCapturePropertyAutoProc(deviceno, prop);
;/* Set camera property To a value (0..1) And whether it should be set To auto. */
PrototypeC setCapturePropertyProc(deviceno, prop, value.f, autoval);
;/* Returns the ESCAPI DLL version. 0x200 For 2.0 */
PrototypeC ESCAPIDLLVersionProc()
; marked as "internal" in the example
PrototypeC initCOMProc()
;/* initCaptureWithOptions allows additional options To be given. Otherwise it's identical with initCapture
PrototypeC initCaptureWithOptionsProc(deviceno, *aParams.SimpleCapParams, aOptions)
Global countCaptureDevices.countCaptureDevicesProc
Global initCapture.initCaptureProc
Global deinitCapture.deinitCaptureProc
Global doCapture.doCaptureProc
Global isCaptureDone.isCaptureDoneProc
Global initCOM.initCOMProc
Global getCaptureDeviceName.getCaptureDeviceNameProc
Global getCapturePropertyValue.getCapturePropertyValueProc
Global getCapturePropertyAuto.getCapturePropertyAutoProc
Global setCaptureProperty.setCapturePropertyProc
Global ESCAPIDLLVersion.ESCAPIDLLVersionProc
Global initCaptureWithOptions.initCaptureWithOptionsProc
Macro MyGetFunction(var, dll, function)
var = GetFunction(dll, function)
If var = 0
Debug "Unsupported function : " + function
error = #True
EndIf
EndMacro
Procedure setupESCAPI()
; load library
capdll = OpenLibrary(#PB_Any, "escapi.dll")
If capdll = 0
ProcedureReturn 0
EndIf
Define init
;/* Fetch function entry points */
Define error = #False
MyGetFunction(countCaptureDevices , capdll, "countCaptureDevices")
MyGetFunction(initCapture , capdll, "initCapture")
MyGetFunction(deinitCapture , capdll, "deinitCapture")
MyGetFunction(doCapture , capdll, "doCapture")
MyGetFunction(isCaptureDone , capdll, "isCaptureDone")
MyGetFunction(initCOM , capdll, "initCOM")
MyGetFunction(getCaptureDeviceName , capdll, "getCaptureDeviceName")
MyGetFunction(ESCAPIDLLVersion , capdll, "ESCAPIDLLVersion")
;MyGetFunction(initCaptureWithOptions , capdll, "initCaptureWithOptions")
MyGetFunction(getCapturePropertyValue, capdll, "getCapturePropertyValue")
MyGetFunction(getCapturePropertyAuto , capdll, "getCapturePropertyAuto")
MyGetFunction(setCaptureProperty , capdll, "setCaptureProperty")
If error
Debug "Error while getting some dll functions."
EndIf
;/* Verify DLL version */
If ESCAPIDLLVersion() < $200
ProcedureReturn 0
EndIf
;/* Initialize COM.. */
initCOM();
; returns number of devices found
ProcedureReturn countCaptureDevices()
EndProcedure