blob: 0bd332421407154b9ecf260cb803d0f6def1223b [file] [log] [blame]
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -03001<refentry id="vidioc-enum-fmt">
2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_ENUM_FMT</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>VIDIOC_ENUM_FMT</refname>
9 <refpurpose>Enumerate image formats</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcprototype>
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>
20 </funcprototype>
21 </funcsynopsis>
22 </refsynopsisdiv>
23
24 <refsect1>
25 <title>Arguments</title>
26
27 <variablelist>
28 <varlistentry>
29 <term><parameter>fd</parameter></term>
30 <listitem>
31 <para>&fd;</para>
32 </listitem>
33 </varlistentry>
34 <varlistentry>
35 <term><parameter>request</parameter></term>
36 <listitem>
37 <para>VIDIOC_ENUM_FMT</para>
38 </listitem>
39 </varlistentry>
40 <varlistentry>
41 <term><parameter>argp</parameter></term>
42 <listitem>
43 <para></para>
44 </listitem>
45 </varlistentry>
46 </variablelist>
47 </refsect1>
48
49 <refsect1>
50 <title>Description</title>
51
52 <para>To enumerate image formats applications initialize the
53<structfield>type</structfield> and <structfield>index</structfield>
54field of &v4l2-fmtdesc; and call the
55<constant>VIDIOC_ENUM_FMT</constant> ioctl with a pointer to this
56structure. Drivers fill the rest of the structure or return an
57&EINVAL;. All formats are enumerable by beginning at index zero and
58incrementing by one until <errorcode>EINVAL</errorcode> is
59returned.</para>
60
Hans Verkuil93828d62012-09-03 09:37:18 -030061 <para>Note that after switching input or output the list of enumerated image
62formats may be different.</para>
63
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030064 <table pgwide="1" frame="none" id="v4l2-fmtdesc">
65 <title>struct <structname>v4l2_fmtdesc</structname></title>
66 <tgroup cols="3">
67 &cs-str;
68 <tbody valign="top">
69 <row>
70 <entry>__u32</entry>
71 <entry><structfield>index</structfield></entry>
72 <entry>Number of the format in the enumeration, set by
73the application. This is in no way related to the <structfield>
74pixelformat</structfield> field.</entry>
75 </row>
76 <row>
Sakari Ailus6016af82012-05-10 02:02:07 -030077 <entry>__u32</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030078 <entry><structfield>type</structfield></entry>
79 <entry>Type of the data stream, set by the application.
80Only these types are valid here:
81<constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
Pawel Osciak53b5d572011-01-07 01:41:33 -030082<constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>,
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030083<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
Pawel Osciak53b5d572011-01-07 01:41:33 -030084<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>,
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030085<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
86defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
Sakari Ailus6016af82012-05-10 02:02:07 -030087and higher. See <xref linkend="v4l2-buf-type" />.</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030088 </row>
89 <row>
90 <entry>__u32</entry>
91 <entry><structfield>flags</structfield></entry>
92 <entry>See <xref linkend="fmtdesc-flags" /></entry>
93 </row>
94 <row>
95 <entry>__u8</entry>
96 <entry><structfield>description</structfield>[32]</entry>
97 <entry>Description of the format, a NUL-terminated ASCII
98string. This information is intended for the user, for example: "YUV
994:2:2".</entry>
100 </row>
101 <row>
102 <entry>__u32</entry>
103 <entry><structfield>pixelformat</structfield></entry>
104 <entry>The image format identifier. This is a
105four character code as computed by the v4l2_fourcc()
106macro:</entry>
107 </row>
108 <row>
109 <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
110#define v4l2_fourcc(a,b,c,d) (((__u32)(a)&lt;&lt;0)|((__u32)(b)&lt;&lt;8)|((__u32)(c)&lt;&lt;16)|((__u32)(d)&lt;&lt;24))
111</programlisting></para><para>Several image formats are already
112defined by this specification in <xref linkend="pixfmt" />. Note these
113codes are not the same as those used in the Windows world.</para></entry>
114 </row>
115 <row>
116 <entry>__u32</entry>
117 <entry><structfield>reserved</structfield>[4]</entry>
118 <entry>Reserved for future extensions. Drivers must set
119the array to zero.</entry>
120 </row>
121 </tbody>
122 </tgroup>
123 </table>
124
125 <table pgwide="1" frame="none" id="fmtdesc-flags">
126 <title>Image Format Description Flags</title>
127 <tgroup cols="3">
128 &cs-def;
129 <tbody valign="top">
130 <row>
131 <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
132 <entry>0x0001</entry>
133 <entry>This is a compressed format.</entry>
134 </row>
135 <row>
136 <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
137 <entry>0x0002</entry>
138 <entry>This format is not native to the device but emulated
139through software (usually libv4l2), where possible try to use a native format
140instead for better performance.</entry>
141 </row>
142 </tbody>
143 </tgroup>
144 </table>
145 </refsect1>
146
147 <refsect1>
148 &return-value;
149
150 <variablelist>
151 <varlistentry>
152 <term><errorcode>EINVAL</errorcode></term>
153 <listitem>
154 <para>The &v4l2-fmtdesc; <structfield>type</structfield>
155is not supported or the <structfield>index</structfield> is out of
156bounds.</para>
157 </listitem>
158 </varlistentry>
159 </variablelist>
160 </refsect1>
161</refentry>