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