<?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_ENUM_FRAMEINTERVALS</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API" /><link rel="up" href="apa.html" title="Appendix A. Function Reference" /><link rel="prev" href="re29.html" title="ioctl VIDIOC_ENUM_FRAMESIZES" /><link rel="next" href="re31.html" title="ioctl VIDIOC_ENUMINPUT" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_ENUM_FRAMEINTERVALS</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re29.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="re31.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="ioctl VIDIOC_ENUM_FRAMEINTERVALS"><a id="vidioc-enum-frameintervals"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_ENUM_FRAMEINTERVALS — Enumerate frame intervals</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><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>struct v4l2_frmivalenum *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2695562"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="re64.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_ENUM_FRAMEINTERVALS</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p>Pointer to a struct <a class="link" href="re30.html#v4l2-frmivalenum" title="Table A.20. struct v4l2_frmivalenum">v4l2_frmivalenum</a> structure that contains a pixel format and size and receives a frame interval.</p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2695628"></a><h2>Description</h2><p>This ioctl allows applications to enumerate all frame intervals that the device supports for the given pixel format and frame size.</p><p>The supported pixel formats and frame sizes can be obtained by using the <a class="link" href="re28.html" title="ioctl VIDIOC_ENUM_FMT"><code class="constant">VIDIOC_ENUM_FMT</code></a> and <a class="link" href="re29.html" title="ioctl VIDIOC_ENUM_FRAMESIZES"><code class="constant">VIDIOC_ENUM_FRAMESIZES</code></a> functions.</p><p>The return value and the content of the <em class="structfield"><code>v4l2_frmivalenum.type</code></em> field depend on the type of frame intervals the device supports. Here are the semantics of the function for the different cases:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><span class="bold"><strong>Discrete:</strong></span> The function returns success if the given index value (zero-based) is valid. The application should increase the index by one for each call until <code class="constant">EINVAL</code> is returned. The `v4l2_frmivalenum.type` field is set to `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only the `discrete` member is valid.</p></li><li class="listitem"><p><span class="bold"><strong>Step-wise:</strong></span> The function returns success if the given index value is zero and <code class="constant">EINVAL</code> for any other index value. The <em class="structfield"><code>v4l2_frmivalenum.type</code></em> field is set to <code class="constant">V4L2_FRMIVAL_TYPE_STEPWISE</code> by the driver. Of the union only the <em class="structfield"><code>stepwise</code></em> member is valid.</p></li><li class="listitem"><p><span class="bold"><strong>Continuous:</strong></span> This is a special case of the step-wise type above. The function returns success if the given index value is zero and <code class="constant">EINVAL</code> for any other index value. The <em class="structfield"><code>v4l2_frmivalenum.type</code></em> field is set to <code class="constant">V4L2_FRMIVAL_TYPE_CONTINUOUS</code> by the driver. Of the union only the <em class="structfield"><code>stepwise</code></em> member is valid and the <em class="structfield"><code>step</code></em> value is set to 1.</p></li></ul></div><p>When the application calls the function with index zero, it must check the <em class="structfield"><code>type</code></em> field to determine the type of frame interval enumeration the device supports. Only for the <code class="constant">V4L2_FRMIVAL_TYPE_DISCRETE</code> type does it make sense to increase the index value to receive more frame intervals.</p><p>Note that the order in which the frame intervals are returned has no special meaning. In particular does it not say anything about potential default frame intervals.</p><p>Applications can assume that the enumeration data does not change without any interaction from the application itself. This means that the enumeration data is consistent if the application does not perform any other ioctl calls while it runs the frame interval enumeration.</p></div><div class="refsect1" title="Notes"><a id="id2695797"></a><h2>Notes</h2><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><span class="bold"><strong>Frame intervals and frame rates:</strong></span> The V4L2 API uses frame intervals instead of frame rates. Given the frame interval the frame rate can be computed as follows:</p><pre class="screen">frame_rate = 1 / frame_interval</pre></li></ul></div></div><div class="refsect1" title="Structs"><a id="id2695827"></a><h2>Structs</h2><p>In the structs below, <span class="emphasis"><em>IN</em></span> denotes a value that has to be filled in by the application, <span class="emphasis"><em>OUT</em></span> denotes values that the driver fills in. The application should zero out all members except for the <span class="emphasis"><em>IN</em></span> fields.</p><div class="table"><a id="v4l2-frmival-stepwise"></a><p class="title"><b>Table A.19. struct <span class="structname">v4l2_frmival_stepwise</span></b></p><div class="table-contents"><table summary="struct v4l2_frmival_stepwise" width="100%" border="0"><colgroup><col /><col /><col /></colgroup><tbody valign="top"><tr><td valign="top">struct <a class="link" href="re33.html#v4l2-fract" title="Table A.28. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>min</code></em></td><td valign="top">Minimum frame interval [s].</td></tr><tr><td valign="top">struct <a class="link" href="re33.html#v4l2-fract" title="Table A.28. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>max</code></em></td><td valign="top">Maximum frame interval [s].</td></tr><tr><td valign="top">struct <a class="link" href="re33.html#v4l2-fract" title="Table A.28. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>step</code></em></td><td valign="top">Frame interval step size [s].</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="v4l2-frmivalenum"></a><p class="title"><b>Table A.20. struct <span class="structname">v4l2_frmivalenum</span></b></p><div class="table-contents"><table summary="struct v4l2_frmivalenum" width="100%" border="0"><colgroup><col /><col /><col /><col /></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>index</code></em></td><td valign="top"> </td><td valign="top">IN: Index of the given frame interval in the enumeration.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>pixel_format</code></em></td><td valign="top"> </td><td valign="top">IN: Pixel format for which the frame intervals are enumerated.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>width</code></em></td><td valign="top"> </td><td valign="top">IN: Frame width for which the frame intervals are enumerated.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>height</code></em></td><td valign="top"> </td><td valign="top">IN: Frame height for which the frame intervals are enumerated.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>type</code></em></td><td valign="top"> </td><td valign="top">OUT: Frame interval type the device supports.</td></tr><tr><td valign="top">union</td><td valign="top"> </td><td valign="top"> </td><td valign="top">OUT: Frame interval with the given index.</td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="re33.html#v4l2-fract" title="Table A.28. struct v4l2_fract">v4l2_fract</a></td><td valign="top"><em class="structfield"><code>discrete</code></em></td><td valign="top">Frame interval [s].</td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="re30.html#v4l2-frmival-stepwise" title="Table A.19. struct v4l2_frmival_stepwise">v4l2_frmival_stepwise</a></td><td valign="top"><em class="structfield"><code>stepwise</code></em></td><td valign="top"> </td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved[2]</code></em></td><td valign="top"> </td><td valign="top">Reserved space for future use.</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="refsect1" title="Enums"><a id="id2696168"></a><h2>Enums</h2><div class="table"><a id="v4l2-frmivaltypes"></a><p class="title"><b>Table A.21. enum <span class="structname">v4l2_frmivaltypes</span></b></p><div class="table-contents"><table summary="enum v4l2_frmivaltypes" width="100%" border="0"><colgroup><col /><col /><col /></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_FRMIVAL_TYPE_DISCRETE</code></td><td valign="top">1</td><td valign="top">Discrete frame interval.</td></tr><tr><td valign="top"><code class="constant">V4L2_FRMIVAL_TYPE_CONTINUOUS</code></td><td valign="top">2</td><td valign="top">Continuous frame interval.</td></tr><tr><td valign="top"><code class="constant">V4L2_FRMIVAL_TYPE_STEPWISE</code></td><td valign="top">3</td><td valign="top">Step-wise defined frame interval.</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="refsect1" title="Return Value"><a id="id2696276"></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:</p><p>See the description section above for a list of return values that <code class="varname">errno</code> can have.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re29.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="apa.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re31.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_ENUM_FRAMESIZES </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_ENUMINPUT</td></tr></table></div></body></html>