A callback function is an application defined procedure that the PixeLINK camera driver will call at specific times in the video stream processing.  The implementation of callback functions in LabVIEW is through a generic callback function in the PxlLabVIEW.dll.  This function uses occurrences to communicate and synchronize with application defined callback VIs.  Video data and descriptor information is passed to the callback VI and the VI is expected to pass this video data back to the driver in a timely fashion. 


There are two types of callback VIs: overlay callbacks and clip termination callbacks.  Overlay callbacks are used in the video stream process to analyze the image data, modify it (e.g. add an overlay), or monitor the descriptor information.


An overlay callback VI can be called:


  • just before a frame is displayed in the preview window;


  • just before video data is processed by FormatImage;


  • just before a frame is saved to disk by FormatClip;


  • just after a raw frame is received by the driver.


The clip termination callback VIs are used to signal to the main application that the video clip capture process, which runs in a separate thread, has been completed.  This is important during capture of a long clip as the clip capture process will be aborted if the main application terminates or uninitializes the camera.


A video clip termination callback is called after the video clip captured by GetClip has been saved to disk in the PixeLINK Datastream Format (PDS).  At a minimum, for the video clip callback, no callback VI is required.  The driver can be passed a reference to an occurrence and the main application can use this occurrence to verify that the clip capture thread has completed.  See the sample programs GetClipwithExternalThread.vi and GetClip.vi, included with the PixeLINK software, for examples.


The PixeLINK VI function menu includes templates for the overlay callback function and the clip termination function.  Use these templates as the basis for application callback and termination function VIs.


To initialize and uninitialize the callback system use InitializeSystem.vi and UninitializeSystem.vi.

To set a callback, see SetCallback.vi

To inquire about the results of a clip termination callback, see GetCallbackInfo.vi


Note: The callback functions for FormatImage and FormatClip are global, while the callback functions for the preview window and the frame data are tied to particular cameras.  See SetCallback.vi for more information.