static int vfw_nq (zbar_video_t *vdo, zbar_image_t *img) { img->data = NULL; img->datalen = 0; return(video_nq_image(vdo, img)); }
static int v4l2_nq (zbar_video_t *vdo, zbar_image_t *img) { if(vdo->iomode == VIDEO_READWRITE) return(video_nq_image(vdo, img)); if(video_unlock(vdo)) return(-1); struct v4l2_buffer vbuf; memset(&vbuf, 0, sizeof(vbuf)); vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(vdo->iomode == VIDEO_MMAP) { vbuf.memory = V4L2_MEMORY_MMAP; vbuf.index = img->srcidx; } else { vbuf.memory = V4L2_MEMORY_USERPTR; vbuf.m.userptr = (unsigned long)img->data; vbuf.length = img->datalen; vbuf.index = img->srcidx; /* FIXME workaround broken drivers */ } if(ioctl(vdo->fd, VIDIOC_QBUF, &vbuf) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "queuing video buffer (VIDIOC_QBUF)")); return(0); }
static int v4l1_nq (zbar_video_t *vdo, zbar_image_t *img) { if(video_nq_image(vdo, img)) return(-1); if(vdo->iomode != VIDEO_MMAP) return(0); struct video_mmap vmap; vmap.frame = img->srcidx; vmap.width = vdo->width; vmap.height = vdo->height; vmap.format = vdo->palette; if(ioctl(vdo->fd, VIDIOCMCAPTURE, &vmap) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "initiating video capture (VIDIOCMCAPTURE)")); return(0); }