187 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_ENUM_FRAMEINTERVALS:5 6********************************7ioctl VIDIOC_ENUM_FRAMEINTERVALS8********************************9 10Name11====12 13VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals14 15Synopsis16========17 18.. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS19 20``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``21 22Arguments23=========24 25``fd``26 File descriptor returned by :c:func:`open()`.27 28``argp``29 Pointer to struct :c:type:`v4l2_frmivalenum`30 that contains a pixel format and size and receives a frame interval.31 32Description33===========34 35This ioctl allows applications to enumerate all frame intervals that the36device supports for the given pixel format and frame size.37 38The supported pixel formats and frame sizes can be obtained by using the39:ref:`VIDIOC_ENUM_FMT` and40:ref:`VIDIOC_ENUM_FRAMESIZES` functions.41 42The return value and the content of the ``v4l2_frmivalenum.type`` field43depend on the type of frame intervals the device supports. Here are the44semantics of the function for the different cases:45 46- **Discrete:** The function returns success if the given index value47 (zero-based) is valid. The application should increase the index by48 one for each call until ``EINVAL`` is returned. The49 `v4l2_frmivalenum.type` field is set to50 `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only51 the `discrete` member is valid.52 53- **Step-wise:** The function returns success if the given index value54 is zero and ``EINVAL`` for any other index value. The55 ``v4l2_frmivalenum.type`` field is set to56 ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the57 ``stepwise`` member is valid.58 59- **Continuous:** This is a special case of the step-wise type above.60 The function returns success if the given index value is zero and61 ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``62 field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of63 the union only the ``stepwise`` member is valid and the ``step``64 value is set to 1.65 66When the application calls the function with index zero, it must check67the ``type`` field to determine the type of frame interval enumeration68the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type69does it make sense to increase the index value to receive more frame70intervals.71 72.. note::73 74 The order in which the frame intervals are returned has no75 special meaning. In particular does it not say anything about potential76 default frame intervals.77 78Applications can assume that the enumeration data does not change79without any interaction from the application itself. This means that the80enumeration data is consistent if the application does not perform any81other ioctl calls while it runs the frame interval enumeration.82 83.. note::84 85 **Frame intervals and frame rates:** The V4L2 API uses frame86 intervals instead of frame rates. Given the frame interval the frame87 rate can be computed as follows:88 89 ::90 91 frame_rate = 1 / frame_interval92 93Structs94=======95 96In the structs below, *IN* denotes a value that has to be filled in by97the application, *OUT* denotes values that the driver fills in. The98application should zero out all members except for the *IN* fields.99 100.. c:type:: v4l2_frmival_stepwise101 102.. flat-table:: struct v4l2_frmival_stepwise103 :header-rows: 0104 :stub-columns: 0105 :widths: 1 1 2106 107 * - struct :c:type:`v4l2_fract`108 - ``min``109 - Minimum frame interval [s].110 * - struct :c:type:`v4l2_fract`111 - ``max``112 - Maximum frame interval [s].113 * - struct :c:type:`v4l2_fract`114 - ``step``115 - Frame interval step size [s].116 117 118.. c:type:: v4l2_frmivalenum119 120.. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}|121 122.. flat-table:: struct v4l2_frmivalenum123 :header-rows: 0124 :stub-columns: 0125 126 * - __u32127 - ``index``128 - IN: Index of the given frame interval in the enumeration.129 * - __u32130 - ``pixel_format``131 - IN: Pixel format for which the frame intervals are enumerated.132 * - __u32133 - ``width``134 - IN: Frame width for which the frame intervals are enumerated.135 * - __u32136 - ``height``137 - IN: Frame height for which the frame intervals are enumerated.138 * - __u32139 - ``type``140 - OUT: Frame interval type the device supports.141 * - union {142 - (anonymous)143 - OUT: Frame interval with the given index.144 * - struct :c:type:`v4l2_fract`145 - ``discrete``146 - Frame interval [s].147 * - struct :c:type:`v4l2_frmival_stepwise`148 - ``stepwise``149 -150 * - }151 -152 -153 * - __u32154 - ``reserved[2]``155 - Reserved space for future use. Must be zeroed by drivers and156 applications.157 158 159Enums160=====161 162.. c:type:: v4l2_frmivaltypes163 164.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|165 166.. flat-table:: enum v4l2_frmivaltypes167 :header-rows: 0168 :stub-columns: 0169 :widths: 3 1 4170 171 * - ``V4L2_FRMIVAL_TYPE_DISCRETE``172 - 1173 - Discrete frame interval.174 * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``175 - 2176 - Continuous frame interval.177 * - ``V4L2_FRMIVAL_TYPE_STEPWISE``178 - 3179 - Step-wise defined frame interval.180 181Return Value182============183 184On success 0 is returned, on error -1 and the ``errno`` variable is set185appropriately. The generic error codes are described at the186:ref:`Generic Error Codes <gen-errors>` chapter.187