18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci***************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
88c2ecf20Sopenharmony_ci***************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciThis ioctl lets applications enumerate available frame intervals on a
358c2ecf20Sopenharmony_cigiven sub-device pad. Frame intervals only makes sense for sub-devices
368c2ecf20Sopenharmony_cithat can control the frame period on their own. This includes, for
378c2ecf20Sopenharmony_ciinstance, image sensors and TV tuners.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciFor the common use case of image sensors, the frame intervals available
408c2ecf20Sopenharmony_cion the sub-device output pad depend on the frame format and size on the
418c2ecf20Sopenharmony_cisame pad. Applications must thus specify the desired format and size
428c2ecf20Sopenharmony_ciwhen enumerating frame intervals.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciTo enumerate frame intervals applications initialize the ``index``,
458c2ecf20Sopenharmony_ci``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
468c2ecf20Sopenharmony_ci:c:type:`v4l2_subdev_frame_interval_enum`
478c2ecf20Sopenharmony_ciand call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
488c2ecf20Sopenharmony_cito this structure. Drivers fill the rest of the structure or return an
498c2ecf20Sopenharmony_ciEINVAL error code if one of the input fields is invalid. All frame
508c2ecf20Sopenharmony_ciintervals are enumerable by beginning at index zero and incrementing by
518c2ecf20Sopenharmony_cione until ``EINVAL`` is returned.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciAvailable frame intervals may depend on the current 'try' formats at
548c2ecf20Sopenharmony_ciother pads of the sub-device, as well as on the current active links.
558c2ecf20Sopenharmony_ciSee :ref:`VIDIOC_SUBDEV_G_FMT` for more
568c2ecf20Sopenharmony_ciinformation about the try formats.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciSub-devices that support the frame interval enumeration ioctl should
598c2ecf20Sopenharmony_ciimplemented it on a single pad only. Its behaviour when supported on
608c2ecf20Sopenharmony_cimultiple pads of the same sub-device is not defined.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci.. c:type:: v4l2_subdev_frame_interval_enum
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_subdev_frame_interval_enum
678c2ecf20Sopenharmony_ci    :header-rows:  0
688c2ecf20Sopenharmony_ci    :stub-columns: 0
698c2ecf20Sopenharmony_ci    :widths:       1 1 2
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci    * - __u32
728c2ecf20Sopenharmony_ci      - ``index``
738c2ecf20Sopenharmony_ci      - Number of the format in the enumeration, set by the application.
748c2ecf20Sopenharmony_ci    * - __u32
758c2ecf20Sopenharmony_ci      - ``pad``
768c2ecf20Sopenharmony_ci      - Pad number as reported by the media controller API.
778c2ecf20Sopenharmony_ci    * - __u32
788c2ecf20Sopenharmony_ci      - ``code``
798c2ecf20Sopenharmony_ci      - The media bus format code, as defined in
808c2ecf20Sopenharmony_ci	:ref:`v4l2-mbus-format`.
818c2ecf20Sopenharmony_ci    * - __u32
828c2ecf20Sopenharmony_ci      - ``width``
838c2ecf20Sopenharmony_ci      - Frame width, in pixels.
848c2ecf20Sopenharmony_ci    * - __u32
858c2ecf20Sopenharmony_ci      - ``height``
868c2ecf20Sopenharmony_ci      - Frame height, in pixels.
878c2ecf20Sopenharmony_ci    * - struct :c:type:`v4l2_fract`
888c2ecf20Sopenharmony_ci      - ``interval``
898c2ecf20Sopenharmony_ci      - Period, in seconds, between consecutive video frames.
908c2ecf20Sopenharmony_ci    * - __u32
918c2ecf20Sopenharmony_ci      - ``which``
928c2ecf20Sopenharmony_ci      - Frame intervals to be enumerated, from enum
938c2ecf20Sopenharmony_ci	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
948c2ecf20Sopenharmony_ci    * - __u32
958c2ecf20Sopenharmony_ci      - ``reserved``\ [8]
968c2ecf20Sopenharmony_ci      - Reserved for future extensions. Applications and drivers must set
978c2ecf20Sopenharmony_ci	the array to zero.
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciReturn Value
1008c2ecf20Sopenharmony_ci============
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1038c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1048c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciEINVAL
1078c2ecf20Sopenharmony_ci    The struct
1088c2ecf20Sopenharmony_ci    :c:type:`v4l2_subdev_frame_interval_enum`
1098c2ecf20Sopenharmony_ci    ``pad`` references a non-existing pad, one of the ``code``,
1108c2ecf20Sopenharmony_ci    ``width`` or ``height`` fields are invalid for the given pad or the
1118c2ecf20Sopenharmony_ci    ``index`` field is out of bounds.
112