VIDIOC_ENUM_FMT — Enumerate image formats
File descriptor returned by
To enumerate image formats applications initialize the
field of struct v4l2_fmtdesc and call the
VIDIOC_ENUM_FMT ioctl with a pointer to this
structure. Drivers fill the rest of the structure or return an
EINVAL error code. All formats are enumerable by beginning at index zero and
incrementing by one until EINVAL is
Note that after switching input or output the list of enumerated image formats may be different.
Table A.28. struct v4l2_fmtdesc
|__u32||Number of the format in the enumeration, set by
the application. This is in no way related to the |
|__u32||Type of the data stream, set by the application.
Only these types are valid here:
|__u32||See Table A.29, “Image Format Description Flags”|
|__u8||Description of the format, a NUL-terminated ASCII string. This information is intended for the user, for example: "YUV 4:2:2".|
|__u32||The image format identifier. This is a four character code as computed by the v4l2_fourcc() macro:|
#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
Several image formats are already defined by this specification in Chapter 2, Image Formats. Note these codes are not the same as those used in the Windows world.
|__u32||Reserved for future extensions. Drivers must set the array to zero.|
Table A.29. Image Format Description Flags
|0x0001||This is a compressed format.|
|0x0002||This format is not native to the device but emulated through software (usually libv4l2), where possible try to use a native format instead for better performance.|