1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
6 **********************************
7 ioctl VIDIOC_G_PARM, VIDIOC_S_PARM
8 **********************************
13 VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters
18 .. c:macro:: VIDIOC_G_PARM
20 ``int ioctl(int fd, VIDIOC_G_PARM, v4l2_streamparm *argp)``
22 .. c:macro:: VIDIOC_S_PARM
24 ``int ioctl(int fd, VIDIOC_S_PARM, v4l2_streamparm *argp)``
30 File descriptor returned by :c:func:`open()`.
33 Pointer to struct :c:type:`v4l2_streamparm`.
38 Applications can request a different frame interval. The capture or
39 output device will be reconfigured to support the requested frame
40 interval if possible. Optionally drivers may choose to skip or
41 repeat frames to achieve the requested frame interval.
43 For stateful encoders (see :ref:`encoder`) this represents the
44 frame interval that is typically embedded in the encoded video stream.
46 Changing the frame interval shall never change the format. Changing the
47 format, on the other hand, may change the frame interval.
49 Further these ioctls can be used to determine the number of buffers used
50 internally by a driver in read/write mode. For implications see the
51 section discussing the :c:func:`read()` function.
53 To get and set the streaming parameters applications call the
54 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and
55 :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
56 pointer to a struct :c:type:`v4l2_streamparm` which contains a
57 union holding separate parameters for input and output devices.
59 .. tabularcolumns:: |p{3.7cm}|p{3.5cm}|p{10.1cm}|
61 .. c:type:: v4l2_streamparm
63 .. flat-table:: struct v4l2_streamparm
70 - The buffer (stream) type, same as struct
71 :c:type:`v4l2_format` ``type``, set by the
72 application. See :c:type:`v4l2_buf_type`.
75 * - struct :c:type:`v4l2_captureparm`
77 - Parameters for capture devices, used when ``type`` is
78 ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or
79 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``.
80 * - struct :c:type:`v4l2_outputparm`
82 - Parameters for output devices, used when ``type`` is
83 ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` or ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``.
86 - A place holder for future extensions.
90 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
92 .. c:type:: v4l2_captureparm
94 .. flat-table:: struct v4l2_captureparm
101 - See :ref:`parm-caps`.
104 - Set by drivers and applications, see :ref:`parm-flags`.
105 * - struct :c:type:`v4l2_fract`
107 - This is the desired period between successive frames captured by
108 the driver, in seconds.
111 This will configure the speed at which the video source (e.g. a sensor)
112 generates video frames. If the speed is fixed, then the driver may
113 choose to skip or repeat frames in order to achieve the requested
116 For stateful encoders (see :ref:`encoder`) this represents the
117 frame interval that is typically embedded in the encoded video stream.
119 Applications store here the desired frame period, drivers return
120 the actual frame period.
122 Changing the video standard (also implicitly by switching
123 the video input) may reset this parameter to the nominal frame
124 period. To reset manually applications can just set this field to
127 Drivers support this function only when they set the
128 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
131 - Custom (driver specific) streaming parameters. When unused,
132 applications and drivers must set this field to zero. Applications
133 using this field should check the driver name and version, see
137 - Applications set this field to the desired number of buffers used
138 internally by the driver in :c:func:`read()` mode.
139 Drivers return the actual number of buffers. When an application
140 requests zero buffers, drivers should just return the current
141 setting rather than the minimum or an error code. For details see
145 - Reserved for future extensions. Drivers and applications must set
149 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
151 .. c:type:: v4l2_outputparm
153 .. flat-table:: struct v4l2_outputparm
160 - See :ref:`parm-caps`.
163 - Set by drivers and applications, see :ref:`parm-flags`.
164 * - struct :c:type:`v4l2_fract`
166 - This is the desired period between successive frames output by the
170 The field is intended to repeat frames on the driver side in
171 :c:func:`write()` mode (in streaming mode timestamps
172 can be used to throttle the output), saving I/O bandwidth.
174 For stateful encoders (see :ref:`encoder`) this represents the
175 frame interval that is typically embedded in the encoded video stream
176 and it provides a hint to the encoder of the speed at which raw
177 frames are queued up to the encoder.
179 Applications store here the desired frame period, drivers return
180 the actual frame period.
182 Changing the video standard (also implicitly by switching
183 the video output) may reset this parameter to the nominal frame
184 period. To reset manually applications can just set this field to
187 Drivers support this function only when they set the
188 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
191 - Custom (driver specific) streaming parameters. When unused,
192 applications and drivers must set this field to zero. Applications
193 using this field should check the driver name and version, see
197 - Applications set this field to the desired number of buffers used
198 internally by the driver in :c:func:`write()` mode. Drivers
199 return the actual number of buffers. When an application requests
200 zero buffers, drivers should just return the current setting
201 rather than the minimum or an error code. For details see
205 - Reserved for future extensions. Drivers and applications must set
209 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
213 .. flat-table:: Streaming Parameters Capabilities
218 * - ``V4L2_CAP_TIMEPERFRAME``
220 - The frame period can be modified by setting the ``timeperframe``
224 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
228 .. flat-table:: Capture Parameters Flags
233 * - ``V4L2_MODE_HIGHQUALITY``
235 - High quality imaging mode. High quality mode is intended for still
236 imaging applications. The idea is to get the best possible image
237 quality that the hardware can deliver. It is not defined how the
238 driver writer may achieve that; it will depend on the hardware and
239 the ingenuity of the driver writer. High quality mode is a
240 different mode from the regular motion video capture modes. In
243 - The driver may be able to capture higher resolutions than for
246 - The driver may support fewer pixel formats than motion capture
249 - The driver may capture and arithmetically combine multiple
250 successive fields or frames to remove color edge artifacts and
251 reduce the noise in the video data.
253 - The driver may capture images in slices like a scanner in order
254 to handle larger format images than would otherwise be
257 - An image capture operation may be significantly slower than
260 - Moving objects in the image might have excessive motion blur.
262 - Capture might only work through the :c:func:`read()` call.
267 On success 0 is returned, on error -1 and the ``errno`` variable is set
268 appropriately. The generic error codes are described at the
269 :ref:`Generic Error Codes <gen-errors>` chapter.