Merge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
[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:: The order in which the frame sizes are returned has no special
76    meaning. In particular does it not say anything about potential default
77    format sizes.
78
79 Applications can assume that the enumeration data does not change
80 without any interaction from the application itself. This means that the
81 enumeration data is consistent if the application does not perform any
82 other ioctl calls while it runs the frame size enumeration.
83
84
85 Structs
86 =======
87
88 In the structs below, *IN* denotes a value that has to be filled in by
89 the application, *OUT* denotes values that the driver fills in. The
90 application should zero out all members except for the *IN* fields.
91
92
93 .. _v4l2-frmsize-discrete:
94
95 .. flat-table:: struct v4l2_frmsize_discrete
96     :header-rows:  0
97     :stub-columns: 0
98     :widths:       1 1 2
99
100
101     -  .. row 1
102
103        -  __u32
104
105        -  ``width``
106
107        -  Width of the frame [pixel].
108
109     -  .. row 2
110
111        -  __u32
112
113        -  ``height``
114
115        -  Height of the frame [pixel].
116
117
118
119 .. _v4l2-frmsize-stepwise:
120
121 .. flat-table:: struct v4l2_frmsize_stepwise
122     :header-rows:  0
123     :stub-columns: 0
124     :widths:       1 1 2
125
126
127     -  .. row 1
128
129        -  __u32
130
131        -  ``min_width``
132
133        -  Minimum frame width [pixel].
134
135     -  .. row 2
136
137        -  __u32
138
139        -  ``max_width``
140
141        -  Maximum frame width [pixel].
142
143     -  .. row 3
144
145        -  __u32
146
147        -  ``step_width``
148
149        -  Frame width step size [pixel].
150
151     -  .. row 4
152
153        -  __u32
154
155        -  ``min_height``
156
157        -  Minimum frame height [pixel].
158
159     -  .. row 5
160
161        -  __u32
162
163        -  ``max_height``
164
165        -  Maximum frame height [pixel].
166
167     -  .. row 6
168
169        -  __u32
170
171        -  ``step_height``
172
173        -  Frame height step size [pixel].
174
175
176
177 .. _v4l2-frmsizeenum:
178
179 .. flat-table:: struct v4l2_frmsizeenum
180     :header-rows:  0
181     :stub-columns: 0
182
183
184     -  .. row 1
185
186        -  __u32
187
188        -  ``index``
189
190        -
191        -  IN: Index of the given frame size in the enumeration.
192
193     -  .. row 2
194
195        -  __u32
196
197        -  ``pixel_format``
198
199        -
200        -  IN: Pixel format for which the frame sizes are enumerated.
201
202     -  .. row 3
203
204        -  __u32
205
206        -  ``type``
207
208        -
209        -  OUT: Frame size type the device supports.
210
211     -  .. row 4
212
213        -  union
214
215        -
216        -
217        -  OUT: Frame size with the given index.
218
219     -  .. row 5
220
221        -
222        -  struct :ref:`v4l2_frmsize_discrete <v4l2-frmsize-discrete>`
223
224        -  ``discrete``
225
226        -
227
228     -  .. row 6
229
230        -
231        -  struct :ref:`v4l2_frmsize_stepwise <v4l2-frmsize-stepwise>`
232
233        -  ``stepwise``
234
235        -
236
237     -  .. row 7
238
239        -  __u32
240
241        -  ``reserved[2]``
242
243        -
244        -  Reserved space for future use. Must be zeroed by drivers and
245           applications.
246
247
248
249 Enums
250 =====
251
252
253 .. _v4l2-frmsizetypes:
254
255 .. flat-table:: enum v4l2_frmsizetypes
256     :header-rows:  0
257     :stub-columns: 0
258     :widths:       3 1 4
259
260
261     -  .. row 1
262
263        -  ``V4L2_FRMSIZE_TYPE_DISCRETE``
264
265        -  1
266
267        -  Discrete frame size.
268
269     -  .. row 2
270
271        -  ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
272
273        -  2
274
275        -  Continuous frame size.
276
277     -  .. row 3
278
279        -  ``V4L2_FRMSIZE_TYPE_STEPWISE``
280
281        -  3
282
283        -  Step-wise defined frame size.
284
285
286 Return Value
287 ============
288
289 On success 0 is returned, on error -1 and the ``errno`` variable is set
290 appropriately. The generic error codes are described at the
291 :ref:`Generic Error Codes <gen-errors>` chapter.