1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_ENUM_FRAMEINTERVALS:
5 ********************************
6 ioctl VIDIOC_ENUM_FRAMEINTERVALS
7 ********************************
12 VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
18 .. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp )
19 :name: VIDIOC_ENUM_FRAMEINTERVALS
26 File descriptor returned by :ref:`open() <func-open>`.
29 Pointer to struct :c:type:`v4l2_frmivalenum`
30 that contains a pixel format and size and receives a frame interval.
36 This ioctl allows applications to enumerate all frame intervals that the
37 device supports for the given pixel format and frame size.
39 The supported pixel formats and frame sizes can be obtained by using the
40 :ref:`VIDIOC_ENUM_FMT` and
41 :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
43 The return value and the content of the ``v4l2_frmivalenum.type`` field
44 depend on the type of frame intervals the device supports. Here are the
45 semantics of the function for the different cases:
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_frmivalenum.type` field is set to
51 `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
52 the `discrete` member is valid.
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_frmivalenum.type`` field is set to
57 ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
58 ``stepwise`` member is valid.
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_frmivalenum.type``
63 field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
64 the union only the ``stepwise`` member is valid and the ``step``
67 When the application calls the function with index zero, it must check
68 the ``type`` field to determine the type of frame interval enumeration
69 the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
70 does it make sense to increase the index value to receive more frame
75 The order in which the frame intervals are returned has no
76 special meaning. In particular does it not say anything about potential
77 default frame intervals.
79 Applications can assume that the enumeration data does not change
80 without any interaction from the application itself. This means that the
81 enumeration data is consistent if the application does not perform any
82 other ioctl calls while it runs the frame interval enumeration.
86 **Frame intervals and frame rates:** The V4L2 API uses frame
87 intervals instead of frame rates. Given the frame interval the frame
88 rate can be computed as follows:
92 frame_rate = 1 / frame_interval
98 In the structs below, *IN* denotes a value that has to be filled in by
99 the application, *OUT* denotes values that the driver fills in. The
100 application should zero out all members except for the *IN* fields.
103 .. c:type:: v4l2_frmival_stepwise
105 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
107 .. flat-table:: struct v4l2_frmival_stepwise
112 * - struct :c:type:`v4l2_fract`
114 - Minimum frame interval [s].
115 * - struct :c:type:`v4l2_fract`
117 - Maximum frame interval [s].
118 * - struct :c:type:`v4l2_fract`
120 - Frame interval step size [s].
124 .. c:type:: v4l2_frmivalenum
126 .. tabularcolumns:: |p{1.8cm}|p{4.4cm}|p{2.4cm}|p{8.9cm}|
128 .. flat-table:: struct v4l2_frmivalenum
135 - IN: Index of the given frame interval in the enumeration.
139 - IN: Pixel format for which the frame intervals are enumerated.
143 - IN: Frame width for which the frame intervals are enumerated.
147 - IN: Frame height for which the frame intervals are enumerated.
151 - OUT: Frame interval type the device supports.
155 - OUT: Frame interval with the given index.
157 - struct :c:type:`v4l2_fract`
159 - Frame interval [s].
161 - struct :c:type:`v4l2_frmival_stepwise`
167 - Reserved space for future use. Must be zeroed by drivers and
176 .. c:type:: v4l2_frmivaltypes
178 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
180 .. flat-table:: enum v4l2_frmivaltypes
185 * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
187 - Discrete frame interval.
188 * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
190 - Continuous frame interval.
191 * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
193 - Step-wise defined frame interval.
199 On success 0 is returned, on error -1 and the ``errno`` variable is set
200 appropriately. The generic error codes are described at the
201 :ref:`Generic Error Codes <gen-errors>` chapter.