^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _VIDIOC_ENUM_FRAMEINTERVALS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ********************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ioctl VIDIOC_ENUM_FRAMEINTERVALS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ********************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Pointer to struct :c:type:`v4l2_frmivalenum`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) that contains a pixel format and size and receives a frame interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) This ioctl allows applications to enumerate all frame intervals that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) device supports for the given pixel format and frame size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) The supported pixel formats and frame sizes can be obtained by using the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) :ref:`VIDIOC_ENUM_FMT` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) The return value and the content of the ``v4l2_frmivalenum.type`` field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) depend on the type of frame intervals the device supports. Here are the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) semantics of the function for the different cases:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) - **Discrete:** The function returns success if the given index value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) (zero-based) is valid. The application should increase the index by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) one for each call until ``EINVAL`` is returned. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) `v4l2_frmivalenum.type` field is set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) the `discrete` member is valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) - **Step-wise:** The function returns success if the given index value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) is zero and ``EINVAL`` for any other index value. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ``v4l2_frmivalenum.type`` field is set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ``stepwise`` member is valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) - **Continuous:** This is a special case of the step-wise type above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) The function returns success if the given index value is zero and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) the union only the ``stepwise`` member is valid and the ``step``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) value is set to 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) When the application calls the function with index zero, it must check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) the ``type`` field to determine the type of frame interval enumeration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) does it make sense to increase the index value to receive more frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) intervals.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) The order in which the frame intervals are returned has no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) special meaning. In particular does it not say anything about potential
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) default frame intervals.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Applications can assume that the enumeration data does not change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) without any interaction from the application itself. This means that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) enumeration data is consistent if the application does not perform any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) other ioctl calls while it runs the frame interval enumeration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) **Frame intervals and frame rates:** The V4L2 API uses frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) intervals instead of frame rates. Given the frame interval the frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) rate can be computed as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) frame_rate = 1 / frame_interval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) Structs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) In the structs below, *IN* denotes a value that has to be filled in by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) the application, *OUT* denotes values that the driver fills in. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) application should zero out all members except for the *IN* fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) .. c:type:: v4l2_frmival_stepwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) .. flat-table:: struct v4l2_frmival_stepwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) :widths: 1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * - struct :c:type:`v4l2_fract`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) - ``min``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) - Minimum frame interval [s].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * - struct :c:type:`v4l2_fract`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - ``max``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) - Maximum frame interval [s].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * - struct :c:type:`v4l2_fract`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) - ``step``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) - Frame interval step size [s].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) .. c:type:: v4l2_frmivalenum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) .. tabularcolumns:: |p{1.8cm}|p{4.4cm}|p{2.4cm}|p{8.9cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) .. flat-table:: struct v4l2_frmivalenum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) - ``index``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) - IN: Index of the given frame interval in the enumeration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) - ``pixel_format``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) - IN: Pixel format for which the frame intervals are enumerated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) - ``width``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) - IN: Frame width for which the frame intervals are enumerated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) - ``height``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) - IN: Frame height for which the frame intervals are enumerated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) - ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) - OUT: Frame interval type the device supports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * - union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) - (anonymous)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) - OUT: Frame interval with the given index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * - struct :c:type:`v4l2_fract`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) - ``discrete``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) - Frame interval [s].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * - struct :c:type:`v4l2_frmival_stepwise`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) - ``stepwise``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * - }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) - ``reserved[2]``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) - Reserved space for future use. Must be zeroed by drivers and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) applications.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) Enums
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) =====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .. c:type:: v4l2_frmivaltypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .. flat-table:: enum v4l2_frmivaltypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) :widths: 3 1 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) - Discrete frame interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) - 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) - Continuous frame interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) - 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) - Step-wise defined frame interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) :ref:`Generic Error Codes <gen-errors>` chapter.