File Index
Files and directories
Sign in
FILE

vidioc-enum-frameintervals.rst

File preview with syntax highlighting.

linux-6.19.14/Documentation/userspace-api/media/v4l/vidioc-enum-frameintervals.rst RESTRUCTUREDTEXT
  1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2.. c:namespace:: V4L
  3
  4.. _VIDIOC_ENUM_FRAMEINTERVALS:
  5
  6********************************
  7ioctl VIDIOC_ENUM_FRAMEINTERVALS
  8********************************
  9
 10Name
 11====
 12
 13VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
 14
 15Synopsis
 16========
 17
 18.. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS
 19
 20``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``
 21
 22Arguments
 23=========
 24
 25``fd``
 26    File descriptor returned by :c:func:`open()`.
 27
 28``argp``
 29    Pointer to struct :c:type:`v4l2_frmivalenum`
 30    that contains a pixel format and size and receives a frame interval.
 31
 32Description
 33===========
 34
 35This ioctl allows applications to enumerate all frame intervals that the
 36device supports for the given pixel format and frame size.
 37
 38The supported pixel formats and frame sizes can be obtained by using the
 39:ref:`VIDIOC_ENUM_FMT` and
 40:ref:`VIDIOC_ENUM_FRAMESIZES` functions.
 41
 42The return value and the content of the ``v4l2_frmivalenum.type`` field
 43depend on the type of frame intervals the device supports. Here are the
 44semantics of the function for the different cases:
 45
 46-  **Discrete:** The function returns success if the given index value
 47   (zero-based) is valid. The application should increase the index by
 48   one for each call until ``EINVAL`` is returned. The
 49   `v4l2_frmivalenum.type` field is set to
 50   `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
 51   the `discrete` member is valid.
 52
 53-  **Step-wise:** The function returns success if the given index value
 54   is zero and ``EINVAL`` for any other index value. The
 55   ``v4l2_frmivalenum.type`` field is set to
 56   ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
 57   ``stepwise`` member is valid.
 58
 59-  **Continuous:** This is a special case of the step-wise type above.
 60   The function returns success if the given index value is zero and
 61   ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
 62   field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
 63   the union only the ``stepwise`` member is valid and the ``step``
 64   value is set to 1.
 65
 66When the application calls the function with index zero, it must check
 67the ``type`` field to determine the type of frame interval enumeration
 68the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
 69does it make sense to increase the index value to receive more frame
 70intervals.
 71
 72.. note::
 73
 74   The order in which the frame intervals are returned has no
 75   special meaning. In particular does it not say anything about potential
 76   default frame intervals.
 77
 78Applications can assume that the enumeration data does not change
 79without any interaction from the application itself. This means that the
 80enumeration data is consistent if the application does not perform any
 81other ioctl calls while it runs the frame interval enumeration.
 82
 83.. note::
 84
 85   **Frame intervals and frame rates:** The V4L2 API uses frame
 86   intervals instead of frame rates. Given the frame interval the frame
 87   rate can be computed as follows:
 88
 89   ::
 90
 91       frame_rate = 1 / frame_interval
 92
 93Structs
 94=======
 95
 96In the structs below, *IN* denotes a value that has to be filled in by
 97the application, *OUT* denotes values that the driver fills in. The
 98application should zero out all members except for the *IN* fields.
 99
100.. c:type:: v4l2_frmival_stepwise
101
102.. flat-table:: struct v4l2_frmival_stepwise
103    :header-rows:  0
104    :stub-columns: 0
105    :widths:       1 1 2
106
107    * - struct :c:type:`v4l2_fract`
108      - ``min``
109      - Minimum frame interval [s].
110    * - struct :c:type:`v4l2_fract`
111      - ``max``
112      - Maximum frame interval [s].
113    * - struct :c:type:`v4l2_fract`
114      - ``step``
115      - Frame interval step size [s].
116
117
118.. c:type:: v4l2_frmivalenum
119
120.. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}|
121
122.. flat-table:: struct v4l2_frmivalenum
123    :header-rows:  0
124    :stub-columns: 0
125
126    * - __u32
127      - ``index``
128      - IN: Index of the given frame interval in the enumeration.
129    * - __u32
130      - ``pixel_format``
131      - IN: Pixel format for which the frame intervals are enumerated.
132    * - __u32
133      - ``width``
134      - IN: Frame width for which the frame intervals are enumerated.
135    * - __u32
136      - ``height``
137      - IN: Frame height for which the frame intervals are enumerated.
138    * - __u32
139      - ``type``
140      - OUT: Frame interval type the device supports.
141    * - union {
142      - (anonymous)
143      - OUT: Frame interval with the given index.
144    * - struct :c:type:`v4l2_fract`
145      - ``discrete``
146      - Frame interval [s].
147    * - struct :c:type:`v4l2_frmival_stepwise`
148      - ``stepwise``
149      -
150    * - }
151      -
152      -
153    * - __u32
154      - ``reserved[2]``
155      - Reserved space for future use. Must be zeroed by drivers and
156	applications.
157
158
159Enums
160=====
161
162.. c:type:: v4l2_frmivaltypes
163
164.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
165
166.. flat-table:: enum v4l2_frmivaltypes
167    :header-rows:  0
168    :stub-columns: 0
169    :widths:       3 1 4
170
171    * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
172      - 1
173      - Discrete frame interval.
174    * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
175      - 2
176      - Continuous frame interval.
177    * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
178      - 3
179      - Step-wise defined frame interval.
180
181Return Value
182============
183
184On success 0 is returned, on error -1 and the ``errno`` variable is set
185appropriately. The generic error codes are described at the
186:ref:`Generic Error Codes <gen-errors>` chapter.
~/ Read-only file preview.