Skip to contentSkip to conversation

v4l2_ioctl vidioc_s_fmt/vidioc_try_fmt pix <--> pix_mp conversion

DISCUSSION Rafal 1 participant 1 message Sep 1, 2017 Media (V4L/DVB)

lore
Share & tools
lore

Rafal

author
#0 lore raw

Could somebody explain to me some strange behavior of v4l2_ioctl call?

When a device supports |V4L2_CAP_VIDEO_OUTPUT_MPLANE capability but does not support ||V4L2_CAP_VIDEO_OUTPUT, the |v4l2_ioctl function converts VIDIOC_S_FMT ioctl call: for example, when the specified buffer type is V4L2_BUF_TYPE_VIDEO_OUTPUT, it is changed to V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE. But the num_planes value is not checked after the ioctl call, like after VIDIOC_G_FMT ioctl call is made. Device may change the num_planes value in call, especially since number of planes is determined by pixelformat. For example, V4L2 distinguishes single-plane variant of YUV420 format (V4L2_PIX_FMT_YUV420) from multi-plane one (V4L2_PIX_FMT_YUV420M). If the number of planes is not checked, program may select multi-plane variant, which will not handle correctly. Shouldn't the library check the number of planes after ioctl call?

Rafal