1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _VIDIOC_ENUM_FRAMESIZES:
6 ****************************
7 ioctl VIDIOC_ENUM_FRAMESIZES
8 ****************************
13 VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
18 .. c:macro:: VIDIOC_ENUM_FRAMESIZES
20 ``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)``
26 File descriptor returned by :c:func:`open()`.
29 Pointer to struct :c:type:`v4l2_frmsizeenum`
30 that contains an index and pixel format and receives a frame width
36 This ioctl allows applications to enumerate all frame sizes (i. e. width
37 and height in pixels) that the device supports for the given pixel
40 The supported pixel formats can be obtained by using the
41 :ref:`VIDIOC_ENUM_FMT` function.
43 The return value and the content of the ``v4l2_frmsizeenum.type`` field
44 depend on the type of frame sizes the device supports. Here are the
45 semantics of the function for the different cases:
47 - **Discrete:** The function returns success if the given index value
48 (zero-based) is valid. The application should increase the index by
49 one for each call until ``EINVAL`` is returned. The
50 ``v4l2_frmsizeenum.type`` field is set to
51 ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
52 ``discrete`` member is valid.
54 - **Step-wise:** The function returns success if the given index value
55 is zero and ``EINVAL`` for any other index value. The
56 ``v4l2_frmsizeenum.type`` field is set to
57 ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
58 ``stepwise`` member is valid.
60 - **Continuous:** This is a special case of the step-wise type above.
61 The function returns success if the given index value is zero and
62 ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
63 field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
64 the union only the ``stepwise`` member is valid and the
65 ``step_width`` and ``step_height`` values are set to 1.
67 When the application calls the function with index zero, it must check
68 the ``type`` field to determine the type of frame size enumeration the
69 device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
70 it make sense to increase the index value to receive more frame sizes.
74 The order in which the frame sizes are returned has no special
75 meaning. In particular does it not say anything about potential default
78 Applications can assume that the enumeration data does not change
79 without any interaction from the application itself. This means that the
80 enumeration data is consistent if the application does not perform any
81 other ioctl calls while it runs the frame size enumeration.
86 In the structs below, *IN* denotes a value that has to be filled in by
87 the application, *OUT* denotes values that the driver fills in. The
88 application should zero out all members except for the *IN* fields.
90 .. c:type:: v4l2_frmsize_discrete
92 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
94 .. flat-table:: struct v4l2_frmsize_discrete
101 - Width of the frame [pixel].
104 - Height of the frame [pixel].
107 .. c:type:: v4l2_frmsize_stepwise
109 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
111 .. flat-table:: struct v4l2_frmsize_stepwise
118 - Minimum frame width [pixel].
121 - Maximum frame width [pixel].
124 - Frame width step size [pixel].
127 - Minimum frame height [pixel].
130 - Maximum frame height [pixel].
133 - Frame height step size [pixel].
136 .. c:type:: v4l2_frmsizeenum
138 .. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}|
140 .. flat-table:: struct v4l2_frmsizeenum
146 - IN: Index of the given frame size in the enumeration.
149 - IN: Pixel format for which the frame sizes are enumerated.
152 - OUT: Frame size type the device supports.
155 - OUT: Frame size with the given index.
156 * - struct :c:type:`v4l2_frmsize_discrete`
159 * - struct :c:type:`v4l2_frmsize_stepwise`
167 - Reserved space for future use. Must be zeroed by drivers and
174 .. c:type:: v4l2_frmsizetypes
176 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
178 .. flat-table:: enum v4l2_frmsizetypes
183 * - ``V4L2_FRMSIZE_TYPE_DISCRETE``
185 - Discrete frame size.
186 * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
188 - Continuous frame size.
189 * - ``V4L2_FRMSIZE_TYPE_STEPWISE``
191 - Step-wise defined frame size.
196 On success 0 is returned, on error -1 and the ``errno`` variable is set
197 appropriately. The generic error codes are described at the
198 :ref:`Generic Error Codes <gen-errors>` chapter.