Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 1 | .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later |
| 2 | .. c:namespace:: V4L |
| 3 | |
| 4 | .. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL: |
| 5 | |
| 6 | *************************************** |
| 7 | ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL |
| 8 | *************************************** |
| 9 | |
| 10 | Name |
| 11 | ==== |
| 12 | |
| 13 | VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals |
| 14 | |
| 15 | Synopsis |
| 16 | ======== |
| 17 | |
| 18 | .. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL |
| 19 | |
| 20 | ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)`` |
| 21 | |
| 22 | Arguments |
| 23 | ========= |
| 24 | |
| 25 | ``fd`` |
| 26 | File descriptor returned by :c:func:`open()`. |
| 27 | |
| 28 | ``argp`` |
| 29 | Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`. |
| 30 | |
| 31 | Description |
| 32 | =========== |
| 33 | |
| 34 | This ioctl lets applications enumerate available frame intervals on a |
| 35 | given sub-device pad. Frame intervals only makes sense for sub-devices |
| 36 | that can control the frame period on their own. This includes, for |
| 37 | instance, image sensors and TV tuners. |
| 38 | |
| 39 | For the common use case of image sensors, the frame intervals available |
| 40 | on the sub-device output pad depend on the frame format and size on the |
| 41 | same pad. Applications must thus specify the desired format and size |
| 42 | when enumerating frame intervals. |
| 43 | |
| 44 | To enumerate frame intervals applications initialize the ``index``, |
| 45 | ``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct |
| 46 | :c:type:`v4l2_subdev_frame_interval_enum` |
| 47 | and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer |
| 48 | to this structure. Drivers fill the rest of the structure or return an |
| 49 | EINVAL error code if one of the input fields is invalid. All frame |
| 50 | intervals are enumerable by beginning at index zero and incrementing by |
| 51 | one until ``EINVAL`` is returned. |
| 52 | |
| 53 | Available frame intervals may depend on the current 'try' formats at |
| 54 | other pads of the sub-device, as well as on the current active links. |
| 55 | See :ref:`VIDIOC_SUBDEV_G_FMT` for more |
| 56 | information about the try formats. |
| 57 | |
| 58 | Sub-devices that support the frame interval enumeration ioctl should |
| 59 | implemented it on a single pad only. Its behaviour when supported on |
| 60 | multiple pads of the same sub-device is not defined. |
| 61 | |
| 62 | .. c:type:: v4l2_subdev_frame_interval_enum |
| 63 | |
| 64 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| |
| 65 | |
| 66 | .. flat-table:: struct v4l2_subdev_frame_interval_enum |
| 67 | :header-rows: 0 |
| 68 | :stub-columns: 0 |
| 69 | :widths: 1 1 2 |
| 70 | |
| 71 | * - __u32 |
| 72 | - ``index`` |
| 73 | - Number of the format in the enumeration, set by the application. |
| 74 | * - __u32 |
| 75 | - ``pad`` |
| 76 | - Pad number as reported by the media controller API. |
| 77 | * - __u32 |
| 78 | - ``code`` |
| 79 | - The media bus format code, as defined in |
| 80 | :ref:`v4l2-mbus-format`. |
| 81 | * - __u32 |
| 82 | - ``width`` |
| 83 | - Frame width, in pixels. |
| 84 | * - __u32 |
| 85 | - ``height`` |
| 86 | - Frame height, in pixels. |
| 87 | * - struct :c:type:`v4l2_fract` |
| 88 | - ``interval`` |
| 89 | - Period, in seconds, between consecutive video frames. |
| 90 | * - __u32 |
| 91 | - ``which`` |
| 92 | - Frame intervals to be enumerated, from enum |
| 93 | :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`. |
| 94 | * - __u32 |
| 95 | - ``reserved``\ [8] |
| 96 | - Reserved for future extensions. Applications and drivers must set |
| 97 | the array to zero. |
| 98 | |
| 99 | Return Value |
| 100 | ============ |
| 101 | |
| 102 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 103 | appropriately. The generic error codes are described at the |
| 104 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 105 | |
| 106 | EINVAL |
| 107 | The struct |
| 108 | :c:type:`v4l2_subdev_frame_interval_enum` |
| 109 | ``pad`` references a non-existing pad, one of the ``code``, |
| 110 | ``width`` or ``height`` fields are invalid for the given pad or the |
| 111 | ``index`` field is out of bounds. |