Call IOCTL (video_fd, VIDIOC_QBUF, &queuebuffer); the program is blocked

like this:
struct v4l2_buffer queuebuffer ;
queuebuffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
queuebuffer.memory = V4L2_MEMORY_MMAP ;
queuebuffer.index = 0 ;

ret = ioctl(video_fd , VIDIOC_QBUF , &queuebuffer);

//////////////////////////////////////////////////////////////////
//block by
ret = ioctl(video_fd , VIDIOC_DQBUF , &dequeue); //blocked
if(ret != 0)
{
perror(“dequeue fail”);
return -1 ;
}

wuliming,
Could you run ./capture-cuda sample from
~/tegra_multimedia_api/samples/v4l2cuda
and it will capture the camera preview frame to out.ppm file that you can view.
(make to build if executable is not yet existed)

Inside this sample, it uses the same ioctl(fd, VIDEOC_DQBUF, &bug) call. You could compare with your version.

chijen:
I ran the capture-cuda ,it shall be reported to the following error:
VIDIOC_S_FMT error 22, Invalid argument

In the gdb:
xioctl (fd, VIDIOC_S_FMT, &fmt) failure

I enum the support fmt,only support four fmts:

RGGB:8-bit Bayer RGRG/GBGB
RG10:10-bit Bayer RGRG/GBGB
BG10:10-bit Bayer BGBG/GRGR
RG12:12-bit Bayer RGRG/GBGB

is my drives is there a problem?

I change the fmt
static unsigned int pixel_format = V4L2_PIX_FMT_SRGGB8;

but “select” timeout:
r = select (fd + 1, &fds, NULL, NULL, &tv);

Hi,
We have the v4l2 framework open source in tegra_multimedia_api/samples/common/classes. Please refer to it.

1 Like