| To: | Nicolas Boulay <> |
|---|---|
| Subject: | Re: [pwc] use of mmap |
| From: | Gregor Jasny <> |
| Date: | Sun, 25 Mar 2007 22:52:19 +0200 |
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
http://lists.saillard.org/mailman/listinfo/pwc
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [pwc] use of mmap, Nicolas Boulay |
|---|---|
| Previous by Thread: | [pwc] use of mmap, Nicolas Boulay |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU