<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><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><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 id="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 <strong class="fsfunc">ioctl</strong>(</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 id="idm140470007320752"></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 id="idm140470007241328"></a><h2>Description</h2><p>The current video standard determines a nominal number of frames per second. If less than this number of frames is to be captured or output, applications can request frame skipping or duplicating on the driver side. This is especially useful when using the <code class="function">read()</code> or <code class="function">write()</code>, which are not augmented by timestamps or sequence counters, and to avoid unnecessary data copying.</p><p>Further these ioctls can be used to determine the number of buffers used internally by a driver in read/write mode. For implications see the section discussing the <a class="link" href="func-read.html" title="V4L2 read()"><code class="function">read()</code></a> function.</p><p>To get and set the streaming parameters applications call the <code class="constant">VIDIOC_G_PARM</code> and <code class="constant">VIDIOC_S_PARM</code> ioctl, respectively. They take a pointer to a struct <span class="structname">v4l2_streamparm</span> which contains a union holding separate parameters for input and output devices.</p><div class="table"><a id="v4l2-streamparm"></a><p class="title"><strong>Table A.73. struct <span class="structname">v4l2_streamparm</span></strong></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.67. struct v4l2_format">v4l2_format</a> <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.74. 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 <em class="structfield"><code>type</code></em> is <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.75. 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 <em class="structfield"><code>type</code></em> is <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 id="v4l2-captureparm"></a><p class="title"><strong>Table A.74. struct <span class="structname">v4l2_captureparm</span></strong></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.76. Streaming Parameters Capabilites">Table A.76, “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.77. Capture Parameters Flags">Table A.77, “Capture Parameters Flags”</a>.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-enumstd.html#v4l2-fract" title="Table A.43. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>timeperframe</code></em></td><td valign="top"><p>This is is the desired period between successive frames captured by the driver, in seconds. The field is intended to skip frames on the driver side, saving I/O bandwidth.</p><p>Applications store here the desired frame period, drivers return the actual frame period, which must be greater or equal to the nominal frame period determined by the current video standard (struct <a class="link" href="vidioc-enumstd.html#v4l2-standard" title="Table A.42. struct v4l2_standard">v4l2_standard</a> <em class="structfield"><code>frameperiod</code></em> field). Changing the video standard (also implicitly by switching the video input) may reset this parameter to the nominal frame period. To reset manually applications can just set this field to zero.</p><p>Drivers support this function only when they set the <code class="constant">V4L2_CAP_TIMEPERFRAME</code> flag in the <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 unused, applications and drivers must set this field to zero. Applications using this field should check the driver name and version, 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 of 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 return the actual number of buffers. When an application requests zero buffers, drivers should just return the current setting rather than the 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 applications must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="v4l2-outputparm"></a><p class="title"><strong>Table A.75. struct <span class="structname">v4l2_outputparm</span></strong></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.76. Streaming Parameters Capabilites">Table A.76, “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.77. Capture Parameters Flags">Table A.77, “Capture Parameters Flags”</a>.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-enumstd.html#v4l2-fract" title="Table A.43. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>timeperframe</code></em></td><td valign="top">This is is the desired period between successive frames output by the driver, in seconds.</td></tr><tr><td colspan="3" valign="top"><p>The field is intended to repeat 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 mode timestamps can be used to throttle the output), saving I/O bandwidth.</p><p>Applications store here the desired frame period, drivers return the actual frame period, which must be greater or equal to the nominal frame period determined by the current video standard (struct <a class="link" href="vidioc-enumstd.html#v4l2-standard" title="Table A.42. struct v4l2_standard">v4l2_standard</a> <em class="structfield"><code>frameperiod</code></em> field). Changing the video standard (also implicitly by switching the video output) may reset this parameter to the nominal frame period. To reset manually applications can just set this field to zero.</p><p>Drivers support this function only when they set the <code class="constant">V4L2_CAP_TIMEPERFRAME</code> flag in the <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 unused, applications and drivers must set this field to zero. Applications using this field should check the driver name and version, 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 of buffers used internally by the driver in <code class="function">write()</code> mode. Drivers return the actual number of buffers. When an application requests zero buffers, drivers should just return the current setting rather than the 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 applications must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="parm-caps"></a><p class="title"><strong>Table A.76. Streaming Parameters Capabilites</strong></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 <em class="structfield"><code>timeperframe</code></em> field is supported.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="parm-flags"></a><p class="title"><strong>Table A.77. Capture Parameters Flags</strong></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 is intended for still imaging applications. The idea is to get the best possible image quality that the hardware can deliver. It is not defined how the driver writer may achieve that; it will depend on the hardware and the ingenuity of the driver writer. High quality mode is a different mode from the the regular motion video capture modes. In high 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 resolutions than for motion capture.</p></li><li class="listitem"><p>The driver may support fewer pixel formats than motion capture (eg; true color).</p></li><li class="listitem"><p>The driver may capture and arithmetically combine multiple successive fields or frames to remove color edge artifacts and reduce the noise in the video data. </p></li><li class="listitem"><p>The driver may capture images in slices like a scanner in order to handle larger format images than would otherwise be possible. </p></li><li class="listitem"><p>An image capture operation may be significantly slower than motion capture. </p></li><li class="listitem"><p>Moving objects in the image might have excessive motion blur. </p></li><li class="listitem"><p>Capture might only work through the <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 id="idm140470007136640"></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>