Hi Nicolas,

On Sun, Mar 25, 2007 at 12:08:58PM +0200, Nicolas Boulay wrote:
> So what is the "right" way of using mmap?

I assume you use the V4L2 interface:

First you request some buffers from the driver:
m_req.count   = 2;
m_req.type    = V4L2_BUF_TYPE_VIDEO_CAPTURE;
m_req.memory  = V4L2_MEMORY_MMAP;
ioctl (m_fd, VIDIOC_REQBUFS, &m_req)

Then you query each buffer:
buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory      = V4L2_MEMORY_MMAP;
buf.index       = buffer_index;
ioctl (m_fd, VIDIOC_QUERYBUF, &buf)

Now you have the buffer length in the v4l2_buffer structure. Ready to
mmap:
mmap (NULL, buf.length, PROT_READ|PROT_WRITE,
      MAP_SHARED, m_fd, buf.m.offset);

I hope this sheds some light onto your problem.

Gregor
_______________________________________________
pwc mailing list
[email protected]
http://lists.saillard.org/mailman/listinfo/pwc

Reply via email to