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