Merge remote-tracking branch 'docs-next/docs-next' into devel/docs-next
[cascardo/linux.git] / Documentation / media / uapi / v4l / vidioc-enum-framesizes.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _VIDIOC_ENUM_FRAMESIZES:
4
5 ****************************
6 ioctl VIDIOC_ENUM_FRAMESIZES
7 ****************************
8
9 Name
10 ====
11
12 VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_frmsizeenum *argp )
19
20
21 Arguments
22 =========
23
24 ``fd``
25     File descriptor returned by :ref:`open() <func-open>`.
26
27 ``request``
28     VIDIOC_ENUM_FRAMESIZES
29
30 ``argp``
31     Pointer to a struct :ref:`v4l2_frmsizeenum <v4l2-frmsizeenum>`
32     that contains an index and pixel format and receives a frame width
33     and height.
34
35
36 Description
37 ===========
38
39 This ioctl allows applications to enumerate all frame sizes (i. e. width
40 and height in pixels) that the device supports for the given pixel
41 format.
42
43 The supported pixel formats can be obtained by using the
44 :ref:`VIDIOC_ENUM_FMT` function.
45
46 The return value and the content of the ``v4l2_frmsizeenum.type`` field
47 depend on the type of frame sizes the device supports. Here are the
48 semantics of the function for the different cases:
49
50 -  **Discrete:** The function returns success if the given index value
51    (zero-based) is valid. The application should increase the index by
52    one for each call until ``EINVAL`` is returned. The
53    ``v4l2_frmsizeenum.type`` field is set to
54    ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
55    ``discrete`` member is valid.
56
57 -  **Step-wise:** The function returns success if the given index value
58    is zero and ``EINVAL`` for any other index value. The
59    ``v4l2_frmsizeenum.type`` field is set to
60    ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
61    ``stepwise`` member is valid.
62
63 -  **Continuous:** This is a special case of the step-wise type above.
64    The function returns success if the given index value is zero and
65    ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
66    field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
67    the union only the ``stepwise`` member is valid and the
68    ``step_width`` and ``step_height`` values are set to 1.
69
70 When the application calls the function with index zero, it must check
71 the ``type`` field to determine the type of frame size enumeration the
72 device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
73 it make sense to increase the index value to receive more frame sizes.
74
75 .. note::
76
77    The order in which the frame sizes are returned has no special
78    meaning. In particular does it not say anything about potential default
79    format sizes.
80
81 Applications can assume that the enumeration data does not change
82 without any interaction from the application itself. This means that the
83 enumeration data is consistent if the application does not perform any
84 other ioctl calls while it runs the frame size enumeration.
85
86
87 Structs
88 =======
89
90 In the structs below, *IN* denotes a value that has to be filled in by
91 the application, *OUT* denotes values that the driver fills in. The
92 application should zero out all members except for the *IN* fields.
93
94
95 .. _v4l2-frmsize-discrete:
96
97 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
98
99 .. flat-table:: struct v4l2_frmsize_discrete
100     :header-rows:  0
101     :stub-columns: 0
102     :widths:       1 1 2
103
104
105     -  .. row 1
106
107        -  __u32
108
109        -  ``width``
110
111        -  Width of the frame [pixel].
112
113     -  .. row 2
114
115        -  __u32
116
117        -  ``height``
118
119        -  Height of the frame [pixel].
120
121
122
123 .. _v4l2-frmsize-stepwise:
124
125 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
126
127 .. flat-table:: struct v4l2_frmsize_stepwise
128     :header-rows:  0
129     :stub-columns: 0
130     :widths:       1 1 2
131
132
133     -  .. row 1
134
135        -  __u32
136
137        -  ``min_width``
138
139        -  Minimum frame width [pixel].
140
141     -  .. row 2
142
143        -  __u32
144
145        -  ``max_width``
146
147        -  Maximum frame width [pixel].
148
149     -  .. row 3
150
151        -  __u32
152
153        -  ``step_width``
154
155        -  Frame width step size [pixel].
156
157     -  .. row 4
158
159        -  __u32
160
161        -  ``min_height``
162
163        -  Minimum frame height [pixel].
164
165     -  .. row 5
166
167        -  __u32
168
169        -  ``max_height``
170
171        -  Maximum frame height [pixel].
172
173     -  .. row 6
174
175        -  __u32
176
177        -  ``step_height``
178
179        -  Frame height step size [pixel].
180
181
182
183 .. _v4l2-frmsizeenum:
184
185 .. flat-table:: struct v4l2_frmsizeenum
186     :header-rows:  0
187     :stub-columns: 0
188
189
190     -  .. row 1
191
192        -  __u32
193
194        -  ``index``
195
196        -
197        -  IN: Index of the given frame size in the enumeration.
198
199     -  .. row 2
200
201        -  __u32
202
203        -  ``pixel_format``
204
205        -
206        -  IN: Pixel format for which the frame sizes are enumerated.
207
208     -  .. row 3
209
210        -  __u32
211
212        -  ``type``
213
214        -
215        -  OUT: Frame size type the device supports.
216
217     -  .. row 4
218
219        -  union
220
221        -
222        -
223        -  OUT: Frame size with the given index.
224
225     -  .. row 5
226
227        -
228        -  struct :ref:`v4l2_frmsize_discrete <v4l2-frmsize-discrete>`
229
230        -  ``discrete``
231
232        -
233
234     -  .. row 6
235
236        -
237        -  struct :ref:`v4l2_frmsize_stepwise <v4l2-frmsize-stepwise>`
238
239        -  ``stepwise``
240
241        -
242
243     -  .. row 7
244
245        -  __u32
246
247        -  ``reserved[2]``
248
249        -
250        -  Reserved space for future use. Must be zeroed by drivers and
251           applications.
252
253
254
255 Enums
256 =====
257
258
259 .. _v4l2-frmsizetypes:
260
261 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
262
263 .. flat-table:: enum v4l2_frmsizetypes
264     :header-rows:  0
265     :stub-columns: 0
266     :widths:       3 1 4
267
268
269     -  .. row 1
270
271        -  ``V4L2_FRMSIZE_TYPE_DISCRETE``
272
273        -  1
274
275        -  Discrete frame size.
276
277     -  .. row 2
278
279        -  ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
280
281        -  2
282
283        -  Continuous frame size.
284
285     -  .. row 3
286
287        -  ``V4L2_FRMSIZE_TYPE_STEPWISE``
288
289        -  3
290
291        -  Step-wise defined frame size.
292
293
294 Return Value
295 ============
296
297 On success 0 is returned, on error -1 and the ``errno`` variable is set
298 appropriately. The generic error codes are described at the
299 :ref:`Generic Error Codes <gen-errors>` chapter.