AnsweredAssumed Answered

V4L2 How to capture fresh frame? (i.MX mxc capture , select() with timeout = 0)

Question asked by Ilya Kosharov on May 31, 2014
Latest reply on Jun 3, 2014 by Ilya Kosharov

Hi!

I'm working with board based on Nitrogen6x using v4l2 for capturing mt9v131 Aptina sensor through mxc capture drivers.

Sensor is connected through csi and ipu and works with mxc_v4l2_capture.c subsystem.

 

As it has FRAME_NUM = 10 buffer frames i have a video stream with delay of 10 frames. One of solutions i have found to have fresh frame is to dequeue and queue buffers as long as it possible with timeout = 0 while select returns something with Read descriptor. When select returns an error you have a latest frame or, as it could be, have to wait for timeout != 0 (corresponding with your FPS).

So, the problem is that select with timeout = 0

res = select(handlePrivate->devHandle + 1, &readFDSet, NULL, NULL, 0);

everytime returns 1, means that something is to be readed. It happens even in endless loop with select request only.

 

The questions are:

- Is the camera filedescriptor has something to read? What could it be? Not only frames?

- Maybe there is a more elegant way to get latest frame with v4l2?

 

Thanx for suggestions!

 

P.S. I've tried this solution with USB webcam and it worked fine.

Outcomes