diff options
| -rw-r--r-- | pymba/vimbadll.py | 15 | ||||
| -rw-r--r-- | pymba/vimbaframe.py | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/pymba/vimbadll.py b/pymba/vimbadll.py index 68c8bfd..c446bd6 100644 --- a/pymba/vimbadll.py +++ b/pymba/vimbadll.py @@ -45,10 +45,18 @@ with open(vimbaC_path) as thefile: pass # NJO i think this is kind of like an os.exists ? +# Callback Function Type +if sys_plat == "win32": + CB_FUNCTYPE = WINFUNCTYPE +else: + # Untested! + CB_FUNCTYPE = CFUNCTYPE + + class VimbaDLL(object): """ - ctypes directives to make the wrapper class work cleanly, + ctypes directives to make the wrapper class work cleanly, talks to VimbaC.dll """ # a full list of Vimba API methods @@ -320,8 +328,9 @@ class VimbaDLL(object): c_uint32) # size of frame # callback for frame queue - frameDoneCallback = CFUNCTYPE(c_void_p, # camera handle - POINTER(structs.VimbaFrame)) # pointer to frame + frameDoneCallback = CB_FUNCTYPE(c_void_p, # Return Type + c_void_p, # Camera Hanlde + POINTER(structs.VimbaFrame)) # Pointer to frame # revoke a frame from the API frameRevoke = _vimbaDLL.VmbFrameRevoke diff --git a/pymba/vimbaframe.py b/pymba/vimbaframe.py index e955030..6efaec9 100644 --- a/pymba/vimbaframe.py +++ b/pymba/vimbaframe.py @@ -105,7 +105,7 @@ class VimbaFrame(object): self._frameCallback = frameCallback # define a callback wrapper here so it doesn't bind self - def frameCallbackWrapper(p_frame): + def frameCallbackWrapper(cam_handle, p_frame): # call the user's callback with the self bound outside the wrapper # ignore the frame pointer since we already know the callback # refers to this frame @@ -115,8 +115,7 @@ class VimbaFrame(object): self._frameCallbackWrapper_C = None else: # keep a reference to prevent gc issues - self._frameCallbackWrapper_C = \ - VimbaDLL.frameDoneCallback(frameCallbackWrapper) + self._frameCallbackWrapper_C = VimbaDLL.frameDoneCallback(frameCallbackWrapper) errorCode = VimbaDLL.captureFrameQueue(self._handle, byref(self._frame), |
