1 .. -*- coding: utf-8; mode: rst -*-
12 VIDIOC_ENUM_FMT - Enumerate image formats
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp )
25 File descriptor returned by :ref:`open() <func-open>`.
36 To enumerate image formats applications initialize the ``type`` and
37 ``index`` field of struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` and call
38 the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
39 fill the rest of the structure or return an ``EINVAL`` error code. All
40 formats are enumerable by beginning at index zero and incrementing by
41 one until ``EINVAL`` is returned.
43 .. note:: After switching input or output the list of enumerated image
44 formats may be different.
49 .. flat-table:: struct v4l2_fmtdesc
61 - Number of the format in the enumeration, set by the application.
62 This is in no way related to the ``pixelformat`` field.
70 - Type of the data stream, set by the application. Only these types
71 are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
72 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
73 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
74 ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
75 ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`.
83 - See :ref:`fmtdesc-flags`
89 - ``description``\ [32]
91 - Description of the format, a NUL-terminated ASCII string. This
92 information is intended for the user, for example: "YUV 4:2:2".
100 - The image format identifier. This is a four character code as
101 computed by the v4l2_fourcc() macro:
111 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
113 Several image formats are already defined by this specification in
116 .. attention:: These codes are not the same as those used
117 in the Windows world.
125 - Reserved for future extensions. Drivers must set the array to
132 .. flat-table:: Image Format Description Flags
140 - ``V4L2_FMT_FLAG_COMPRESSED``
144 - This is a compressed format.
148 - ``V4L2_FMT_FLAG_EMULATED``
152 - This format is not native to the device but emulated through
153 software (usually libv4l2), where possible try to use a native
154 format instead for better performance.
160 On success 0 is returned, on error -1 and the ``errno`` variable is set
161 appropriately. The generic error codes are described at the
162 :ref:`Generic Error Codes <gen-errors>` chapter.
165 The struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` ``type`` is not
166 supported or the ``index`` is out of bounds.