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 .. cpp:function:: int ioctl( int fd, int request, v4l2_streamparm *argp )
25 File descriptor returned by :ref:`open() <func-open>`.
28 VIDIOC_G_PARM, VIDIOC_S_PARM
36 The current video standard determines a nominal number of frames per
37 second. If less than this number of frames is to be captured or output,
38 applications can request frame skipping or duplicating on the driver
39 side. This is especially useful when using the :ref:`read() <func-read>` or
40 :ref:`write() <func-write>`, which are not augmented by timestamps or sequence
41 counters, and to avoid unnecessary data copying.
43 Further these ioctls can be used to determine the number of buffers used
44 internally by a driver in read/write mode. For implications see the
45 section discussing the :ref:`read() <func-read>` function.
47 To get and set the streaming parameters applications call the
48 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
49 pointer to a struct :ref:`struct v4l2_streamparm <v4l2-streamparm>` which contains a
50 union holding separate parameters for input and output devices.
55 .. flat-table:: struct v4l2_streamparm
68 - The buffer (stream) type, same as struct
69 :ref:`v4l2_format <v4l2-format>` ``type``, set by the
70 application. See :ref:`v4l2-buf-type`
84 - struct :ref:`v4l2_captureparm <v4l2-captureparm>`
88 - Parameters for capture devices, used when ``type`` is
89 ``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
94 - struct :ref:`v4l2_outputparm <v4l2-outputparm>`
98 - Parameters for output devices, used when ``type`` is
99 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
106 - ``raw_data``\ [200]
108 - A place holder for future extensions.
112 .. _v4l2-captureparm:
114 .. flat-table:: struct v4l2_captureparm
126 - See :ref:`parm-caps`.
134 - Set by drivers and applications, see :ref:`parm-flags`.
138 - struct :ref:`v4l2_fract <v4l2-fract>`
142 - This is the desired period between successive frames captured by
143 the driver, in seconds. The field is intended to skip frames on
144 the driver side, saving I/O bandwidth.
146 Applications store here the desired frame period, drivers return
147 the actual frame period, which must be greater or equal to the
148 nominal frame period determined by the current video standard
149 (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
150 field). Changing the video standard (also implicitly by switching
151 the video input) may reset this parameter to the nominal frame
152 period. To reset manually applications can just set this field to
155 Drivers support this function only when they set the
156 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
164 - Custom (driver specific) streaming parameters. When unused,
165 applications and drivers must set this field to zero. Applications
166 using this field should check the driver name and version, see
175 - Applications set this field to the desired number of buffers used
176 internally by the driver in :ref:`read() <func-read>` mode.
177 Drivers return the actual number of buffers. When an application
178 requests zero buffers, drivers should just return the current
179 setting rather than the minimum or an error code. For details see
188 - Reserved for future extensions. Drivers and applications must set
195 .. flat-table:: struct v4l2_outputparm
207 - See :ref:`parm-caps`.
215 - Set by drivers and applications, see :ref:`parm-flags`.
219 - struct :ref:`v4l2_fract <v4l2-fract>`
223 - This is the desired period between successive frames output by the
230 The field is intended to repeat frames on the driver side in
231 :ref:`write() <func-write>` mode (in streaming mode timestamps
232 can be used to throttle the output), saving I/O bandwidth.
234 Applications store here the desired frame period, drivers return
235 the actual frame period, which must be greater or equal to the
236 nominal frame period determined by the current video standard
237 (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
238 field). Changing the video standard (also implicitly by switching
239 the video output) may reset this parameter to the nominal frame
240 period. To reset manually applications can just set this field to
243 Drivers support this function only when they set the
244 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
252 - Custom (driver specific) streaming parameters. When unused,
253 applications and drivers must set this field to zero. Applications
254 using this field should check the driver name and version, see
263 - Applications set this field to the desired number of buffers used
264 internally by the driver in :ref:`write() <func-write>` mode. Drivers
265 return the actual number of buffers. When an application requests
266 zero buffers, drivers should just return the current setting
267 rather than the minimum or an error code. For details see
276 - Reserved for future extensions. Drivers and applications must set
283 .. flat-table:: Streaming Parameters Capabilites
291 - ``V4L2_CAP_TIMEPERFRAME``
295 - The frame skipping/repeating controlled by the ``timeperframe``
302 .. flat-table:: Capture Parameters Flags
310 - ``V4L2_MODE_HIGHQUALITY``
314 - High quality imaging mode. High quality mode is intended for still
315 imaging applications. The idea is to get the best possible image
316 quality that the hardware can deliver. It is not defined how the
317 driver writer may achieve that; it will depend on the hardware and
318 the ingenuity of the driver writer. High quality mode is a
319 different mode from the regular motion video capture modes. In
322 - The driver may be able to capture higher resolutions than for
325 - The driver may support fewer pixel formats than motion capture
328 - The driver may capture and arithmetically combine multiple
329 successive fields or frames to remove color edge artifacts and
330 reduce the noise in the video data.
332 - The driver may capture images in slices like a scanner in order
333 to handle larger format images than would otherwise be
336 - An image capture operation may be significantly slower than
339 - Moving objects in the image might have excessive motion blur.
341 - Capture might only work through the :ref:`read() <func-read>` call.
347 On success 0 is returned, on error -1 and the ``errno`` variable is set
348 appropriately. The generic error codes are described at the
349 :ref:`Generic Error Codes <gen-errors>` chapter.