1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_G_PARM, VIDIOC_S_PARM</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix A. Function Reference"><link rel="prev" href="vidioc-g-output.html" title="ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT"><link rel="next" href="vidioc-g-priority.html" title="ioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_G_PARM, VIDIOC_S_PARM</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-g-output.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-g-priority.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-g-parm"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_G_PARM, VIDIOC_S_PARM — Get or set streaming parameters</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>v4l2_streamparm *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1114857340"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_G_PARM, VIDIOC_S_PARM</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1114903820"></a><h2>Description</h2><p>The current video standard determines a nominal number of 2frames per second. If less than this number of frames is to be 3captured or output, applications can request frame skipping or 4duplicating on the driver side. This is especially useful when using 5the <code class="function">read()</code> or <code class="function">write()</code>, which 6are not augmented by timestamps or sequence counters, and to avoid 7unnecessary data copying.</p><p>Further these ioctls can be used to determine the number of 8buffers used internally by a driver in read/write mode. For 9implications see the section discussing the <a class="link" href="func-read.html" title="V4L2 read()"><code class="function">read()</code></a> 10function.</p><p>To get and set the streaming parameters applications call 11the <code class="constant">VIDIOC_G_PARM</code> and 12<code class="constant">VIDIOC_S_PARM</code> ioctl, respectively. They take a 13pointer to a struct <span class="structname">v4l2_streamparm</span> which 14contains a union holding separate parameters for input and output 15devices.</p><div class="table"><a name="v4l2-streamparm"></a><p class="title"><b>Table A.78. struct <span class="structname">v4l2_streamparm</span></b></p><div class="table-contents"><table summary="struct v4l2_streamparm" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"><col class="c4"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>type</code></em></td><td valign="top"> </td><td valign="top">The buffer (stream) type, same as struct <a class="link" href="vidioc-g-fmt.html#v4l2-format" title="Table A.72. struct v4l2_format">v4l2_format</a> 16<em class="structfield"><code>type</code></em>, set by the application. See <a class="xref" href="buffer.html#v4l2-buf-type" title="Table 3.3. enum v4l2_buf_type">Table 3.3, “enum v4l2_buf_type”</a></td></tr><tr><td valign="top">union</td><td valign="top"><em class="structfield"><code>parm</code></em></td><td valign="top"> </td><td valign="top"> </td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="vidioc-g-parm.html#v4l2-captureparm" title="Table A.79. struct v4l2_captureparm">v4l2_captureparm</a></td><td valign="top"><em class="structfield"><code>capture</code></em></td><td valign="top">Parameters for capture devices, used when 17<em class="structfield"><code>type</code></em> is 18<code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE</code>.</td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="vidioc-g-parm.html#v4l2-outputparm" title="Table A.80. struct v4l2_outputparm">v4l2_outputparm</a></td><td valign="top"><em class="structfield"><code>output</code></em></td><td valign="top">Parameters for output devices, used when 19<em class="structfield"><code>type</code></em> is 20<code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT</code>.</td></tr><tr><td valign="top"> </td><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>raw_data</code></em>[200]</td><td valign="top">A place holder for future extensions.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-captureparm"></a><p class="title"><b>Table A.79. struct <span class="structname">v4l2_captureparm</span></b></p><div class="table-contents"><table summary="struct v4l2_captureparm" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>capability</code></em></td><td valign="top">See <a class="xref" href="vidioc-g-parm.html#parm-caps" title="Table A.81. Streaming Parameters Capabilites">Table A.81, “Streaming Parameters Capabilites”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>capturemode</code></em></td><td valign="top">Set by drivers and applications, see <a class="xref" href="vidioc-g-parm.html#parm-flags" title="Table A.82. Capture Parameters Flags">Table A.82, “Capture Parameters Flags”</a>.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-enumstd.html#v4l2-fract" title="Table A.47. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>timeperframe</code></em></td><td valign="top"><p>This is the desired period between 21successive frames captured by the driver, in seconds. The 22field is intended to skip frames on the driver side, saving I/O 23bandwidth.</p><p>Applications store here the desired frame 24period, drivers return the actual frame period, which must be greater 25or equal to the nominal frame period determined by the current video 26standard (struct <a class="link" href="vidioc-enumstd.html#v4l2-standard" title="Table A.46. struct v4l2_standard">v4l2_standard</a> <em class="structfield"><code>frameperiod</code></em> 27field). Changing the video standard (also implicitly by switching the 28video input) may reset this parameter to the nominal frame period. To 29reset manually applications can just set this field to 30zero.</p><p>Drivers support this function only when they set the 31<code class="constant">V4L2_CAP_TIMEPERFRAME</code> flag in the 32<em class="structfield"><code>capability</code></em> field.</p></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>extendedmode</code></em></td><td valign="top">Custom (driver specific) streaming parameters. When 33unused, applications and drivers must set this field to zero. 34Applications using this field should check the driver name and 35version, see <a class="xref" href="querycap.html" title="Querying Capabilities">the section called “Querying Capabilities”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>readbuffers</code></em></td><td valign="top">Applications set this field to the desired number 36of buffers used internally by the driver in <a class="link" href="func-read.html" title="V4L2 read()"><code class="function">read()</code></a> mode. Drivers 37return the actual number of buffers. When an application requests zero 38buffers, drivers should just return the current setting rather than 39the minimum or an error code. For details see <a class="xref" href="io.html#rw" title="Read/Write">the section called “Read/Write”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[4]</td><td valign="top">Reserved for future extensions. Drivers and 40applications must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-outputparm"></a><p class="title"><b>Table A.80. struct <span class="structname">v4l2_outputparm</span></b></p><div class="table-contents"><table summary="struct v4l2_outputparm" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>capability</code></em></td><td valign="top">See <a class="xref" href="vidioc-g-parm.html#parm-caps" title="Table A.81. Streaming Parameters Capabilites">Table A.81, “Streaming Parameters Capabilites”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>outputmode</code></em></td><td valign="top">Set by drivers and applications, see <a class="xref" href="vidioc-g-parm.html#parm-flags" title="Table A.82. Capture Parameters Flags">Table A.82, “Capture Parameters Flags”</a>.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-enumstd.html#v4l2-fract" title="Table A.47. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>timeperframe</code></em></td><td valign="top">This is the desired period between 41successive frames output by the driver, in seconds.</td></tr><tr><td colspan="3" valign="top"><p>The field is intended to 42repeat frames on the driver side in <a class="link" href="func-write.html" title="V4L2 write()"><code class="function">write()</code></a> mode (in streaming 43mode timestamps can be used to throttle the output), saving I/O 44bandwidth.</p><p>Applications store here the desired frame 45period, drivers return the actual frame period, which must be greater 46or equal to the nominal frame period determined by the current video 47standard (struct <a class="link" href="vidioc-enumstd.html#v4l2-standard" title="Table A.46. struct v4l2_standard">v4l2_standard</a> <em class="structfield"><code>frameperiod</code></em> 48field). Changing the video standard (also implicitly by switching the 49video output) may reset this parameter to the nominal frame period. To 50reset manually applications can just set this field to 51zero.</p><p>Drivers support this function only when they set the 52<code class="constant">V4L2_CAP_TIMEPERFRAME</code> flag in the 53<em class="structfield"><code>capability</code></em> field.</p></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>extendedmode</code></em></td><td valign="top">Custom (driver specific) streaming parameters. When 54unused, applications and drivers must set this field to zero. 55Applications using this field should check the driver name and 56version, see <a class="xref" href="querycap.html" title="Querying Capabilities">the section called “Querying Capabilities”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>writebuffers</code></em></td><td valign="top">Applications set this field to the desired number 57of buffers used internally by the driver in 58<code class="function">write()</code> mode. Drivers return the actual number of 59buffers. When an application requests zero buffers, drivers should 60just return the current setting rather than the minimum or an error 61code. For details see <a class="xref" href="io.html#rw" title="Read/Write">the section called “Read/Write”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[4]</td><td valign="top">Reserved for future extensions. Drivers and 62applications must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="parm-caps"></a><p class="title"><b>Table A.81. Streaming Parameters Capabilites</b></p><div class="table-contents"><table summary="Streaming Parameters Capabilites" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_CAP_TIMEPERFRAME</code></td><td valign="top">0x1000</td><td valign="top">The frame skipping/repeating controlled by the 63<em class="structfield"><code>timeperframe</code></em> field is supported.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="parm-flags"></a><p class="title"><b>Table A.82. Capture Parameters Flags</b></p><div class="table-contents"><table summary="Capture Parameters Flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_MODE_HIGHQUALITY</code></td><td valign="top">0x0001</td><td valign="top"><p>High quality imaging mode. High quality mode 64is intended for still imaging applications. The idea is to get the 65best possible image quality that the hardware can deliver. It is not 66defined how the driver writer may achieve that; it will depend on the 67hardware and the ingenuity of the driver writer. High quality mode is 68a different mode from the the regular motion video capture modes. In 69high quality mode:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The driver may be able to capture higher 70resolutions than for motion capture.</p></li><li class="listitem"><p>The driver may support fewer pixel formats 71than motion capture (eg; true color).</p></li><li class="listitem"><p>The driver may capture and arithmetically 72combine multiple successive fields or frames to remove color edge 73artifacts and reduce the noise in the video data. 74</p></li><li class="listitem"><p>The driver may capture images in slices like 75a scanner in order to handle larger format images than would otherwise 76be possible. </p></li><li class="listitem"><p>An image capture operation may be 77significantly slower than motion capture. </p></li><li class="listitem"><p>Moving objects in the image might have 78excessive motion blur. </p></li><li class="listitem"><p>Capture might only work through the 79<code class="function">read()</code> call.</p></li></ul></div></td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1114958972"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-g-output.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="vidioc-g-priority.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY</td></tr></table></div></body></html> 80