Specifications

Figure 20. mmap interface grabs diagram
1. Get video_mbuf
Getting the capabilities of mmap interface is the first thing before using
it that was discussed as above.
2. Use mmap()
Use the mmap for mapping the video device frames buffers to the
kernel buffer which is a big buffer containing video frames, the process
address buffer can therefore read the images directly.
3. Capture image
Once the mmap has been made the VIDIOCMCAPTURE ioctl starts
the capture to a frame using the format and image size specified in the
video_mmap (which should the same with or small than the initial query
size). When the VIDIOCMCAPTURE ioctl returns the frame is not captured
yet, the driver just instructed the hardware to start the capture. The
application has to use the VIDIOCSYNC ioctl to wait until the capture of a
frame is finished.
It is allowed to call VIDIOCMCAPTURE multiple times (with
different frame numbers in video_mmap->frame of course) and using
VIDIOCSYNC ioctl to sync the images. The four VIDIOCMCAPTURE is
issued for capturing the images with the hardware in this step.
1. Sync image until return to process
Use the VIDIOCSYNC ioctl to video device after
VIDIOCMCAPTURE ioctl, the image is ready when the VIDIOCSYNC
ioctl returns, the image can then be processed.
2. Sync frame 2 and Capture frame 1
The video frame 1 of hardware can be issued with
VIDIOCMCAPTURE ioctl again after the VIDIOCSYNC ioctl of frame 1.
The frame 2 can be subsequently used VIDIOCSYNC ioctl for waiting the
image ready after the previous frame (frame 1) was processed.
3. Continue to frame 4 than loop to frame 1
39