diff options
| author | morefigs <morefigs@gmail.com> | 2016-09-16 09:44:27 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-16 09:44:27 +1000 |
| commit | 82b60e50173ef23d9cce411963ed9953634683c2 (patch) | |
| tree | b435c60711a33ac55c721884c7a6bbf31f3f9f44 | |
| parent | a2fb906a6bff1c5212cb44a2faab734ca26a1eeb (diff) | |
| parent | 691e726f9a084068d2334e409fa8b3ab78fc8aab (diff) | |
| download | pymba-82b60e50173ef23d9cce411963ed9953634683c2.tar.gz pymba-82b60e50173ef23d9cce411963ed9953634683c2.zip | |
Merge pull request #36 from jrast/feature/frameCallback
Correct Signature for frame callback
| -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), |
