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.
45 After switching input or output the list of enumerated image
46 formats may be different.
51 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
53 .. flat-table:: struct v4l2_fmtdesc
64 - Number of the format in the enumeration, set by the application.
65 This is in no way related to the ``pixelformat`` field.
73 - Type of the data stream, set by the application. Only these types
74 are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
75 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
76 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
77 ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
78 ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`.
86 - See :ref:`fmtdesc-flags`
92 - ``description``\ [32]
94 - Description of the format, a NUL-terminated ASCII string. This
95 information is intended for the user, for example: "YUV 4:2:2".
103 - The image format identifier. This is a four character code as
104 computed by the v4l2_fourcc() macro:
111 ``#define v4l2_fourcc(a,b,c,d)``
113 ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))``
115 Several image formats are already defined by this specification in
120 These codes are not the same as those used
121 in the Windows world.
129 - Reserved for future extensions. Drivers must set the array to
136 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
138 .. flat-table:: Image Format Description Flags
146 - ``V4L2_FMT_FLAG_COMPRESSED``
150 - This is a compressed format.
154 - ``V4L2_FMT_FLAG_EMULATED``
158 - This format is not native to the device but emulated through
159 software (usually libv4l2), where possible try to use a native
160 format instead for better performance.
166 On success 0 is returned, on error -1 and the ``errno`` variable is set
167 appropriately. The generic error codes are described at the
168 :ref:`Generic Error Codes <gen-errors>` chapter.
171 The struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` ``type`` is not
172 supported or the ``index`` is out of bounds.