struct timeval tv_s;
static int v4l_mm_read_picture(VideoData *s, UINT8 *buf){    UINT8 *ptr;    struct timeval tv_s;    //struct timeval tv_e;    //int delay;    /* Setup to capture the next frame */    gb_buf.frame = (gb_frame + 1) % gb_buffers.frames;    if (ioctl(s->fd, VIDIOCMCAPTURE, &gb_buf) < 0) {        if (errno == EAGAIN)            fprintf(stderr,"Cannot Sync\n");        else            perror("VIDIOCMCAPTURE");        return -EIO;    }    gettimeofday(&tv_s, 0);    while (ioctl(s->fd, VIDIOCSYNC, &gb_frame) < 0 &&           (errno == EAGAIN || errno == EINTR));    ptr = video_buf + gb_buffers.offsets[gb_frame];    memcpy(buf, ptr, s->frame_size);    /* This is now the grabbing frame */    gb_frame = gb_buf.frame;    return s->frame_size;}