kopia lustrzana https://gitlab.com/sane-project/backends
Loop through the read buffers to avoid getting stale frames
rodzic
4d0cd3c5b1
commit
b5f4056635
|
@ -1,3 +1,7 @@
|
||||||
|
2010-11-07 Marc Deslauriers <marc.deslauriers@ubuntu.com>
|
||||||
|
* backend/v4l.c: loop through the read buffers in the v4l backend so
|
||||||
|
we don't get stale frames.
|
||||||
|
|
||||||
2010-11-06 Stéphane Voltz <stef.dev@free.fr>
|
2010-11-06 Stéphane Voltz <stef.dev@free.fr>
|
||||||
* frontend/scanimage.c doc/scanimage.man: add -A/--all-options to list
|
* frontend/scanimage.c doc/scanimage.man: add -A/--all-options to list
|
||||||
all control options exposed by a backend.
|
all control options exposed by a backend.
|
||||||
|
|
|
@ -949,7 +949,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters * params)
|
||||||
SANE_Status
|
SANE_Status
|
||||||
sane_start (SANE_Handle handle)
|
sane_start (SANE_Handle handle)
|
||||||
{
|
{
|
||||||
int len;
|
int len, loop;
|
||||||
V4L_Scanner *s;
|
V4L_Scanner *s;
|
||||||
|
|
||||||
DBG (2, "sane_start\n");
|
DBG (2, "sane_start\n");
|
||||||
|
@ -1005,21 +1005,27 @@ sane_start (SANE_Handle handle)
|
||||||
s->mmap.format = s->pict.palette;
|
s->mmap.format = s->pict.palette;
|
||||||
DBG (2, "sane_start: mmapped frame %d x %d with palette %d\n",
|
DBG (2, "sane_start: mmapped frame %d x %d with palette %d\n",
|
||||||
s->mmap.width, s->mmap.height, s->mmap.format);
|
s->mmap.width, s->mmap.height, s->mmap.format);
|
||||||
len = v4l1_ioctl (s->fd, VIDIOCMCAPTURE, &s->mmap);
|
|
||||||
if (len == -1)
|
/* We need to loop here to empty the read buffers, so we don't
|
||||||
{
|
get a stale image */
|
||||||
DBG (1, "sane_start: ioctl VIDIOCMCAPTURE failed: %s\n",
|
for (loop = 0; loop <= s->mbuf.frames; loop++)
|
||||||
strerror (errno));
|
{
|
||||||
return SANE_STATUS_INVAL;
|
len = v4l1_ioctl (s->fd, VIDIOCMCAPTURE, &s->mmap);
|
||||||
}
|
if (len == -1)
|
||||||
DBG (3, "sane_start: waiting for frame %x\n", s->mmap.frame);
|
{
|
||||||
len = v4l1_ioctl (s->fd, VIDIOCSYNC, &(s->mmap.frame));
|
DBG (1, "sane_start: ioctl VIDIOCMCAPTURE failed: %s\n",
|
||||||
if (-1 == len)
|
strerror (errno));
|
||||||
{
|
return SANE_STATUS_INVAL;
|
||||||
DBG (1, "sane_start: call to ioctl(%d, VIDIOCSYNC, ..) failed\n",
|
}
|
||||||
s->fd);
|
DBG (3, "sane_start: waiting for frame %x, loop %d\n", s->mmap.frame, loop);
|
||||||
return SANE_STATUS_INVAL;
|
len = v4l1_ioctl (s->fd, VIDIOCSYNC, &(s->mmap.frame));
|
||||||
}
|
if (-1 == len)
|
||||||
|
{
|
||||||
|
DBG (1, "sane_start: call to ioctl(%d, VIDIOCSYNC, ..) failed\n",
|
||||||
|
s->fd);
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
DBG (3, "sane_start: frame %x done\n", s->mmap.frame);
|
DBG (3, "sane_start: frame %x done\n", s->mmap.frame);
|
||||||
}
|
}
|
||||||
DBG (3, "sane_start: done\n");
|
DBG (3, "sane_start: done\n");
|
||||||
|
|
Ładowanie…
Reference in New Issue