int v4l_grab_init(v4l_device* vd, int width, int height) { vd->mmap.width = width; vd->mmap.height = height; vd->mmap.format = vd->picture.palette; vd->frame_current = 0; vd->frame_using[0] = FALSE; vd->frame_using[1] = FALSE; return v4l_grab_frame(vd, 0); }
/********************************************************************* * 函数名: v4l_grab_movie * 功 能:捕获连续图像 */ void v4l_grab_movie(v4l_device *vd) { #ifdef DEBUG_PRINT { // printf("video_mbuf include size=%u,frame=%d,offdet=%d\n", \ // vd->mbuf.size, vd->mbuf.frames, vd->mbuf.offsets[1]); // printf("Hello \n") ; } #endif v4l_grab_frame(vd, vd->frame_current); /*获取下一 帧*/ v4l_grab_sync(vd); /*等待传完一 帧*/ vd->buffer = v4l_get_address(vd); /*得到这一帧的地址*/ vd->frame_current = (vd->frame_current+1)%2; /* 下一帧的frame*/ }