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