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, 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.
53 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
57 .. flat-table:: struct v4l2_streamparm
70 - The buffer (stream) type, same as struct
71 :ref:`v4l2_format <v4l2-format>` ``type``, set by the
72 application. See :ref:`v4l2-buf-type`
86 - struct :ref:`v4l2_captureparm <v4l2-captureparm>`
90 - Parameters for capture devices, used when ``type`` is
91 ``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
96 - struct :ref:`v4l2_outputparm <v4l2-outputparm>`
100 - Parameters for output devices, used when ``type`` is
101 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
108 - ``raw_data``\ [200]
110 - A place holder for future extensions.
114 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
116 .. _v4l2-captureparm:
118 .. flat-table:: struct v4l2_captureparm
130 - See :ref:`parm-caps`.
138 - Set by drivers and applications, see :ref:`parm-flags`.
142 - struct :ref:`v4l2_fract <v4l2-fract>`
146 - This is the desired period between successive frames captured by
147 the driver, in seconds. The field is intended to skip frames on
148 the driver side, saving I/O bandwidth.
150 Applications store here the desired frame period, drivers return
151 the actual frame period, which must be greater or equal to the
152 nominal frame period determined by the current video standard
153 (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
154 field). Changing the video standard (also implicitly by switching
155 the video input) may reset this parameter to the nominal frame
156 period. To reset manually applications can just set this field to
159 Drivers support this function only when they set the
160 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
168 - Custom (driver specific) streaming parameters. When unused,
169 applications and drivers must set this field to zero. Applications
170 using this field should check the driver name and version, see
179 - Applications set this field to the desired number of buffers used
180 internally by the driver in :ref:`read() <func-read>` mode.
181 Drivers return the actual number of buffers. When an application
182 requests zero buffers, drivers should just return the current
183 setting rather than the minimum or an error code. For details see
192 - Reserved for future extensions. Drivers and applications must set
197 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
201 .. flat-table:: struct v4l2_outputparm
213 - See :ref:`parm-caps`.
221 - Set by drivers and applications, see :ref:`parm-flags`.
225 - struct :ref:`v4l2_fract <v4l2-fract>`
229 - This is the desired period between successive frames output by the
236 The field is intended to repeat frames on the driver side in
237 :ref:`write() <func-write>` mode (in streaming mode timestamps
238 can be used to throttle the output), saving I/O bandwidth.
240 Applications store here the desired frame period, drivers return
241 the actual frame period, which must be greater or equal to the
242 nominal frame period determined by the current video standard
243 (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
244 field). Changing the video standard (also implicitly by switching
245 the video output) may reset this parameter to the nominal frame
246 period. To reset manually applications can just set this field to
249 Drivers support this function only when they set the
250 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
258 - Custom (driver specific) streaming parameters. When unused,
259 applications and drivers must set this field to zero. Applications
260 using this field should check the driver name and version, see
269 - Applications set this field to the desired number of buffers used
270 internally by the driver in :ref:`write() <func-write>` mode. Drivers
271 return the actual number of buffers. When an application requests
272 zero buffers, drivers should just return the current setting
273 rather than the minimum or an error code. For details see
282 - Reserved for future extensions. Drivers and applications must set
287 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
291 .. flat-table:: Streaming Parameters Capabilites
299 - ``V4L2_CAP_TIMEPERFRAME``
303 - The frame skipping/repeating controlled by the ``timeperframe``
308 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
312 .. flat-table:: Capture Parameters Flags
320 - ``V4L2_MODE_HIGHQUALITY``
324 - High quality imaging mode. High quality mode is intended for still
325 imaging applications. The idea is to get the best possible image
326 quality that the hardware can deliver. It is not defined how the
327 driver writer may achieve that; it will depend on the hardware and
328 the ingenuity of the driver writer. High quality mode is a
329 different mode from the regular motion video capture modes. In
332 - The driver may be able to capture higher resolutions than for
335 - The driver may support fewer pixel formats than motion capture
338 - The driver may capture and arithmetically combine multiple
339 successive fields or frames to remove color edge artifacts and
340 reduce the noise in the video data.
342 - The driver may capture images in slices like a scanner in order
343 to handle larger format images than would otherwise be
346 - An image capture operation may be significantly slower than
349 - Moving objects in the image might have excessive motion blur.
351 - Capture might only work through the :ref:`read() <func-read>` call.
357 On success 0 is returned, on error -1 and the ``errno`` variable is set
358 appropriately. The generic error codes are described at the
359 :ref:`Generic Error Codes <gen-errors>` chapter.