I'm trying to use double buffering to burst the throuput of an application of mine.
I'm having the problem that if I try to use 2 frames, the first one is
correct and the second one not. The second one is the previous one,
which has already been elaborated. I can't understand why I can't get it
working.
I don't post all the code because it is too long, but here are some
lines, maybe you can tell me we're the bug...
fd = open (telecamera (), O_RDWR);
if (ioctl (fd, VIDIOCGMBUF, &b) < 0)
{
fprintf (stderr, "Visione, %s %d : VIDIOCGMBUF fallito\n", __FILE__,
__LINE__);
exit (1);
}
map = mmap (0, b.size, PROT_READ | PROT_READ, MAP_SHARED, fd, 0);
if (map == MAP_FAILED)
{
fprintf (stderr, "Visione, %s %d : MMAP fallita\n", __FILE__, __LINE__);
exit (1);
}
if (ioctl (fd, VIDIOCMCAPTURE, &v) < 0)
{
fprintf (stderr, "Visione, %s %d : VIDIOCMCAPTURE fallito\n",
__FILE__, __LINE__);
exit (1);
}
...
while (1)
{
/* read frame 0, get number 1 */
v.frame = 1;
ioctl (fd, VIDIOCMCAPTURE, &v);
v.frame = 0;
ioctl (fd, VIDIOCSYNC, &v.frame);
/* elaborate frame 0 */
...
/* read frame 1, get number 0 */
v.frame = 0;
ioctl (fd, VIDIOCMCAPTURE, &v);
v.frame = 1;
ioctl (fd, VIDIOCSYNC, &v.frame);
/* elaborate frame 1 */
...
}
I've followed the kernel documentation, but it doesn't work. I've even
tried to see if my card doesn't support double buffering, but the
video_mbuf b in VIDIOCGMBUF says that b.frame = 4 .
What's wrong?
--
Non c'� pi� forza nella normalit�, c'� solo monotonia.
pgp00000.pgp
Description: PGP signature
