This is a user callback interface that should be implemented to receive notifications of when motion occurs. You register the callback by setting the ILMVMtnDet::CallbackObj property. This interface has one method.
typedef [v1_enum] enum MtnCalBkErrConstants
MTNCALBK_ERR_SUCCESS = 0,
MTNCALBK_ERR_PRESERVEDATA = 100,
|lEvent||Type of frame. This parameter tells whether the current frame is a still frame or whether motion has been detected. Possible values are:|
|FRAME_TYPE_STARTMOTION|| This frame is a motion frame. The previous frame was a still frame, so this is the first frame in which motion has been detected.|
|FRAME_TYPE_MOTION|| This frame is a motion frame. The previous frame was also a motion frame.|
|FRAME_TYPE_STARTSTILL|| This frame is a still frame. The previous frame was a motion frame, so the motion has just stopped.|
|FRAME_TYPE_STILL|| This frame is a still frame. The previous frame was also a still frame.|
|pFrame||A valid pointer to the frame data. This contains the whole image. Any change you make to this data will be reflected in what is saved or displayed onto the screen.|
|lWidth||The width (in pixels) of the image pointed by pFrame.|
|lHeight||The height (in pixels) of the image pointed by pFrame.|
|lBitCount||The bits/pixel of the image pointed by pFrame. Currently, only 24-bit images are supported.|
|lFrameSize||The total size (in bytes) of the data pointed by pFrame.|
|bTopDown||TRUE if the image is top-left (the first byte represents pixel (0,0))|
|FALSE if the image is bottom-left (the first line in the buffer contains the last line in the image. To put it another way, first byte represents pixel (lHeight-1, 0).|
The filter will call this method when there is an object(s) that moves on the video. The pFrame parameter is the source frame data that contains the object(s). The lSize parameter is the frame size.
A frame is considered to be a "Motion" frame if lEvent is FRAME_TYPE_STARTMOTION or FRAME_TYPE_MOTION. A frame is considered to be a "Still" frame if lEvent is FRAME_TYPE_STARTSTILL or FRAME_TYPE_STILL.
While processing this event, you can obtain the rectangles where the movement was detected using ILMVMtnDet::RectCount, ILMVMtnDet::RectLeft, ILMVMtnDet::RectTop, ILMVMtnDet::RectWidth and ILMVMtnDet::RectHeight properties. These rectangles are valid only for the motion frames. For still frames, ILMVMtnDet::RectCount will be 0.
You can access these properties ONLY while processing CallbackProc. You should not perform lengthy calculations in this callback because no other images will be processed while you are inside CallbackProc.
The user can do any effect over the frames by making changes on the frames data, in this case the callback function must return MTNCALBK_ERR_PRESERVEDATA value in order to preserve user changes.
MTNCALBK_ERR_SUCCESS or MTNCALBK_ERR_PRESERVEDATA if successful, an HRESULT error code otherwise.