1 .. SPDX-License-Identifier: GFDL-1.1-no-invari !! 1 .. Permission is granted to copy, distribute and/or modify this 2 .. c:namespace:: V4L !! 2 .. document under the terms of the GNU Free Documentation License, >> 3 .. Version 1.1 or any later version published by the Free Software >> 4 .. Foundation, with no Invariant Sections, no Front-Cover Texts >> 5 .. and no Back-Cover Texts. A copy of the license is included at >> 6 .. Documentation/userspace-api/media/fdl-appendix.rst. >> 7 .. >> 8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections 3 9 4 .. _VIDIOC_G_PARM: 10 .. _VIDIOC_G_PARM: 5 11 6 ********************************** 12 ********************************** 7 ioctl VIDIOC_G_PARM, VIDIOC_S_PARM 13 ioctl VIDIOC_G_PARM, VIDIOC_S_PARM 8 ********************************** 14 ********************************** 9 15 10 Name 16 Name 11 ==== 17 ==== 12 18 13 VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set str 19 VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters 14 20 >> 21 15 Synopsis 22 Synopsis 16 ======== 23 ======== 17 24 18 .. c:macro:: VIDIOC_G_PARM !! 25 .. c:function:: int ioctl( int fd, VIDIOC_G_PARM, v4l2_streamparm *argp ) 19 !! 26 :name: VIDIOC_G_PARM 20 ``int ioctl(int fd, VIDIOC_G_PARM, v4l2_stream << 21 27 22 .. c:macro:: VIDIOC_S_PARM !! 28 .. c:function:: int ioctl( int fd, VIDIOC_S_PARM, v4l2_streamparm *argp ) >> 29 :name: VIDIOC_S_PARM 23 30 24 ``int ioctl(int fd, VIDIOC_S_PARM, v4l2_stream << 25 31 26 Arguments 32 Arguments 27 ========= 33 ========= 28 34 29 ``fd`` 35 ``fd`` 30 File descriptor returned by :c:func:`open( !! 36 File descriptor returned by :ref:`open() <func-open>`. 31 37 32 ``argp`` 38 ``argp`` 33 Pointer to struct :c:type:`v4l2_streamparm 39 Pointer to struct :c:type:`v4l2_streamparm`. 34 40 >> 41 35 Description 42 Description 36 =========== 43 =========== 37 44 38 Applications can request a different frame int !! 45 The current video standard determines a nominal number of frames per 39 output device will be reconfigured to support !! 46 second. If less than this number of frames is to be captured or output, 40 interval if possible. Optionally drivers may c !! 47 applications can request frame skipping or duplicating on the driver 41 repeat frames to achieve the requested frame i !! 48 side. This is especially useful when using the :ref:`read() <func-read>` or 42 !! 49 :ref:`write() <func-write>`, which are not augmented by timestamps or sequence 43 For stateful encoders (see :ref:`encoder`) thi !! 50 counters, and to avoid unnecessary data copying. 44 frame interval that is typically embedded in t << 45 51 46 Changing the frame interval shall never change 52 Changing the frame interval shall never change the format. Changing the 47 format, on the other hand, may change the fram 53 format, on the other hand, may change the frame interval. 48 54 49 Further these ioctls can be used to determine 55 Further these ioctls can be used to determine the number of buffers used 50 internally by a driver in read/write mode. For 56 internally by a driver in read/write mode. For implications see the 51 section discussing the :c:func:`read()` functi !! 57 section discussing the :ref:`read() <func-read>` function. 52 58 53 To get and set the streaming parameters applic 59 To get and set the streaming parameters applications call the 54 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and !! 60 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a 55 :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, re << 56 pointer to a struct :c:type:`v4l2_streamparm` 61 pointer to a struct :c:type:`v4l2_streamparm` which contains a 57 union holding separate parameters for input an 62 union holding separate parameters for input and output devices. 58 63 59 .. tabularcolumns:: |p{3.7cm}|p{3.5cm}|p{10.1c !! 64 >> 65 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| 60 66 61 .. c:type:: v4l2_streamparm 67 .. c:type:: v4l2_streamparm 62 68 63 .. flat-table:: struct v4l2_streamparm 69 .. flat-table:: struct v4l2_streamparm 64 :header-rows: 0 70 :header-rows: 0 65 :stub-columns: 0 71 :stub-columns: 0 66 :widths: 1 1 2 72 :widths: 1 1 2 67 73 68 * - __u32 74 * - __u32 69 - ``type`` 75 - ``type`` 70 - The buffer (stream) type, same as stru 76 - The buffer (stream) type, same as struct 71 :c:type:`v4l2_format` ``type``, set by 77 :c:type:`v4l2_format` ``type``, set by the 72 application. See :c:type:`v4l2_buf_typ 78 application. See :c:type:`v4l2_buf_type`. 73 * - union { 79 * - union { 74 - ``parm`` 80 - ``parm`` 75 * - struct :c:type:`v4l2_captureparm` 81 * - struct :c:type:`v4l2_captureparm` 76 - ``capture`` 82 - ``capture`` 77 - Parameters for capture devices, used w 83 - Parameters for capture devices, used when ``type`` is 78 ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or 84 ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or 79 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` 85 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``. 80 * - struct :c:type:`v4l2_outputparm` 86 * - struct :c:type:`v4l2_outputparm` 81 - ``output`` 87 - ``output`` 82 - Parameters for output devices, used wh 88 - Parameters for output devices, used when ``type`` is 83 ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` or ``V4 89 ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` or ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``. 84 * - __u8 90 * - __u8 85 - ``raw_data``\ [200] 91 - ``raw_data``\ [200] 86 - A place holder for future extensions. 92 - A place holder for future extensions. 87 * - } 93 * - } >> 94 - >> 95 88 96 89 97 90 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm !! 98 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 91 99 92 .. c:type:: v4l2_captureparm 100 .. c:type:: v4l2_captureparm 93 101 94 .. flat-table:: struct v4l2_captureparm 102 .. flat-table:: struct v4l2_captureparm 95 :header-rows: 0 103 :header-rows: 0 96 :stub-columns: 0 104 :stub-columns: 0 97 :widths: 1 1 2 105 :widths: 1 1 2 98 106 99 * - __u32 107 * - __u32 100 - ``capability`` 108 - ``capability`` 101 - See :ref:`parm-caps`. 109 - See :ref:`parm-caps`. 102 * - __u32 110 * - __u32 103 - ``capturemode`` 111 - ``capturemode`` 104 - Set by drivers and applications, see : 112 - Set by drivers and applications, see :ref:`parm-flags`. 105 * - struct :c:type:`v4l2_fract` 113 * - struct :c:type:`v4l2_fract` 106 - ``timeperframe`` 114 - ``timeperframe`` 107 - This is the desired period between suc 115 - This is the desired period between successive frames captured by 108 the driver, in seconds. !! 116 the driver, in seconds. The field is intended to skip frames on 109 * - :cspan:`2` !! 117 the driver side, saving I/O bandwidth. 110 << 111 This will configure the speed at which << 112 generates video frames. If the speed i << 113 choose to skip or repeat frames in ord << 114 frame rate. << 115 << 116 For stateful encoders (see :ref:`encod << 117 frame interval that is typically embed << 118 118 119 Applications store here the desired fr 119 Applications store here the desired frame period, drivers return 120 the actual frame period. !! 120 the actual frame period, which must be greater or equal to the 121 !! 121 nominal frame period determined by the current video standard 122 Changing the video standard (also impl !! 122 (struct :c:type:`v4l2_standard` ``frameperiod`` >> 123 field). Changing the video standard (also implicitly by switching 123 the video input) may reset this parame 124 the video input) may reset this parameter to the nominal frame 124 period. To reset manually applications 125 period. To reset manually applications can just set this field to 125 zero. 126 zero. 126 127 127 Drivers support this function only whe 128 Drivers support this function only when they set the 128 ``V4L2_CAP_TIMEPERFRAME`` flag in the 129 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. 129 * - __u32 130 * - __u32 130 - ``extendedmode`` 131 - ``extendedmode`` 131 - Custom (driver specific) streaming par 132 - Custom (driver specific) streaming parameters. When unused, 132 applications and drivers must set this 133 applications and drivers must set this field to zero. Applications 133 using this field should check the driv 134 using this field should check the driver name and version, see 134 :ref:`querycap`. 135 :ref:`querycap`. 135 * - __u32 136 * - __u32 136 - ``readbuffers`` 137 - ``readbuffers`` 137 - Applications set this field to the des 138 - Applications set this field to the desired number of buffers used 138 internally by the driver in :c:func:`r !! 139 internally by the driver in :ref:`read() <func-read>` mode. 139 Drivers return the actual number of bu 140 Drivers return the actual number of buffers. When an application 140 requests zero buffers, drivers should 141 requests zero buffers, drivers should just return the current 141 setting rather than the minimum or an 142 setting rather than the minimum or an error code. For details see 142 :ref:`rw`. 143 :ref:`rw`. 143 * - __u32 144 * - __u32 144 - ``reserved``\ [4] 145 - ``reserved``\ [4] 145 - Reserved for future extensions. Driver 146 - Reserved for future extensions. Drivers and applications must set 146 the array to zero. 147 the array to zero. 147 148 148 149 149 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm !! 150 >> 151 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 150 152 151 .. c:type:: v4l2_outputparm 153 .. c:type:: v4l2_outputparm 152 154 153 .. flat-table:: struct v4l2_outputparm 155 .. flat-table:: struct v4l2_outputparm 154 :header-rows: 0 156 :header-rows: 0 155 :stub-columns: 0 157 :stub-columns: 0 156 :widths: 1 1 2 158 :widths: 1 1 2 157 159 158 * - __u32 160 * - __u32 159 - ``capability`` 161 - ``capability`` 160 - See :ref:`parm-caps`. 162 - See :ref:`parm-caps`. 161 * - __u32 163 * - __u32 162 - ``outputmode`` 164 - ``outputmode`` 163 - Set by drivers and applications, see : 165 - Set by drivers and applications, see :ref:`parm-flags`. 164 * - struct :c:type:`v4l2_fract` 166 * - struct :c:type:`v4l2_fract` 165 - ``timeperframe`` 167 - ``timeperframe`` 166 - This is the desired period between suc 168 - This is the desired period between successive frames output by the 167 driver, in seconds. 169 driver, in seconds. 168 * - :cspan:`2` 170 * - :cspan:`2` 169 171 170 The field is intended to repeat frames 172 The field is intended to repeat frames on the driver side in 171 :c:func:`write()` mode (in streaming m !! 173 :ref:`write() <func-write>` mode (in streaming mode timestamps 172 can be used to throttle the output), s 174 can be used to throttle the output), saving I/O bandwidth. 173 175 174 For stateful encoders (see :ref:`encod << 175 frame interval that is typically embed << 176 and it provides a hint to the encoder << 177 frames are queued up to the encoder. << 178 << 179 Applications store here the desired fr 176 Applications store here the desired frame period, drivers return 180 the actual frame period. !! 177 the actual frame period, which must be greater or equal to the 181 !! 178 nominal frame period determined by the current video standard 182 Changing the video standard (also impl !! 179 (struct :c:type:`v4l2_standard` ``frameperiod`` >> 180 field). Changing the video standard (also implicitly by switching 183 the video output) may reset this param 181 the video output) may reset this parameter to the nominal frame 184 period. To reset manually applications 182 period. To reset manually applications can just set this field to 185 zero. 183 zero. 186 184 187 Drivers support this function only whe 185 Drivers support this function only when they set the 188 ``V4L2_CAP_TIMEPERFRAME`` flag in the 186 ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. 189 * - __u32 187 * - __u32 190 - ``extendedmode`` 188 - ``extendedmode`` 191 - Custom (driver specific) streaming par 189 - Custom (driver specific) streaming parameters. When unused, 192 applications and drivers must set this 190 applications and drivers must set this field to zero. Applications 193 using this field should check the driv 191 using this field should check the driver name and version, see 194 :ref:`querycap`. 192 :ref:`querycap`. 195 * - __u32 193 * - __u32 196 - ``writebuffers`` 194 - ``writebuffers`` 197 - Applications set this field to the des 195 - Applications set this field to the desired number of buffers used 198 internally by the driver in :c:func:`w !! 196 internally by the driver in :ref:`write() <func-write>` mode. Drivers 199 return the actual number of buffers. W 197 return the actual number of buffers. When an application requests 200 zero buffers, drivers should just retu 198 zero buffers, drivers should just return the current setting 201 rather than the minimum or an error co 199 rather than the minimum or an error code. For details see 202 :ref:`rw`. 200 :ref:`rw`. 203 * - __u32 201 * - __u32 204 - ``reserved``\ [4] 202 - ``reserved``\ [4] 205 - Reserved for future extensions. Driver 203 - Reserved for future extensions. Drivers and applications must set 206 the array to zero. 204 the array to zero. 207 205 208 206 209 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm !! 207 >> 208 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 210 209 211 .. _parm-caps: 210 .. _parm-caps: 212 211 213 .. flat-table:: Streaming Parameters Capabilit 212 .. flat-table:: Streaming Parameters Capabilities 214 :header-rows: 0 213 :header-rows: 0 215 :stub-columns: 0 214 :stub-columns: 0 216 :widths: 3 1 4 215 :widths: 3 1 4 217 216 218 * - ``V4L2_CAP_TIMEPERFRAME`` 217 * - ``V4L2_CAP_TIMEPERFRAME`` 219 - 0x1000 218 - 0x1000 220 - The frame period can be modified by se !! 219 - The frame skipping/repeating controlled by the ``timeperframe`` 221 field. !! 220 field is supported. 222 221 223 222 224 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm !! 223 >> 224 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 225 225 226 .. _parm-flags: 226 .. _parm-flags: 227 227 228 .. flat-table:: Capture Parameters Flags 228 .. flat-table:: Capture Parameters Flags 229 :header-rows: 0 229 :header-rows: 0 230 :stub-columns: 0 230 :stub-columns: 0 231 :widths: 3 1 4 231 :widths: 3 1 4 232 232 233 * - ``V4L2_MODE_HIGHQUALITY`` 233 * - ``V4L2_MODE_HIGHQUALITY`` 234 - 0x0001 234 - 0x0001 235 - High quality imaging mode. High qualit 235 - High quality imaging mode. High quality mode is intended for still 236 imaging applications. The idea is to g 236 imaging applications. The idea is to get the best possible image 237 quality that the hardware can deliver. 237 quality that the hardware can deliver. It is not defined how the 238 driver writer may achieve that; it wil 238 driver writer may achieve that; it will depend on the hardware and 239 the ingenuity of the driver writer. Hi 239 the ingenuity of the driver writer. High quality mode is a 240 different mode from the regular motion 240 different mode from the regular motion video capture modes. In 241 high quality mode: 241 high quality mode: 242 242 243 - The driver may be able to capture h 243 - The driver may be able to capture higher resolutions than for 244 motion capture. 244 motion capture. 245 245 246 - The driver may support fewer pixel 246 - The driver may support fewer pixel formats than motion capture 247 (eg; true color). 247 (eg; true color). 248 248 249 - The driver may capture and arithmet 249 - The driver may capture and arithmetically combine multiple 250 successive fields or frames to remo 250 successive fields or frames to remove color edge artifacts and 251 reduce the noise in the video data. 251 reduce the noise in the video data. 252 252 253 - The driver may capture images in sl 253 - The driver may capture images in slices like a scanner in order 254 to handle larger format images than 254 to handle larger format images than would otherwise be 255 possible. 255 possible. 256 256 257 - An image capture operation may be s 257 - An image capture operation may be significantly slower than 258 motion capture. 258 motion capture. 259 259 260 - Moving objects in the image might h 260 - Moving objects in the image might have excessive motion blur. 261 261 262 - Capture might only work through the !! 262 - Capture might only work through the :ref:`read() <func-read>` call. >> 263 263 264 264 Return Value 265 Return Value 265 ============ 266 ============ 266 267 267 On success 0 is returned, on error -1 and the 268 On success 0 is returned, on error -1 and the ``errno`` variable is set 268 appropriately. The generic error codes are des 269 appropriately. The generic error codes are described at the 269 :ref:`Generic Error Codes <gen-errors>` chapte 270 :ref:`Generic Error Codes <gen-errors>` chapter.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.