1 .. -*- coding: utf-8; mode: rst -*-
5 **********************************
6 ioctl VIDIOC_G_PARM, VIDIOC_S_PARM
7 **********************************
12 VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters
18 .. c:function:: int ioctl( int fd, VIDIOC_G_PARM, v4l2_streamparm *argp )
21 .. c:function:: int ioctl( int fd, VIDIOC_S_PARM, v4l2_streamparm *argp )
29 File descriptor returned by :ref:`open() <func-open>`.
37 The current video standard determines a nominal number of frames per
38 second. If less than this number of frames is to be captured or output,
39 applications can request frame skipping or duplicating on the driver
40 side. This is especially useful when using the :ref:`read() <func-read>` or
41 :ref:`write() <func-write>`, which are not augmented by timestamps or sequence
42 counters, and to avoid unnecessary data copying.
44 Further these ioctls can be used to determine the number of buffers used
45 internally by a driver in read/write mode. For implications see the
46 section discussing the :ref:`read() <func-read>` function.
48 To get and set the streaming parameters applications call the
49 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
50 pointer to a struct :c:type:`v4l2_streamparm` which contains a
51 union holding separate parameters for input and output devices.
54 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
56 .. c:type:: v4l2_streamparm
58 .. flat-table:: struct v4l2_streamparm
71 - The buffer (stream) type, same as struct
72 :c:type:`v4l2_format` ``type``, set by the
73 application. See :ref:`v4l2-buf-type`
87 - struct :c:type:`v4l2_captureparm`
91 - Parameters for capture devices, used when ``type`` is
92 ``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
97 - struct :c:type:`v4l2_outputparm`
101 - Parameters for output devices, used when ``type`` is
102 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
109 - ``raw_data``\ [200]
111 - A place holder for future extensions.
115 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
117 .. c:type:: v4l2_captureparm
119 .. flat-table:: struct v4l2_captureparm
131 - See :ref:`parm-caps`.
139 - Set by drivers and applications, see :ref:`parm-flags`.
143 - struct :c:type:`v4l2_fract`
147 - This is the desired period between successive frames captured by
148 the driver, in seconds. The field is intended to skip frames on
149 the driver side, saving I/O bandwidth.
151 Applications store here the desired frame period, drivers return
152 the actual frame period, which must be greater or equal to the
153 nominal frame period determined by the current video standard
154 (struct :c:type:`v4l2_standard` ``frameperiod``
155 field). Changing the video standard (also implicitly by switching
156 the video input) may reset this parameter to the nominal frame
157 period. To reset manually applications can just set this field to
160 Drivers support this function only when they set the
161 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
169 - Custom (driver specific) streaming parameters. When unused,
170 applications and drivers must set this field to zero. Applications
171 using this field should check the driver name and version, see
180 - Applications set this field to the desired number of buffers used
181 internally by the driver in :ref:`read() <func-read>` mode.
182 Drivers return the actual number of buffers. When an application
183 requests zero buffers, drivers should just return the current
184 setting rather than the minimum or an error code. For details see
193 - Reserved for future extensions. Drivers and applications must set
198 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
200 .. c:type:: v4l2_outputparm
202 .. flat-table:: struct v4l2_outputparm
214 - See :ref:`parm-caps`.
222 - Set by drivers and applications, see :ref:`parm-flags`.
226 - struct :c:type:`v4l2_fract`
230 - This is the desired period between successive frames output by the
237 The field is intended to repeat frames on the driver side in
238 :ref:`write() <func-write>` mode (in streaming mode timestamps
239 can be used to throttle the output), saving I/O bandwidth.
241 Applications store here the desired frame period, drivers return
242 the actual frame period, which must be greater or equal to the
243 nominal frame period determined by the current video standard
244 (struct :c:type:`v4l2_standard` ``frameperiod``
245 field). Changing the video standard (also implicitly by switching
246 the video output) may reset this parameter to the nominal frame
247 period. To reset manually applications can just set this field to
250 Drivers support this function only when they set the
251 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
259 - Custom (driver specific) streaming parameters. When unused,
260 applications and drivers must set this field to zero. Applications
261 using this field should check the driver name and version, see
270 - Applications set this field to the desired number of buffers used
271 internally by the driver in :ref:`write() <func-write>` mode. Drivers
272 return the actual number of buffers. When an application requests
273 zero buffers, drivers should just return the current setting
274 rather than the minimum or an error code. For details see
283 - Reserved for future extensions. Drivers and applications must set
288 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
292 .. flat-table:: Streaming Parameters Capabilites
300 - ``V4L2_CAP_TIMEPERFRAME``
304 - The frame skipping/repeating controlled by the ``timeperframe``
309 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
313 .. flat-table:: Capture Parameters Flags
321 - ``V4L2_MODE_HIGHQUALITY``
325 - High quality imaging mode. High quality mode is intended for still
326 imaging applications. The idea is to get the best possible image
327 quality that the hardware can deliver. It is not defined how the
328 driver writer may achieve that; it will depend on the hardware and
329 the ingenuity of the driver writer. High quality mode is a
330 different mode from the regular motion video capture modes. In
333 - The driver may be able to capture higher resolutions than for
336 - The driver may support fewer pixel formats than motion capture
339 - The driver may capture and arithmetically combine multiple
340 successive fields or frames to remove color edge artifacts and
341 reduce the noise in the video data.
343 - The driver may capture images in slices like a scanner in order
344 to handle larger format images than would otherwise be
347 - An image capture operation may be significantly slower than
350 - Moving objects in the image might have excessive motion blur.
352 - Capture might only work through the :ref:`read() <func-read>` call.
358 On success 0 is returned, on error -1 and the ``errno`` variable is set
359 appropriately. The generic error codes are described at the
360 :ref:`Generic Error Codes <gen-errors>` chapter.