1<refentry id="vidioc-enum-framesizes">
2
3  <refmeta>
4    <refentrytitle>ioctl VIDIOC_ENUM_FRAMESIZES</refentrytitle>
5    &manvol;
6  </refmeta>
7
8  <refnamediv>
9    <refname>VIDIOC_ENUM_FRAMESIZES</refname>
10    <refpurpose>Enumerate frame sizes</refpurpose>
11  </refnamediv>
12
13  <refsynopsisdiv>
14    <funcsynopsis>
15      <funcprototype>
16	<funcdef>int <function>ioctl</function></funcdef>
17	<paramdef>int <parameter>fd</parameter></paramdef>
18	<paramdef>int <parameter>request</parameter></paramdef>
19	<paramdef>struct v4l2_frmsizeenum *<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_FRAMESIZES</para>
38	</listitem>
39      </varlistentry>
40      <varlistentry>
41	<term><parameter>argp</parameter></term>
42	<listitem>
43	  <para>Pointer to a &v4l2-frmsizeenum; that contains an index
44and pixel format and receives a frame width and height.</para>
45	</listitem>
46      </varlistentry>
47    </variablelist>
48  </refsect1>
49
50  <refsect1>
51    <title>Description</title>
52
53    <para>This ioctl allows applications to enumerate all frame sizes
54(&ie; width and height in pixels) that the device supports for the
55given pixel format.</para>
56    <para>The supported pixel formats can be obtained by using the
57&VIDIOC-ENUM-FMT; function.</para>
58    <para>The return value and the content of the
59<structfield>v4l2_frmsizeenum.type</structfield> field depend on the
60type of frame sizes the device supports. Here are the semantics of the
61function for the different cases:</para>
62
63    <itemizedlist>
64      <listitem>
65	<para><emphasis role="bold">Discrete:</emphasis> The function
66returns success if the given index value (zero-based) is valid. The
67application should increase the index by one for each call until
68<constant>EINVAL</constant> is returned. The
69<structfield>v4l2_frmsizeenum.type</structfield> field is set to
70<constant>V4L2_FRMSIZE_TYPE_DISCRETE</constant> by the driver. Of the
71union only the <structfield>discrete</structfield> member is
72valid.</para>
73      </listitem>
74      <listitem>
75	<para><emphasis role="bold">Step-wise:</emphasis> The function
76returns success if the given index value is zero and
77<constant>EINVAL</constant> for any other index value. The
78<structfield>v4l2_frmsizeenum.type</structfield> field is set to
79<constant>V4L2_FRMSIZE_TYPE_STEPWISE</constant> by the driver. Of the
80union only the <structfield>stepwise</structfield> member is
81valid.</para>
82      </listitem>
83      <listitem>
84	<para><emphasis role="bold">Continuous:</emphasis> This is a
85special case of the step-wise type above. The function returns success
86if the given index value is zero and <constant>EINVAL</constant> for
87any other index value. The
88<structfield>v4l2_frmsizeenum.type</structfield> field is set to
89<constant>V4L2_FRMSIZE_TYPE_CONTINUOUS</constant> by the driver. Of
90the union only the <structfield>stepwise</structfield> member is valid
91and the <structfield>step_width</structfield> and
92<structfield>step_height</structfield> values are set to 1.</para>
93      </listitem>
94    </itemizedlist>
95
96    <para>When the application calls the function with index zero, it
97must check the <structfield>type</structfield> field to determine the
98type of frame size enumeration the device supports. Only for the
99<constant>V4L2_FRMSIZE_TYPE_DISCRETE</constant> type does it make
100sense to increase the index value to receive more frame sizes.</para>
101    <para>Note that the order in which the frame sizes are returned
102has no special meaning. In particular does it not say anything about
103potential default format sizes.</para>
104    <para>Applications can assume that the enumeration data does not
105change without any interaction from the application itself. This means
106that the enumeration data is consistent if the application does not
107perform any other ioctl calls while it runs the frame size
108enumeration.</para>
109  </refsect1>
110
111  <refsect1>
112    <title>Structs</title>
113
114    <para>In the structs below, <emphasis>IN</emphasis> denotes a
115value that has to be filled in by the application,
116<emphasis>OUT</emphasis> denotes values that the driver fills in. The
117application should zero out all members except for the
118<emphasis>IN</emphasis> fields.</para>
119
120    <table pgwide="1" frame="none" id="v4l2-frmsize-discrete">
121      <title>struct <structname>v4l2_frmsize_discrete</structname></title>
122      <tgroup cols="3">
123	&cs-str;
124	<tbody valign="top">
125	  <row>
126	    <entry>__u32</entry>
127	    <entry><structfield>width</structfield></entry>
128	    <entry>Width of the frame [pixel].</entry>
129	  </row>
130	  <row>
131	    <entry>__u32</entry>
132	    <entry><structfield>height</structfield></entry>
133	    <entry>Height of the frame [pixel].</entry>
134	  </row>
135	</tbody>
136      </tgroup>
137    </table>
138
139    <table pgwide="1" frame="none" id="v4l2-frmsize-stepwise">
140      <title>struct <structname>v4l2_frmsize_stepwise</structname></title>
141      <tgroup cols="3">
142	&cs-str;
143	<tbody valign="top">
144	  <row>
145	    <entry>__u32</entry>
146	    <entry><structfield>min_width</structfield></entry>
147	    <entry>Minimum frame width [pixel].</entry>
148	  </row>
149	  <row>
150	    <entry>__u32</entry>
151	    <entry><structfield>max_width</structfield></entry>
152	    <entry>Maximum frame width [pixel].</entry>
153	  </row>
154	  <row>
155	    <entry>__u32</entry>
156	    <entry><structfield>step_width</structfield></entry>
157	    <entry>Frame width step size [pixel].</entry>
158	  </row>
159	  <row>
160	    <entry>__u32</entry>
161	    <entry><structfield>min_height</structfield></entry>
162	    <entry>Minimum frame height [pixel].</entry>
163	  </row>
164	  <row>
165	    <entry>__u32</entry>
166	    <entry><structfield>max_height</structfield></entry>
167	    <entry>Maximum frame height [pixel].</entry>
168	  </row>
169	  <row>
170	    <entry>__u32</entry>
171	    <entry><structfield>step_height</structfield></entry>
172	    <entry>Frame height step size [pixel].</entry>
173	  </row>
174	</tbody>
175      </tgroup>
176    </table>
177
178    <table pgwide="1" frame="none" id="v4l2-frmsizeenum">
179      <title>struct <structname>v4l2_frmsizeenum</structname></title>
180      <tgroup cols="4">
181	<colspec colname="c1" />
182	<colspec colname="c2" />
183	<colspec colname="c3" />
184	<colspec colname="c4" />
185	<tbody valign="top">
186	  <row>
187	    <entry>__u32</entry>
188	    <entry><structfield>index</structfield></entry>
189	    <entry></entry>
190	    <entry>IN: Index of the given frame size in the enumeration.</entry>
191	  </row>
192	  <row>
193	    <entry>__u32</entry>
194	    <entry><structfield>pixel_format</structfield></entry>
195	    <entry></entry>
196	    <entry>IN: Pixel format for which the frame sizes are enumerated.</entry>
197	  </row>
198	  <row>
199	    <entry>__u32</entry>
200	    <entry><structfield>type</structfield></entry>
201	    <entry></entry>
202	    <entry>OUT: Frame size type the device supports.</entry>
203	  </row>
204	  <row>
205	    <entry>union</entry>
206	    <entry></entry>
207	    <entry></entry>
208	    <entry>OUT: Frame size with the given index.</entry>
209	  </row>
210	  <row>
211	    <entry></entry>
212	    <entry>&v4l2-frmsize-discrete;</entry>
213	    <entry><structfield>discrete</structfield></entry>
214	    <entry></entry>
215	  </row>
216	  <row>
217	    <entry></entry>
218	    <entry>&v4l2-frmsize-stepwise;</entry>
219	    <entry><structfield>stepwise</structfield></entry>
220	    <entry></entry>
221	  </row>
222	  <row>
223	    <entry>__u32</entry>
224	    <entry><structfield>reserved[2]</structfield></entry>
225	    <entry></entry>
226	    <entry>Reserved space for future use.</entry>
227	  </row>
228	</tbody>
229      </tgroup>
230    </table>
231  </refsect1>
232
233  <refsect1>
234    <title>Enums</title>
235
236    <table pgwide="1" frame="none" id="v4l2-frmsizetypes">
237      <title>enum <structname>v4l2_frmsizetypes</structname></title>
238      <tgroup cols="3">
239	&cs-def;
240	<tbody valign="top">
241	  <row>
242	    <entry><constant>V4L2_FRMSIZE_TYPE_DISCRETE</constant></entry>
243	    <entry>1</entry>
244	    <entry>Discrete frame size.</entry>
245	  </row>
246	  <row>
247	    <entry><constant>V4L2_FRMSIZE_TYPE_CONTINUOUS</constant></entry>
248	    <entry>2</entry>
249	    <entry>Continuous frame size.</entry>
250	  </row>
251	  <row>
252	    <entry><constant>V4L2_FRMSIZE_TYPE_STEPWISE</constant></entry>
253	    <entry>3</entry>
254	    <entry>Step-wise defined frame size.</entry>
255	  </row>
256	</tbody>
257      </tgroup>
258    </table>
259  </refsect1>
260
261  <refsect1>
262    &return-value;
263  </refsect1>
264</refentry>
265