Hi,
I'm trying to use the bttv 0.8.x driver in order to acquire frames
from a bt878 framegrabber.
Before I was using the bttv2 driver from bttv-v4l2.sourceforge.net
and the videodevX module.
I'm aquiring images using the mmap function, in this way (this is an
exaple.... my code is similar)
....................
struct v4l2_requestbuffers req;
struct v4l2_buffer vidbuf[4];
unsigned char *data[4];
req.count = 4;
req.type = V4L2_BUF_TYPE_CAPTURE;
err = ioctl(grab_fd, VIDIOC_REQBUFS, &req);
if (err < 0 || req.count < 1) {
printf("REQBUFS returned
error %s, count %d\n",
strerror(errno), req.count);
return -1;
}
for (i = 0; i < req.count; ++i) {
vidbuf[i].index = i;
vidbuf[i].type = V4L2_BUF_TYPE_CAPTURE;
err = ioctl(grab_fd, VIDIOC_QUERYBUF,
&vidbuf[i]);
if (err < 0) {
printf("QUERYBUF returned error %s\n", strerror(errno));
return -1;
}
data[i] = mmap(0,
vidbuf[i].length, PROT_READ,
MAP_SHARED, grab_fd,
vidbuf[i].offset);
}
then I'll use VIDIOC_QBUF and VIDIOC_DQBUF to acquire the images... There is a similar example in the v4l2 examples from thedirks.
The problem is that when I make the mmap function it returns "Invalid argument". What can I do? Can you please help me?!
Thanks,
Andrea Oddera
-- Andrea Oddera oddera@xxxxxxxx http://www.aitek.it Aitek S.p.A. - Via della Crocetta 15 - 16122 Genova