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
66 - The buffer (stream) type, same as struct
67 :c:type:`v4l2_format` ``type``, set by the
68 application. See :c:type:`v4l2_buf_type`
74 - struct :c:type:`v4l2_captureparm`
76 - Parameters for capture devices, used when ``type`` is
77 ``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
79 - struct :c:type:`v4l2_outputparm`
81 - Parameters for output devices, used when ``type`` is
82 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
86 - A place holder for future extensions.
90 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
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. The field is intended to skip frames on
109 the driver side, saving I/O bandwidth.
111 Applications store here the desired frame period, drivers return
112 the actual frame period, which must be greater or equal to the
113 nominal frame period determined by the current video standard
114 (struct :c:type:`v4l2_standard` ``frameperiod``
115 field). Changing the video standard (also implicitly by switching
116 the video input) may reset this parameter to the nominal frame
117 period. To reset manually applications can just set this field to
120 Drivers support this function only when they set the
121 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
124 - Custom (driver specific) streaming parameters. When unused,
125 applications and drivers must set this field to zero. Applications
126 using this field should check the driver name and version, see
130 - Applications set this field to the desired number of buffers used
131 internally by the driver in :ref:`read() <func-read>` mode.
132 Drivers return the actual number of buffers. When an application
133 requests zero buffers, drivers should just return the current
134 setting rather than the minimum or an error code. For details see
138 - Reserved for future extensions. Drivers and applications must set
143 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
145 .. c:type:: v4l2_outputparm
147 .. flat-table:: struct v4l2_outputparm
154 - See :ref:`parm-caps`.
157 - Set by drivers and applications, see :ref:`parm-flags`.
158 * - struct :c:type:`v4l2_fract`
160 - This is the desired period between successive frames output by the
164 The field is intended to repeat frames on the driver side in
165 :ref:`write() <func-write>` mode (in streaming mode timestamps
166 can be used to throttle the output), saving I/O bandwidth.
168 Applications store here the desired frame period, drivers return
169 the actual frame period, which must be greater or equal to the
170 nominal frame period determined by the current video standard
171 (struct :c:type:`v4l2_standard` ``frameperiod``
172 field). Changing the video standard (also implicitly by switching
173 the video output) may reset this parameter to the nominal frame
174 period. To reset manually applications can just set this field to
177 Drivers support this function only when they set the
178 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
181 - Custom (driver specific) streaming parameters. When unused,
182 applications and drivers must set this field to zero. Applications
183 using this field should check the driver name and version, see
187 - Applications set this field to the desired number of buffers used
188 internally by the driver in :ref:`write() <func-write>` mode. Drivers
189 return the actual number of buffers. When an application requests
190 zero buffers, drivers should just return the current setting
191 rather than the minimum or an error code. For details see
195 - Reserved for future extensions. Drivers and applications must set
200 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
204 .. flat-table:: Streaming Parameters Capabilites
209 * - ``V4L2_CAP_TIMEPERFRAME``
211 - The frame skipping/repeating controlled by the ``timeperframe``
216 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
220 .. flat-table:: Capture Parameters Flags
225 * - ``V4L2_MODE_HIGHQUALITY``
227 - High quality imaging mode. High quality mode is intended for still
228 imaging applications. The idea is to get the best possible image
229 quality that the hardware can deliver. It is not defined how the
230 driver writer may achieve that; it will depend on the hardware and
231 the ingenuity of the driver writer. High quality mode is a
232 different mode from the regular motion video capture modes. In
235 - The driver may be able to capture higher resolutions than for
238 - The driver may support fewer pixel formats than motion capture
241 - The driver may capture and arithmetically combine multiple
242 successive fields or frames to remove color edge artifacts and
243 reduce the noise in the video data.
245 - The driver may capture images in slices like a scanner in order
246 to handle larger format images than would otherwise be
249 - An image capture operation may be significantly slower than
252 - Moving objects in the image might have excessive motion blur.
254 - Capture might only work through the :ref:`read() <func-read>` call.
260 On success 0 is returned, on error -1 and the ``errno`` variable is set
261 appropriately. The generic error codes are described at the
262 :ref:`Generic Error Codes <gen-errors>` chapter.