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>`.
32 Pointer to struct :c:type:`v4l2_streamparm`.
38 The current video standard determines a nominal number of frames per
39 second. If less than this number of frames is to be captured or output,
40 applications can request frame skipping or duplicating on the driver
41 side. This is especially useful when using the :ref:`read() <func-read>` or
42 :ref:`write() <func-write>`, which are not augmented by timestamps or sequence
43 counters, and to avoid unnecessary data copying.
45 Further these ioctls can be used to determine the number of buffers used
46 internally by a driver in read/write mode. For implications see the
47 section discussing the :ref:`read() <func-read>` function.
49 To get and set the streaming parameters applications call the
50 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
51 pointer to a struct :c:type:`v4l2_streamparm` which contains a
52 union holding separate parameters for input and output devices.
55 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
57 .. c:type:: v4l2_streamparm
59 .. flat-table:: struct v4l2_streamparm
67 - The buffer (stream) type, same as struct
68 :c:type:`v4l2_format` ``type``, set by the
69 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``.
80 - struct :c:type:`v4l2_outputparm`
82 - Parameters for output devices, used when ``type`` is
83 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
87 - A place holder for future extensions.
91 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
93 .. c:type:: v4l2_captureparm
95 .. flat-table:: struct v4l2_captureparm
102 - See :ref:`parm-caps`.
105 - Set by drivers and applications, see :ref:`parm-flags`.
106 * - struct :c:type:`v4l2_fract`
108 - This is the desired period between successive frames captured by
109 the driver, in seconds. The field is intended to skip frames on
110 the driver side, saving I/O bandwidth.
112 Applications store here the desired frame period, drivers return
113 the actual frame period, which must be greater or equal to the
114 nominal frame period determined by the current video standard
115 (struct :c:type:`v4l2_standard` ``frameperiod``
116 field). Changing the video standard (also implicitly by switching
117 the video input) may reset this parameter to the nominal frame
118 period. To reset manually applications can just set this field to
121 Drivers support this function only when they set the
122 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
125 - Custom (driver specific) streaming parameters. When unused,
126 applications and drivers must set this field to zero. Applications
127 using this field should check the driver name and version, see
131 - Applications set this field to the desired number of buffers used
132 internally by the driver in :ref:`read() <func-read>` mode.
133 Drivers return the actual number of buffers. When an application
134 requests zero buffers, drivers should just return the current
135 setting rather than the minimum or an error code. For details see
139 - Reserved for future extensions. Drivers and applications must set
144 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
146 .. c:type:: v4l2_outputparm
148 .. flat-table:: struct v4l2_outputparm
155 - See :ref:`parm-caps`.
158 - Set by drivers and applications, see :ref:`parm-flags`.
159 * - struct :c:type:`v4l2_fract`
161 - This is the desired period between successive frames output by the
165 The field is intended to repeat frames on the driver side in
166 :ref:`write() <func-write>` mode (in streaming mode timestamps
167 can be used to throttle the output), saving I/O bandwidth.
169 Applications store here the desired frame period, drivers return
170 the actual frame period, which must be greater or equal to the
171 nominal frame period determined by the current video standard
172 (struct :c:type:`v4l2_standard` ``frameperiod``
173 field). Changing the video standard (also implicitly by switching
174 the video output) may reset this parameter to the nominal frame
175 period. To reset manually applications can just set this field to
178 Drivers support this function only when they set the
179 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
182 - Custom (driver specific) streaming parameters. When unused,
183 applications and drivers must set this field to zero. Applications
184 using this field should check the driver name and version, see
188 - Applications set this field to the desired number of buffers used
189 internally by the driver in :ref:`write() <func-write>` mode. Drivers
190 return the actual number of buffers. When an application requests
191 zero buffers, drivers should just return the current setting
192 rather than the minimum or an error code. For details see
196 - Reserved for future extensions. Drivers and applications must set
201 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
205 .. flat-table:: Streaming Parameters Capabilites
210 * - ``V4L2_CAP_TIMEPERFRAME``
212 - The frame skipping/repeating controlled by the ``timeperframe``
217 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
221 .. flat-table:: Capture Parameters Flags
226 * - ``V4L2_MODE_HIGHQUALITY``
228 - High quality imaging mode. High quality mode is intended for still
229 imaging applications. The idea is to get the best possible image
230 quality that the hardware can deliver. It is not defined how the
231 driver writer may achieve that; it will depend on the hardware and
232 the ingenuity of the driver writer. High quality mode is a
233 different mode from the regular motion video capture modes. In
236 - The driver may be able to capture higher resolutions than for
239 - The driver may support fewer pixel formats than motion capture
242 - The driver may capture and arithmetically combine multiple
243 successive fields or frames to remove color edge artifacts and
244 reduce the noise in the video data.
246 - The driver may capture images in slices like a scanner in order
247 to handle larger format images than would otherwise be
250 - An image capture operation may be significantly slower than
253 - Moving objects in the image might have excessive motion blur.
255 - Capture might only work through the :ref:`read() <func-read>` call.
261 On success 0 is returned, on error -1 and the ``errno`` variable is set
262 appropriately. The generic error codes are described at the
263 :ref:`Generic Error Codes <gen-errors>` chapter.