1 .. -*- coding: utf-8; mode: rst -*-
9 *man VIDIOC_ENUM_FMT(2)*
11 Enumerate image formats
17 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp )
23 File descriptor returned by :ref:`open() <func-open>`.
34 To enumerate image formats applications initialize the ``type`` and
35 ``index`` field of struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` and call
36 the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
37 fill the rest of the structure or return an EINVAL error code. All
38 formats are enumerable by beginning at index zero and incrementing by
39 one until EINVAL is returned.
41 Note that after switching input or output the list of enumerated image
42 formats may be different.
47 .. flat-table:: struct v4l2_fmtdesc
59 - Number of the format in the enumeration, set by the application.
60 This is in no way related to the ``pixelformat`` field.
68 - Type of the data stream, set by the application. Only these types
69 are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
70 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
71 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
72 ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
73 ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`.
81 - See :ref:`fmtdesc-flags`
87 - ``description``\ [32]
89 - Description of the format, a NUL-terminated ASCII string. This
90 information is intended for the user, for example: "YUV 4:2:2".
98 - The image format identifier. This is a four character code as
99 computed by the v4l2_fourcc() macro:
109 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
111 Several image formats are already defined by this specification in
112 :ref:`pixfmt`. Note these codes are not the same as those used
113 in the Windows world.
121 - Reserved for future extensions. Drivers must set the array to
128 .. flat-table:: Image Format Description Flags
136 - ``V4L2_FMT_FLAG_COMPRESSED``
140 - This is a compressed format.
144 - ``V4L2_FMT_FLAG_EMULATED``
148 - This format is not native to the device but emulated through
149 software (usually libv4l2), where possible try to use a native
150 format instead for better performance.
157 On success 0 is returned, on error -1 and the ``errno`` variable is set
158 appropriately. The generic error codes are described at the
159 :ref:`Generic Error Codes <gen-errors>` chapter.
162 The struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` ``type`` is not
163 supported or the ``index`` is out of bounds.
166 .. ------------------------------------------------------------------------------
167 .. This file was automatically converted from DocBook-XML with the dbxml
168 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
169 .. from the linux kernel, refer to:
171 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
172 .. ------------------------------------------------------------------------------