1.在.h头文件定义函数名
typedef int (*MotionDetCallback)(int result);
void MotionDetReg(MotionDetCallback cb);
2.赋值callback回调函数
static MotionDetCallback motionDetReg = NULL;
void MotionDetReg(MotionDetCallback cb)
{
if (cb) {
motionDetReg = cb;
}
}
3.在需要传参的地方设置callback回调
int result = MotionProcess(&(frame.frame));
if (motionDetReg) {
motionDetReg(result);
}
4.注册回调,并实现传参后的处理函数
int MotionDetectCb(int result)
{
return 0;
}
MotionDetReg(MotionDetectCb);