162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_ENUM_FRAMEINTERVALS:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci********************************
762306a36Sopenharmony_ciioctl VIDIOC_ENUM_FRAMEINTERVALS
862306a36Sopenharmony_ci********************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciArguments
2362306a36Sopenharmony_ci=========
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci``fd``
2662306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci``argp``
2962306a36Sopenharmony_ci    Pointer to struct :c:type:`v4l2_frmivalenum`
3062306a36Sopenharmony_ci    that contains a pixel format and size and receives a frame interval.
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciDescription
3362306a36Sopenharmony_ci===========
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciThis ioctl allows applications to enumerate all frame intervals that the
3662306a36Sopenharmony_cidevice supports for the given pixel format and frame size.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciThe supported pixel formats and frame sizes can be obtained by using the
3962306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FMT` and
4062306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FRAMESIZES` functions.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciThe return value and the content of the ``v4l2_frmivalenum.type`` field
4362306a36Sopenharmony_cidepend on the type of frame intervals the device supports. Here are the
4462306a36Sopenharmony_cisemantics of the function for the different cases:
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci-  **Discrete:** The function returns success if the given index value
4762306a36Sopenharmony_ci   (zero-based) is valid. The application should increase the index by
4862306a36Sopenharmony_ci   one for each call until ``EINVAL`` is returned. The
4962306a36Sopenharmony_ci   `v4l2_frmivalenum.type` field is set to
5062306a36Sopenharmony_ci   `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
5162306a36Sopenharmony_ci   the `discrete` member is valid.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci-  **Step-wise:** The function returns success if the given index value
5462306a36Sopenharmony_ci   is zero and ``EINVAL`` for any other index value. The
5562306a36Sopenharmony_ci   ``v4l2_frmivalenum.type`` field is set to
5662306a36Sopenharmony_ci   ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
5762306a36Sopenharmony_ci   ``stepwise`` member is valid.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci-  **Continuous:** This is a special case of the step-wise type above.
6062306a36Sopenharmony_ci   The function returns success if the given index value is zero and
6162306a36Sopenharmony_ci   ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
6262306a36Sopenharmony_ci   field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
6362306a36Sopenharmony_ci   the union only the ``stepwise`` member is valid and the ``step``
6462306a36Sopenharmony_ci   value is set to 1.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciWhen the application calls the function with index zero, it must check
6762306a36Sopenharmony_cithe ``type`` field to determine the type of frame interval enumeration
6862306a36Sopenharmony_cithe device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
6962306a36Sopenharmony_cidoes it make sense to increase the index value to receive more frame
7062306a36Sopenharmony_ciintervals.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci.. note::
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci   The order in which the frame intervals are returned has no
7562306a36Sopenharmony_ci   special meaning. In particular does it not say anything about potential
7662306a36Sopenharmony_ci   default frame intervals.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciApplications can assume that the enumeration data does not change
7962306a36Sopenharmony_ciwithout any interaction from the application itself. This means that the
8062306a36Sopenharmony_cienumeration data is consistent if the application does not perform any
8162306a36Sopenharmony_ciother ioctl calls while it runs the frame interval enumeration.
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci.. note::
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci   **Frame intervals and frame rates:** The V4L2 API uses frame
8662306a36Sopenharmony_ci   intervals instead of frame rates. Given the frame interval the frame
8762306a36Sopenharmony_ci   rate can be computed as follows:
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci   ::
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci       frame_rate = 1 / frame_interval
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciStructs
9462306a36Sopenharmony_ci=======
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ciIn the structs below, *IN* denotes a value that has to be filled in by
9762306a36Sopenharmony_cithe application, *OUT* denotes values that the driver fills in. The
9862306a36Sopenharmony_ciapplication should zero out all members except for the *IN* fields.
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci.. c:type:: v4l2_frmival_stepwise
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci.. flat-table:: struct v4l2_frmival_stepwise
10362306a36Sopenharmony_ci    :header-rows:  0
10462306a36Sopenharmony_ci    :stub-columns: 0
10562306a36Sopenharmony_ci    :widths:       1 1 2
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci    * - struct :c:type:`v4l2_fract`
10862306a36Sopenharmony_ci      - ``min``
10962306a36Sopenharmony_ci      - Minimum frame interval [s].
11062306a36Sopenharmony_ci    * - struct :c:type:`v4l2_fract`
11162306a36Sopenharmony_ci      - ``max``
11262306a36Sopenharmony_ci      - Maximum frame interval [s].
11362306a36Sopenharmony_ci    * - struct :c:type:`v4l2_fract`
11462306a36Sopenharmony_ci      - ``step``
11562306a36Sopenharmony_ci      - Frame interval step size [s].
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci.. c:type:: v4l2_frmivalenum
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci.. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}|
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci.. flat-table:: struct v4l2_frmivalenum
12362306a36Sopenharmony_ci    :header-rows:  0
12462306a36Sopenharmony_ci    :stub-columns: 0
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci    * - __u32
12762306a36Sopenharmony_ci      - ``index``
12862306a36Sopenharmony_ci      - IN: Index of the given frame interval in the enumeration.
12962306a36Sopenharmony_ci    * - __u32
13062306a36Sopenharmony_ci      - ``pixel_format``
13162306a36Sopenharmony_ci      - IN: Pixel format for which the frame intervals are enumerated.
13262306a36Sopenharmony_ci    * - __u32
13362306a36Sopenharmony_ci      - ``width``
13462306a36Sopenharmony_ci      - IN: Frame width for which the frame intervals are enumerated.
13562306a36Sopenharmony_ci    * - __u32
13662306a36Sopenharmony_ci      - ``height``
13762306a36Sopenharmony_ci      - IN: Frame height for which the frame intervals are enumerated.
13862306a36Sopenharmony_ci    * - __u32
13962306a36Sopenharmony_ci      - ``type``
14062306a36Sopenharmony_ci      - OUT: Frame interval type the device supports.
14162306a36Sopenharmony_ci    * - union {
14262306a36Sopenharmony_ci      - (anonymous)
14362306a36Sopenharmony_ci      - OUT: Frame interval with the given index.
14462306a36Sopenharmony_ci    * - struct :c:type:`v4l2_fract`
14562306a36Sopenharmony_ci      - ``discrete``
14662306a36Sopenharmony_ci      - Frame interval [s].
14762306a36Sopenharmony_ci    * - struct :c:type:`v4l2_frmival_stepwise`
14862306a36Sopenharmony_ci      - ``stepwise``
14962306a36Sopenharmony_ci      -
15062306a36Sopenharmony_ci    * - }
15162306a36Sopenharmony_ci      -
15262306a36Sopenharmony_ci      -
15362306a36Sopenharmony_ci    * - __u32
15462306a36Sopenharmony_ci      - ``reserved[2]``
15562306a36Sopenharmony_ci      - Reserved space for future use. Must be zeroed by drivers and
15662306a36Sopenharmony_ci	applications.
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ciEnums
16062306a36Sopenharmony_ci=====
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci.. c:type:: v4l2_frmivaltypes
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci.. flat-table:: enum v4l2_frmivaltypes
16762306a36Sopenharmony_ci    :header-rows:  0
16862306a36Sopenharmony_ci    :stub-columns: 0
16962306a36Sopenharmony_ci    :widths:       3 1 4
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci    * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
17262306a36Sopenharmony_ci      - 1
17362306a36Sopenharmony_ci      - Discrete frame interval.
17462306a36Sopenharmony_ci    * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
17562306a36Sopenharmony_ci      - 2
17662306a36Sopenharmony_ci      - Continuous frame interval.
17762306a36Sopenharmony_ci    * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
17862306a36Sopenharmony_ci      - 3
17962306a36Sopenharmony_ci      - Step-wise defined frame interval.
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ciReturn Value
18262306a36Sopenharmony_ci============
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
18562306a36Sopenharmony_ciappropriately. The generic error codes are described at the
18662306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
187