1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _VIDIOC_ENUM_FRAMEINTERVALS:
6 ********************************
7 ioctl VIDIOC_ENUM_FRAMEINTERVALS
8 ********************************
13 VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
18 .. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS
20 ``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``
26 File descriptor returned by :c:func:`open()`.
29 Pointer to struct :c:type:`v4l2_frmivalenum`
30 that contains a pixel format and size and receives a frame interval.
35 This ioctl allows applications to enumerate all frame intervals that the
36 device supports for the given pixel format and frame size.
38 The supported pixel formats and frame sizes can be obtained by using the
39 :ref:`VIDIOC_ENUM_FMT` and
40 :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
42 The return value and the content of the ``v4l2_frmivalenum.type`` field
43 depend on the type of frame intervals the device supports. Here are the
44 semantics of the function for the different cases:
46 - **Discrete:** The function returns success if the given index value
47 (zero-based) is valid. The application should increase the index by
48 one for each call until ``EINVAL`` is returned. The
49 `v4l2_frmivalenum.type` field is set to
50 `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
51 the `discrete` member is valid.
53 - **Step-wise:** The function returns success if the given index value
54 is zero and ``EINVAL`` for any other index value. The
55 ``v4l2_frmivalenum.type`` field is set to
56 ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
57 ``stepwise`` member is valid.
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 and
61 ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
62 field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
63 the union only the ``stepwise`` member is valid and the ``step``
66 When the application calls the function with index zero, it must check
67 the ``type`` field to determine the type of frame interval enumeration
68 the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
69 does it make sense to increase the index value to receive more frame
74 The order in which the frame intervals are returned has no
75 special meaning. In particular does it not say anything about potential
76 default frame intervals.
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 interval enumeration.
85 **Frame intervals and frame rates:** The V4L2 API uses frame
86 intervals instead of frame rates. Given the frame interval the frame
87 rate can be computed as follows:
91 frame_rate = 1 / frame_interval
96 In the structs below, *IN* denotes a value that has to be filled in by
97 the application, *OUT* denotes values that the driver fills in. The
98 application should zero out all members except for the *IN* fields.
100 .. c:type:: v4l2_frmival_stepwise
102 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
104 .. flat-table:: struct v4l2_frmival_stepwise
109 * - struct :c:type:`v4l2_fract`
111 - Minimum frame interval [s].
112 * - struct :c:type:`v4l2_fract`
114 - Maximum frame interval [s].
115 * - struct :c:type:`v4l2_fract`
117 - Frame interval step size [s].
120 .. c:type:: v4l2_frmivalenum
122 .. tabularcolumns:: |p{1.8cm}|p{4.4cm}|p{2.4cm}|p{8.9cm}|
124 .. flat-table:: struct v4l2_frmivalenum
130 - IN: Index of the given frame interval in the enumeration.
133 - IN: Pixel format for which the frame intervals are enumerated.
136 - IN: Frame width for which the frame intervals are enumerated.
139 - IN: Frame height for which the frame intervals are enumerated.
142 - OUT: Frame interval type the device supports.
145 - OUT: Frame interval with the given index.
146 * - struct :c:type:`v4l2_fract`
148 - Frame interval [s].
149 * - struct :c:type:`v4l2_frmival_stepwise`
158 - Reserved space for future use. Must be zeroed by drivers and
165 .. c:type:: v4l2_frmivaltypes
167 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
169 .. flat-table:: enum v4l2_frmivaltypes
174 * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
176 - Discrete frame interval.
177 * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
179 - Continuous frame interval.
180 * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
182 - Step-wise defined frame interval.
187 On success 0 is returned, on error -1 and the ``errno`` variable is set
188 appropriately. The generic error codes are described at the
189 :ref:`Generic Error Codes <gen-errors>` chapter.