1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2.. c:namespace:: V4L 3 4.. _VIDIOC_ENUM_FRAMESIZES: 5 6**************************** 7ioctl VIDIOC_ENUM_FRAMESIZES 8**************************** 9 10Name 11==== 12 13VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes 14 15Synopsis 16======== 17 18.. c:macro:: VIDIOC_ENUM_FRAMESIZES 19 20``int ioctl(int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp)`` 21 22Arguments 23========= 24 25``fd`` 26 File descriptor returned by :c:func:`open()`. 27 28``argp`` 29 Pointer to struct :c:type:`v4l2_frmsizeenum` 30 that contains an index and pixel format and receives a frame width 31 and height. 32 33Description 34=========== 35 36This ioctl allows applications to enumerate all frame sizes (i. e. width 37and height in pixels) that the device supports for the given pixel 38format. 39 40The supported pixel formats can be obtained by using the 41:ref:`VIDIOC_ENUM_FMT` function. 42 43The return value and the content of the ``v4l2_frmsizeenum.type`` field 44depend on the type of frame sizes the device supports. Here are the 45semantics of the function for the different cases: 46 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. 53 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. 59 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. 66 67When the application calls the function with index zero, it must check 68the ``type`` field to determine the type of frame size enumeration the 69device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does 70it make sense to increase the index value to receive more frame sizes. 71 72.. note:: 73 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 76 format sizes. 77 78Applications can assume that the enumeration data does not change 79without any interaction from the application itself. This means that the 80enumeration data is consistent if the application does not perform any 81other ioctl calls while it runs the frame size enumeration. 82 83Structs 84======= 85 86In the structs below, *IN* denotes a value that has to be filled in by 87the application, *OUT* denotes values that the driver fills in. The 88application should zero out all members except for the *IN* fields. 89 90.. c:type:: v4l2_frmsize_discrete 91 92.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 93 94.. flat-table:: struct v4l2_frmsize_discrete 95 :header-rows: 0 96 :stub-columns: 0 97 :widths: 1 1 2 98 99 * - __u32 100 - ``width`` 101 - Width of the frame [pixel]. 102 * - __u32 103 - ``height`` 104 - Height of the frame [pixel]. 105 106 107.. c:type:: v4l2_frmsize_stepwise 108 109.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 110 111.. flat-table:: struct v4l2_frmsize_stepwise 112 :header-rows: 0 113 :stub-columns: 0 114 :widths: 1 1 2 115 116 * - __u32 117 - ``min_width`` 118 - Minimum frame width [pixel]. 119 * - __u32 120 - ``max_width`` 121 - Maximum frame width [pixel]. 122 * - __u32 123 - ``step_width`` 124 - Frame width step size [pixel]. 125 * - __u32 126 - ``min_height`` 127 - Minimum frame height [pixel]. 128 * - __u32 129 - ``max_height`` 130 - Maximum frame height [pixel]. 131 * - __u32 132 - ``step_height`` 133 - Frame height step size [pixel]. 134 135 136.. c:type:: v4l2_frmsizeenum 137 138.. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}| 139 140.. flat-table:: struct v4l2_frmsizeenum 141 :header-rows: 0 142 :stub-columns: 0 143 144 * - __u32 145 - ``index`` 146 - IN: Index of the given frame size in the enumeration. 147 * - __u32 148 - ``pixel_format`` 149 - IN: Pixel format for which the frame sizes are enumerated. 150 * - __u32 151 - ``type`` 152 - OUT: Frame size type the device supports. 153 * - union { 154 - (anonymous) 155 - OUT: Frame size with the given index. 156 * - struct :c:type:`v4l2_frmsize_discrete` 157 - ``discrete`` 158 - 159 * - struct :c:type:`v4l2_frmsize_stepwise` 160 - ``stepwise`` 161 - 162 * - } 163 - 164 - 165 * - __u32 166 - ``reserved[2]`` 167 - Reserved space for future use. Must be zeroed by drivers and 168 applications. 169 170 171Enums 172===== 173 174.. c:type:: v4l2_frmsizetypes 175 176.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 177 178.. flat-table:: enum v4l2_frmsizetypes 179 :header-rows: 0 180 :stub-columns: 0 181 :widths: 3 1 4 182 183 * - ``V4L2_FRMSIZE_TYPE_DISCRETE`` 184 - 1 185 - Discrete frame size. 186 * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` 187 - 2 188 - Continuous frame size. 189 * - ``V4L2_FRMSIZE_TYPE_STEPWISE`` 190 - 3 191 - Step-wise defined frame size. 192 193Return Value 194============ 195 196On success 0 is returned, on error -1 and the ``errno`` variable is set 197appropriately. The generic error codes are described at the 198:ref:`Generic Error Codes <gen-errors>` chapter. 199