1<html><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.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-enum-framesizes.html" title="ioctl VIDIOC_ENUM_FRAMESIZES"><link rel="next" href="vidioc-enum-freq-bands.html" title="ioctl VIDIOC_ENUM_FREQ_BANDS"></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_ENUM_FRAMEINTERVALS</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-enum-framesizes.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-enum-freq-bands.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="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"><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>struct v4l2_frmivalenum *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1113008476"></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_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="vidioc-enum-frameintervals.html#v4l2-frmivalenum" title="Table A.35. struct v4l2_frmivalenum">v4l2_frmivalenum</a> structure that 2contains a pixel format and size and receives a frame interval.</p></dd></dl></div></div><div class="refsect1"><a name="idp1113012740"></a><h2>Description</h2><p>This ioctl allows applications to enumerate all frame 3intervals that the device supports for the given pixel format and 4frame size.</p><p>The supported pixel formats and frame sizes can be obtained 5by using the <a class="link" href="vidioc-enum-fmt.html" title="ioctl VIDIOC_ENUM_FMT"><code class="constant">VIDIOC_ENUM_FMT</code></a> and <a class="link" href="vidioc-enum-framesizes.html" title="ioctl VIDIOC_ENUM_FRAMESIZES"><code class="constant">VIDIOC_ENUM_FRAMESIZES</code></a> 6functions.</p><p>The return value and the content of the 7<em class="structfield"><code>v4l2_frmivalenum.type</code></em> field depend on the 8type of frame intervals the device supports. Here are the semantics of 9the function for the different cases:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="bold"><strong>Discrete:</strong></span> The function 10returns success if the given index value (zero-based) is valid. The 11application should increase the index by one for each call until 12<code class="constant">EINVAL</code> is returned. The `v4l2_frmivalenum.type` 13field is set to `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the 14union only the `discrete` member is valid.</p></li><li class="listitem"><p><span class="bold"><strong>Step-wise:</strong></span> The function 15returns success if the given index value is zero and 16<code class="constant">EINVAL</code> for any other index value. The 17<em class="structfield"><code>v4l2_frmivalenum.type</code></em> field is set to 18<code class="constant">V4L2_FRMIVAL_TYPE_STEPWISE</code> by the driver. Of the 19union only the <em class="structfield"><code>stepwise</code></em> member is 20valid.</p></li><li class="listitem"><p><span class="bold"><strong>Continuous:</strong></span> This is a 21special case of the step-wise type above. The function returns success 22if the given index value is zero and <code class="constant">EINVAL</code> for 23any other index value. The 24<em class="structfield"><code>v4l2_frmivalenum.type</code></em> field is set to 25<code class="constant">V4L2_FRMIVAL_TYPE_CONTINUOUS</code> by the driver. Of 26the union only the <em class="structfield"><code>stepwise</code></em> member is valid 27and 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 28must check the <em class="structfield"><code>type</code></em> field to determine the 29type of frame interval enumeration the device supports. Only for the 30<code class="constant">V4L2_FRMIVAL_TYPE_DISCRETE</code> type does it make 31sense to increase the index value to receive more frame 32intervals.</p><p>Note that the order in which the frame intervals are 33returned has no special meaning. In particular does it not say 34anything about potential default frame intervals.</p><p>Applications can assume that the enumeration data does not 35change without any interaction from the application itself. This means 36that the enumeration data is consistent if the application does not 37perform any other ioctl calls while it runs the frame interval 38enumeration.</p></div><div class="refsect1"><a name="idp1113022900"></a><h2>Notes</h2><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="bold"><strong>Frame intervals and frame 39rates:</strong></span> The V4L2 API uses frame intervals instead of frame 40rates. Given the frame interval the frame rate can be computed as 41follows:</p><pre class="screen">frame_rate = 1 / frame_interval</pre></li></ul></div></div><div class="refsect1"><a name="idp1113024676"></a><h2>Structs</h2><p>In the structs below, <span class="emphasis"><em>IN</em></span> denotes a 42value that has to be filled in by the application, 43<span class="emphasis"><em>OUT</em></span> denotes values that the driver fills in. The 44application should zero out all members except for the 45<span class="emphasis"><em>IN</em></span> fields.</p><div class="table"><a name="v4l2-frmival-stepwise"></a><p class="title"><b>Table A.34. 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 class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><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>min</code></em></td><td valign="top">Minimum frame interval [s].</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>max</code></em></td><td valign="top">Maximum frame interval [s].</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>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 name="v4l2-frmivalenum"></a><p class="title"><b>Table A.35. struct <span class="structname">v4l2_frmivalenum</span></b></p><div class="table-contents"><table summary="struct v4l2_frmivalenum" 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>index</code></em></td><td valign="top"> </td><td valign="top">IN: Index of the given frame interval in the 46enumeration.</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 47enumerated.</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 48enumerated.</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 49enumerated.</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="vidioc-enumstd.html#v4l2-fract" title="Table A.47. 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="vidioc-enum-frameintervals.html#v4l2-frmival-stepwise" title="Table A.34. 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"><a name="idp1113045668"></a><h2>Enums</h2><div class="table"><a name="v4l2-frmivaltypes"></a><p class="title"><b>Table A.36. enum <span class="structname">v4l2_frmivaltypes</span></b></p><div class="table-contents"><table summary="enum v4l2_frmivaltypes" 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_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"><a name="idp1113052148"></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-enum-framesizes.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-enum-freq-bands.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_ENUM_FREQ_BANDS</td></tr></table></div></body></html> 50