1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/userspace-api/media/fdl-appendix.rst.
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
10 .. _VIDIOC_ENUM_FRAMEINTERVALS:
12 ********************************
13 ioctl VIDIOC_ENUM_FRAMEINTERVALS
14 ********************************
19 VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
25 .. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp )
26 :name: VIDIOC_ENUM_FRAMEINTERVALS
33 File descriptor returned by :ref:`open() <func-open>`.
36 Pointer to struct :c:type:`v4l2_frmivalenum`
37 that contains a pixel format and size and receives a frame interval.
43 This ioctl allows applications to enumerate all frame intervals that the
44 device supports for the given pixel format and frame size.
46 The supported pixel formats and frame sizes can be obtained by using the
47 :ref:`VIDIOC_ENUM_FMT` and
48 :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
50 The return value and the content of the ``v4l2_frmivalenum.type`` field
51 depend on the type of frame intervals the device supports. Here are the
52 semantics of the function for the different cases:
54 - **Discrete:** The function returns success if the given index value
55 (zero-based) is valid. The application should increase the index by
56 one for each call until ``EINVAL`` is returned. The
57 `v4l2_frmivalenum.type` field is set to
58 `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
59 the `discrete` member is valid.
61 - **Step-wise:** The function returns success if the given index value
62 is zero and ``EINVAL`` for any other index value. The
63 ``v4l2_frmivalenum.type`` field is set to
64 ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
65 ``stepwise`` member is valid.
67 - **Continuous:** This is a special case of the step-wise type above.
68 The function returns success if the given index value is zero and
69 ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
70 field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
71 the union only the ``stepwise`` member is valid and the ``step``
74 When the application calls the function with index zero, it must check
75 the ``type`` field to determine the type of frame interval enumeration
76 the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
77 does it make sense to increase the index value to receive more frame
82 The order in which the frame intervals are returned has no
83 special meaning. In particular does it not say anything about potential
84 default frame intervals.
86 Applications can assume that the enumeration data does not change
87 without any interaction from the application itself. This means that the
88 enumeration data is consistent if the application does not perform any
89 other ioctl calls while it runs the frame interval enumeration.
93 **Frame intervals and frame rates:** The V4L2 API uses frame
94 intervals instead of frame rates. Given the frame interval the frame
95 rate can be computed as follows:
99 frame_rate = 1 / frame_interval
105 In the structs below, *IN* denotes a value that has to be filled in by
106 the application, *OUT* denotes values that the driver fills in. The
107 application should zero out all members except for the *IN* fields.
110 .. c:type:: v4l2_frmival_stepwise
112 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
114 .. flat-table:: struct v4l2_frmival_stepwise
119 * - struct :c:type:`v4l2_fract`
121 - Minimum frame interval [s].
122 * - struct :c:type:`v4l2_fract`
124 - Maximum frame interval [s].
125 * - struct :c:type:`v4l2_fract`
127 - Frame interval step size [s].
131 .. c:type:: v4l2_frmivalenum
133 .. tabularcolumns:: |p{1.8cm}|p{4.4cm}|p{2.4cm}|p{8.9cm}|
135 .. flat-table:: struct v4l2_frmivalenum
141 - IN: Index of the given frame interval in the enumeration.
144 - IN: Pixel format for which the frame intervals are enumerated.
147 - IN: Frame width for which the frame intervals are enumerated.
150 - IN: Frame height for which the frame intervals are enumerated.
153 - OUT: Frame interval type the device supports.
156 - OUT: Frame interval with the given index.
157 * - struct :c:type:`v4l2_fract`
159 - Frame interval [s].
160 * - struct :c:type:`v4l2_frmival_stepwise`
169 - Reserved space for future use. Must be zeroed by drivers and
178 .. c:type:: v4l2_frmivaltypes
180 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
182 .. flat-table:: enum v4l2_frmivaltypes
187 * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
189 - Discrete frame interval.
190 * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
192 - Continuous frame interval.
193 * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
195 - Step-wise defined frame interval.
201 On success 0 is returned, on error -1 and the ``errno`` variable is set
202 appropriately. The generic error codes are described at the
203 :ref:`Generic Error Codes <gen-errors>` chapter.