1 <refentry id="vidioc-enum-fmt">
3 <refentrytitle>ioctl VIDIOC_ENUM_FMT</refentrytitle>
8 <refname>VIDIOC_ENUM_FMT</refname>
9 <refpurpose>Enumerate image formats</refpurpose>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_fmtdesc
19 *<parameter>argp</parameter></paramdef>
25 <title>Arguments</title>
29 <term><parameter>fd</parameter></term>
35 <term><parameter>request</parameter></term>
37 <para>VIDIOC_ENUM_FMT</para>
41 <term><parameter>argp</parameter></term>
50 <title>Description</title>
52 <para>To enumerate image formats applications initialize the
53 <structfield>type</structfield> and <structfield>index</structfield>
54 field of &v4l2-fmtdesc; and call the
55 <constant>VIDIOC_ENUM_FMT</constant> ioctl with a pointer to this
56 structure. Drivers fill the rest of the structure or return an
57 &EINVAL;. All formats are enumerable by beginning at index zero and
58 incrementing by one until <errorcode>EINVAL</errorcode> is
61 <table pgwide="1" frame="none" id="v4l2-fmtdesc">
62 <title>struct <structname>v4l2_fmtdesc</structname></title>
68 <entry><structfield>index</structfield></entry>
69 <entry>Number of the format in the enumeration, set by
70 the application. This is in no way related to the <structfield>
71 pixelformat</structfield> field.</entry>
74 <entry>&v4l2-buf-type;</entry>
75 <entry><structfield>type</structfield></entry>
76 <entry>Type of the data stream, set by the application.
77 Only these types are valid here:
78 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
79 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>,
80 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
81 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>,
82 <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
83 defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
88 <entry><structfield>flags</structfield></entry>
89 <entry>See <xref linkend="fmtdesc-flags" /></entry>
93 <entry><structfield>description</structfield>[32]</entry>
94 <entry>Description of the format, a NUL-terminated ASCII
95 string. This information is intended for the user, for example: "YUV
100 <entry><structfield>pixelformat</structfield></entry>
101 <entry>The image format identifier. This is a
102 four character code as computed by the v4l2_fourcc()
106 <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
107 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
108 </programlisting></para><para>Several image formats are already
109 defined by this specification in <xref linkend="pixfmt" />. Note these
110 codes are not the same as those used in the Windows world.</para></entry>
114 <entry><structfield>reserved</structfield>[4]</entry>
115 <entry>Reserved for future extensions. Drivers must set
116 the array to zero.</entry>
122 <table pgwide="1" frame="none" id="fmtdesc-flags">
123 <title>Image Format Description Flags</title>
128 <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
129 <entry>0x0001</entry>
130 <entry>This is a compressed format.</entry>
133 <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
134 <entry>0x0002</entry>
135 <entry>This format is not native to the device but emulated
136 through software (usually libv4l2), where possible try to use a native format
137 instead for better performance.</entry>
149 <term><errorcode>EINVAL</errorcode></term>
151 <para>The &v4l2-fmtdesc; <structfield>type</structfield>
152 is not supported or the <structfield>index</structfield> is out of
163 sgml-parent-document: "v4l2.sgml"
164 indent-tabs-mode: nil