Grabber::setCallback Method [Deprecated]

Sets a callback function.
Syntax:
bool setCallback( const tsFrameEndCallback& callback = tsFrameEndCallback() );
Parameter Description
callback

A structure that describes the callback function.

Return value:

true, if the callback could be successfully installed, false otherwise.

Remarks:

The function is called on a frame end. Only one callback function may be set, subsequent calls to setCallback will override the previous function. The callback function will be started as a new thread. However, only one thread at the time will get started.

Note that if you grab more images than the actual MemBufferCollection can store and the callback function takes a lot of time to run, the buffer which is processed by the callback function may get filled with a new image while the function is still running.

If the callback function takes more time to run than the grabber needs to grab one frame, the next callback function will be called on the first frame-end-event on which the other callback function is no longer running. In this case some frames will be missed, but these frames will be stored in the active MemBufferCollection.

Grabber::snapImages and (if the grabber is set to continuous grab mode with an appropriate FrameGrabberSink ) Grabber::stopLive will block until the last callback function has returned.

A callback function may only be set, if the grabber is opened, valid and not in live mode. See Grabber::isDevOpen, Grabber::isDevValid and Grabber::isLive for information on how to query for these grabber states.

The callback function should be defined like the following:

void callBackFunc( void *data, tMemBufferPtr buffer, unsigned long ctr );

Where the parameters have the following meaning:

Parameter Description
data A pointer to user data. This is the pointer you provide with setCallback.
buffer A pointer to the buffer where the just grabbed image is stored.
ctr This is the value of the internal frame counter at the time the frame was grabbed. (See Grabber::getFrameCount )

To set a callback function, the pointer to the function and a pointer to the user data have to be put into a structure of type tsFrameEndCallback. See the code example on how to do this.

Information:

This method is deprecated since version 3.0.
Please use the class GrabberListener instead.

See also: Grabber, Grabber::getCallback

<< Grabber

This site is part of The Imaging Source Network. Other sites include Company Portal, Image Processing, Astronomy Cameras, Astronomy Cameras Blog, Blog caméras d'astronomie, Astronomy Cameras Competition, TX Text Control, LiveDocx, phpLiveDocx and Forums.