1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _VIDIOC_ENUM_FRAMEINTERVALS: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab******************************** 754f38fcaSMauro Carvalho Chehabioctl VIDIOC_ENUM_FRAMEINTERVALS 854f38fcaSMauro Carvalho Chehab******************************** 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab==== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabVIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab======== 1754f38fcaSMauro Carvalho Chehab 18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS 1954f38fcaSMauro Carvalho Chehab 20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)`` 2154f38fcaSMauro Carvalho Chehab 2254f38fcaSMauro Carvalho ChehabArguments 2354f38fcaSMauro Carvalho Chehab========= 2454f38fcaSMauro Carvalho Chehab 2554f38fcaSMauro Carvalho Chehab``fd`` 26407e84cdSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 2754f38fcaSMauro Carvalho Chehab 2854f38fcaSMauro Carvalho Chehab``argp`` 2954f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`v4l2_frmivalenum` 3054f38fcaSMauro Carvalho Chehab that contains a pixel format and size and receives a frame interval. 3154f38fcaSMauro Carvalho Chehab 3254f38fcaSMauro Carvalho ChehabDescription 3354f38fcaSMauro Carvalho Chehab=========== 3454f38fcaSMauro Carvalho Chehab 3554f38fcaSMauro Carvalho ChehabThis ioctl allows applications to enumerate all frame intervals that the 3654f38fcaSMauro Carvalho Chehabdevice supports for the given pixel format and frame size. 3754f38fcaSMauro Carvalho Chehab 3854f38fcaSMauro Carvalho ChehabThe supported pixel formats and frame sizes can be obtained by using the 3954f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_ENUM_FMT` and 4054f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_ENUM_FRAMESIZES` functions. 4154f38fcaSMauro Carvalho Chehab 4254f38fcaSMauro Carvalho ChehabThe return value and the content of the ``v4l2_frmivalenum.type`` field 4354f38fcaSMauro Carvalho Chehabdepend on the type of frame intervals the device supports. Here are the 4454f38fcaSMauro Carvalho Chehabsemantics of the function for the different cases: 4554f38fcaSMauro Carvalho Chehab 4654f38fcaSMauro Carvalho Chehab- **Discrete:** The function returns success if the given index value 4754f38fcaSMauro Carvalho Chehab (zero-based) is valid. The application should increase the index by 4854f38fcaSMauro Carvalho Chehab one for each call until ``EINVAL`` is returned. The 4954f38fcaSMauro Carvalho Chehab `v4l2_frmivalenum.type` field is set to 5054f38fcaSMauro Carvalho Chehab `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only 5154f38fcaSMauro Carvalho Chehab the `discrete` member is valid. 5254f38fcaSMauro Carvalho Chehab 5354f38fcaSMauro Carvalho Chehab- **Step-wise:** The function returns success if the given index value 5454f38fcaSMauro Carvalho Chehab is zero and ``EINVAL`` for any other index value. The 5554f38fcaSMauro Carvalho Chehab ``v4l2_frmivalenum.type`` field is set to 5654f38fcaSMauro Carvalho Chehab ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the 5754f38fcaSMauro Carvalho Chehab ``stepwise`` member is valid. 5854f38fcaSMauro Carvalho Chehab 5954f38fcaSMauro Carvalho Chehab- **Continuous:** This is a special case of the step-wise type above. 6054f38fcaSMauro Carvalho Chehab The function returns success if the given index value is zero and 6154f38fcaSMauro Carvalho Chehab ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type`` 6254f38fcaSMauro Carvalho Chehab field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of 6354f38fcaSMauro Carvalho Chehab the union only the ``stepwise`` member is valid and the ``step`` 6454f38fcaSMauro Carvalho Chehab value is set to 1. 6554f38fcaSMauro Carvalho Chehab 6654f38fcaSMauro Carvalho ChehabWhen the application calls the function with index zero, it must check 6754f38fcaSMauro Carvalho Chehabthe ``type`` field to determine the type of frame interval enumeration 6854f38fcaSMauro Carvalho Chehabthe device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type 6954f38fcaSMauro Carvalho Chehabdoes it make sense to increase the index value to receive more frame 7054f38fcaSMauro Carvalho Chehabintervals. 7154f38fcaSMauro Carvalho Chehab 7254f38fcaSMauro Carvalho Chehab.. note:: 7354f38fcaSMauro Carvalho Chehab 7454f38fcaSMauro Carvalho Chehab The order in which the frame intervals are returned has no 7554f38fcaSMauro Carvalho Chehab special meaning. In particular does it not say anything about potential 7654f38fcaSMauro Carvalho Chehab default frame intervals. 7754f38fcaSMauro Carvalho Chehab 7854f38fcaSMauro Carvalho ChehabApplications can assume that the enumeration data does not change 7954f38fcaSMauro Carvalho Chehabwithout any interaction from the application itself. This means that the 8054f38fcaSMauro Carvalho Chehabenumeration data is consistent if the application does not perform any 8154f38fcaSMauro Carvalho Chehabother ioctl calls while it runs the frame interval enumeration. 8254f38fcaSMauro Carvalho Chehab 8354f38fcaSMauro Carvalho Chehab.. note:: 8454f38fcaSMauro Carvalho Chehab 8554f38fcaSMauro Carvalho Chehab **Frame intervals and frame rates:** The V4L2 API uses frame 8654f38fcaSMauro Carvalho Chehab intervals instead of frame rates. Given the frame interval the frame 8754f38fcaSMauro Carvalho Chehab rate can be computed as follows: 8854f38fcaSMauro Carvalho Chehab 8954f38fcaSMauro Carvalho Chehab :: 9054f38fcaSMauro Carvalho Chehab 9154f38fcaSMauro Carvalho Chehab frame_rate = 1 / frame_interval 9254f38fcaSMauro Carvalho Chehab 9354f38fcaSMauro Carvalho ChehabStructs 9454f38fcaSMauro Carvalho Chehab======= 9554f38fcaSMauro Carvalho Chehab 9654f38fcaSMauro Carvalho ChehabIn the structs below, *IN* denotes a value that has to be filled in by 9754f38fcaSMauro Carvalho Chehabthe application, *OUT* denotes values that the driver fills in. The 9854f38fcaSMauro Carvalho Chehabapplication should zero out all members except for the *IN* fields. 9954f38fcaSMauro Carvalho Chehab 10054f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_frmival_stepwise 10154f38fcaSMauro Carvalho Chehab 10254f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_frmival_stepwise 10354f38fcaSMauro Carvalho Chehab :header-rows: 0 10454f38fcaSMauro Carvalho Chehab :stub-columns: 0 10554f38fcaSMauro Carvalho Chehab :widths: 1 1 2 10654f38fcaSMauro Carvalho Chehab 10754f38fcaSMauro Carvalho Chehab * - struct :c:type:`v4l2_fract` 10854f38fcaSMauro Carvalho Chehab - ``min`` 10954f38fcaSMauro Carvalho Chehab - Minimum frame interval [s]. 11054f38fcaSMauro Carvalho Chehab * - struct :c:type:`v4l2_fract` 11154f38fcaSMauro Carvalho Chehab - ``max`` 11254f38fcaSMauro Carvalho Chehab - Maximum frame interval [s]. 11354f38fcaSMauro Carvalho Chehab * - struct :c:type:`v4l2_fract` 11454f38fcaSMauro Carvalho Chehab - ``step`` 11554f38fcaSMauro Carvalho Chehab - Frame interval step size [s]. 11654f38fcaSMauro Carvalho Chehab 11754f38fcaSMauro Carvalho Chehab 11854f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_frmivalenum 11954f38fcaSMauro Carvalho Chehab 120*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}| 12154f38fcaSMauro Carvalho Chehab 12254f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_frmivalenum 12354f38fcaSMauro Carvalho Chehab :header-rows: 0 12454f38fcaSMauro Carvalho Chehab :stub-columns: 0 12554f38fcaSMauro Carvalho Chehab 12654f38fcaSMauro Carvalho Chehab * - __u32 12754f38fcaSMauro Carvalho Chehab - ``index`` 12854f38fcaSMauro Carvalho Chehab - IN: Index of the given frame interval in the enumeration. 12954f38fcaSMauro Carvalho Chehab * - __u32 13054f38fcaSMauro Carvalho Chehab - ``pixel_format`` 13154f38fcaSMauro Carvalho Chehab - IN: Pixel format for which the frame intervals are enumerated. 13254f38fcaSMauro Carvalho Chehab * - __u32 13354f38fcaSMauro Carvalho Chehab - ``width`` 13454f38fcaSMauro Carvalho Chehab - IN: Frame width for which the frame intervals are enumerated. 13554f38fcaSMauro Carvalho Chehab * - __u32 13654f38fcaSMauro Carvalho Chehab - ``height`` 13754f38fcaSMauro Carvalho Chehab - IN: Frame height for which the frame intervals are enumerated. 13854f38fcaSMauro Carvalho Chehab * - __u32 13954f38fcaSMauro Carvalho Chehab - ``type`` 14054f38fcaSMauro Carvalho Chehab - OUT: Frame interval type the device supports. 14154f38fcaSMauro Carvalho Chehab * - union { 14254f38fcaSMauro Carvalho Chehab - (anonymous) 14354f38fcaSMauro Carvalho Chehab - OUT: Frame interval with the given index. 14454f38fcaSMauro Carvalho Chehab * - struct :c:type:`v4l2_fract` 14554f38fcaSMauro Carvalho Chehab - ``discrete`` 14654f38fcaSMauro Carvalho Chehab - Frame interval [s]. 14754f38fcaSMauro Carvalho Chehab * - struct :c:type:`v4l2_frmival_stepwise` 14854f38fcaSMauro Carvalho Chehab - ``stepwise`` 14954f38fcaSMauro Carvalho Chehab - 15054f38fcaSMauro Carvalho Chehab * - } 15154f38fcaSMauro Carvalho Chehab - 15254f38fcaSMauro Carvalho Chehab - 15354f38fcaSMauro Carvalho Chehab * - __u32 15454f38fcaSMauro Carvalho Chehab - ``reserved[2]`` 15554f38fcaSMauro Carvalho Chehab - Reserved space for future use. Must be zeroed by drivers and 15654f38fcaSMauro Carvalho Chehab applications. 15754f38fcaSMauro Carvalho Chehab 15854f38fcaSMauro Carvalho Chehab 15954f38fcaSMauro Carvalho ChehabEnums 16054f38fcaSMauro Carvalho Chehab===== 16154f38fcaSMauro Carvalho Chehab 16254f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_frmivaltypes 16354f38fcaSMauro Carvalho Chehab 164*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}| 16554f38fcaSMauro Carvalho Chehab 16654f38fcaSMauro Carvalho Chehab.. flat-table:: enum v4l2_frmivaltypes 16754f38fcaSMauro Carvalho Chehab :header-rows: 0 16854f38fcaSMauro Carvalho Chehab :stub-columns: 0 16954f38fcaSMauro Carvalho Chehab :widths: 3 1 4 17054f38fcaSMauro Carvalho Chehab 17154f38fcaSMauro Carvalho Chehab * - ``V4L2_FRMIVAL_TYPE_DISCRETE`` 17254f38fcaSMauro Carvalho Chehab - 1 17354f38fcaSMauro Carvalho Chehab - Discrete frame interval. 17454f38fcaSMauro Carvalho Chehab * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` 17554f38fcaSMauro Carvalho Chehab - 2 17654f38fcaSMauro Carvalho Chehab - Continuous frame interval. 17754f38fcaSMauro Carvalho Chehab * - ``V4L2_FRMIVAL_TYPE_STEPWISE`` 17854f38fcaSMauro Carvalho Chehab - 3 17954f38fcaSMauro Carvalho Chehab - Step-wise defined frame interval. 18054f38fcaSMauro Carvalho Chehab 18154f38fcaSMauro Carvalho ChehabReturn Value 18254f38fcaSMauro Carvalho Chehab============ 18354f38fcaSMauro Carvalho Chehab 18454f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 18554f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 18654f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 187