The ILMVUserCallback interface is a user-defined interface. It must be registered by calling the put_ReceiveProcObj method of the ILMVCallback interface. This interface has one method.
Lists the return values of ReceiveProc funtion.
typedef enum
{
VDCALBK_ERR_OK,
VDCALBK_ERR_DROP,
VDCALBK_ERR_DELIVERLASTFRAME,
} VdCalBkErrConstants, VdCalBkErrConstants;
Success. The filter continues normally, delivering the processed frame.
Do not deliver the frame. The filter drops the frame and continues normally with the next frame in the stream.
Deliver the previous frame (the last one delivered). The filter saves the last frame it delivers downstream, in case the same frame is needed more than once.
This method is called for each frame received by the Video Callback Filter.
A valid pointer to the frame data, passed in a long variable.
Width of the frame.
Height of the frame.
Bits per pixel of the frame.
Size of the frame buffer, in bytes.
Value that indicates whether the image in the passed buffer (pData) is top-down (1) or bottom-up (0).
The user can modify each frame by making changes to the frame's data. Please note that the memory for each frame is owned by the callback filter. If you wish to keep the frame data, you must make a copy of it. The user callback can dictate if this frame should continue to be used after the callback via the user callback function return code.
Notes
C/C++ users: you can simply cast pData to a pointer to unsigned char.
.NET users:
For more examples on how to use the frame data in .NET applications, look at the sample code from ILMAUserCallback2 Interface.
These callbacks are implemented in .NET as a function without a return value. In order to be able to return a value other than VDCALBK_ERR_OK from your application, you need to throw an HRESULT exception before returning from ReceiveProc. One way to do this is as shown in the following example:
public class ReturnValueException : Exception
{
public ReturnValueException(object HResultValue)
{
HResult = (int)HResultValue;
}
}
public class LEADCallbackPlay : LMVCallbackLib.ILMVUserCallback
{
public void ReceiveProc(int pData, int lWidth, int lHeight, int lBitCount, int lSize, int bTopDown)
{
' you need to throw an error only if you want to return anything other that VDCALBK_ERR_OK
' throw new ReturnValueException(LMVCallbackLib.VdCalBkErrConstants.VDCALBK_ERR_DROP);
}
}
After working on the frame data, this method can return one of VdCalBkErrConstants values.