GrabberListener::frameReady Method

This method is called after the video capture device has copied a new frame into a memory buffer.
Syntax:
virtual void frameReady( Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD FrameNumber );
Parameter Description
caller

Identifies the Grabber object that called this method.

pBuffer

Specifies a pointer to the MemBuffer that contains the new frame.

framenumber

Specifies the number of the frame for which this method is called. The frame number is incremented for every frame that is copied to a buffer. A call to Grabber::startLive resets the frame numbers to 0.

Remarks:

After a call to Grabber::startLive, the first frame that is copied to a buffer gets the frame number 0. Please note that the frame count is incremented for every copied frame. Therefore, the frame count and the index of a buffer in the MemBufferCollection is not identical if the number of copied frames exceeds the number of buffers in the MemBufferCollection.

This callback method is only called, if the GrabberListener object was registered by a call to Grabber::addListener with the parameter eFRAMEREADY or eALL.

Exceptions that occur in the frameReady event will get lost in the system. Therefore, bugs in the code that cause an exception cannot be recognized. To avoid this, all code in the event handler should be enclosed by a try ... catch block. If you need to display error messages, do not use a message box. Use a "debug trace" instead (e.g. TRACE(...) ). This is very important, because otherwise the system may run into a deadlock which will cause the application to hang.

See also: GrabberListener, Grabber::addListener, GrabberListener::tListenerType, GrabberListener::deviceLost, GrabberListener::overlayCallback, MemBuffer

<< GrabberListener