1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
19 VIDIOC_ENUM_FMT - Enumerate image formats
25 .. c:function:: int ioctl( int fd, VIDIOC_ENUM_FMT, struct v4l2_fmtdesc *argp )
26 :name: VIDIOC_ENUM_FMT
33 File descriptor returned by :ref:`open() <func-open>`.
36 Pointer to struct :c:type:`v4l2_fmtdesc`.
42 To enumerate image formats applications initialize the ``type`` and
43 ``index`` field of struct :c:type:`v4l2_fmtdesc` and call
44 the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
45 fill the rest of the structure or return an ``EINVAL`` error code. All
46 formats are enumerable by beginning at index zero and incrementing by
47 one until ``EINVAL`` is returned.
51 After switching input or output the list of enumerated image
52 formats may be different.
55 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
57 .. c:type:: v4l2_fmtdesc
59 .. flat-table:: struct v4l2_fmtdesc
66 - Number of the format in the enumeration, set by the application.
67 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``,
75 ``V4L2_BUF_TYPE_VIDEO_OVERLAY``,
76 ``V4L2_BUF_TYPE_SDR_CAPTURE``,
77 ``V4L2_BUF_TYPE_SDR_OUTPUT`` and
78 ``V4L2_BUF_TYPE_META_CAPTURE``.
79 See :c:type:`v4l2_buf_type`.
82 - See :ref:`fmtdesc-flags`
84 - ``description``\ [32]
85 - Description of the format, a NUL-terminated ASCII string. This
86 information is intended for the user, for example: "YUV 4:2:2".
89 - The image format identifier. This is a four character code as
90 computed by the v4l2_fourcc() macro:
95 ``#define v4l2_fourcc(a,b,c,d)``
97 ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))``
99 Several image formats are already defined by this specification in
104 These codes are not the same as those used
105 in the Windows world.
108 - Reserved for future extensions. Drivers must set the array to
113 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
117 .. flat-table:: Image Format Description Flags
122 * - ``V4L2_FMT_FLAG_COMPRESSED``
124 - This is a compressed format.
125 * - ``V4L2_FMT_FLAG_EMULATED``
127 - This format is not native to the device but emulated through
128 software (usually libv4l2), where possible try to use a native
129 format instead for better performance.
135 On success 0 is returned, on error -1 and the ``errno`` variable is set
136 appropriately. The generic error codes are described at the
137 :ref:`Generic Error Codes <gen-errors>` chapter.
140 The struct :c:type:`v4l2_fmtdesc` ``type`` is not
141 supported or the ``index`` is out of bounds.