1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_ENUM_FRAMESIZES</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-fmt.html" title="ioctl VIDIOC_ENUM_FMT"><link rel="next" href="vidioc-enum-frameintervals.html" title="ioctl VIDIOC_ENUM_FRAMEINTERVALS"></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_FRAMESIZES</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-enum-fmt.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-frameintervals.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-enum-framesizes"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_ENUM_FRAMESIZES — Enumerate frame sizes</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_frmsizeenum *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1112826804"></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_FRAMESIZES</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-framesizes.html#v4l2-frmsizeenum" title="Table A.32. struct v4l2_frmsizeenum">v4l2_frmsizeenum</a> that contains an index 2and pixel format and receives a frame width and height.</p></dd></dl></div></div><div class="refsect1"><a name="idp1112904268"></a><h2>Description</h2><p>This ioctl allows applications to enumerate all frame sizes 3(i. e. width and height in pixels) that the device supports for the 4given pixel format.</p><p>The supported pixel formats can be obtained by using the 5<a class="link" href="vidioc-enum-fmt.html" title="ioctl VIDIOC_ENUM_FMT"><code class="constant">VIDIOC_ENUM_FMT</code></a> function.</p><p>The return value and the content of the 6<em class="structfield"><code>v4l2_frmsizeenum.type</code></em> field depend on the 7type of frame sizes the device supports. Here are the semantics of the 8function 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 9returns success if the given index value (zero-based) is valid. The 10application should increase the index by one for each call until 11<code class="constant">EINVAL</code> is returned. The 12<em class="structfield"><code>v4l2_frmsizeenum.type</code></em> field is set to 13<code class="constant">V4L2_FRMSIZE_TYPE_DISCRETE</code> by the driver. Of the 14union only the <em class="structfield"><code>discrete</code></em> member is 15valid.</p></li><li class="listitem"><p><span class="bold"><strong>Step-wise:</strong></span> The function 16returns success if the given index value is zero and 17<code class="constant">EINVAL</code> for any other index value. The 18<em class="structfield"><code>v4l2_frmsizeenum.type</code></em> field is set to 19<code class="constant">V4L2_FRMSIZE_TYPE_STEPWISE</code> by the driver. Of the 20union only the <em class="structfield"><code>stepwise</code></em> member is 21valid.</p></li><li class="listitem"><p><span class="bold"><strong>Continuous:</strong></span> This is a 22special case of the step-wise type above. The function returns success 23if the given index value is zero and <code class="constant">EINVAL</code> for 24any other index value. The 25<em class="structfield"><code>v4l2_frmsizeenum.type</code></em> field is set to 26<code class="constant">V4L2_FRMSIZE_TYPE_CONTINUOUS</code> by the driver. Of 27the union only the <em class="structfield"><code>stepwise</code></em> member is valid 28and the <em class="structfield"><code>step_width</code></em> and 29<em class="structfield"><code>step_height</code></em> values are set to 1.</p></li></ul></div><p>When the application calls the function with index zero, it 30must check the <em class="structfield"><code>type</code></em> field to determine the 31type of frame size enumeration the device supports. Only for the 32<code class="constant">V4L2_FRMSIZE_TYPE_DISCRETE</code> type does it make 33sense to increase the index value to receive more frame sizes.</p><p>Note that the order in which the frame sizes are returned 34has no special meaning. In particular does it not say anything about 35potential default format sizes.</p><p>Applications can assume that the enumeration data does not 36change without any interaction from the application itself. This means 37that the enumeration data is consistent if the application does not 38perform any other ioctl calls while it runs the frame size 39enumeration.</p></div><div class="refsect1"><a name="idp1112914788"></a><h2>Structs</h2><p>In the structs below, <span class="emphasis"><em>IN</em></span> denotes a 40value that has to be filled in by the application, 41<span class="emphasis"><em>OUT</em></span> denotes values that the driver fills in. The 42application should zero out all members except for the 43<span class="emphasis"><em>IN</em></span> fields.</p><div class="table"><a name="v4l2-frmsize-discrete"></a><p class="title"><b>Table A.30. struct <span class="structname">v4l2_frmsize_discrete</span></b></p><div class="table-contents"><table summary="struct v4l2_frmsize_discrete" 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>width</code></em></td><td valign="top">Width of the frame [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>height</code></em></td><td valign="top">Height of the frame [pixel].</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-frmsize-stepwise"></a><p class="title"><b>Table A.31. struct <span class="structname">v4l2_frmsize_stepwise</span></b></p><div class="table-contents"><table summary="struct v4l2_frmsize_stepwise" 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>min_width</code></em></td><td valign="top">Minimum frame width [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>max_width</code></em></td><td valign="top">Maximum frame width [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>step_width</code></em></td><td valign="top">Frame width step size [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>min_height</code></em></td><td valign="top">Minimum frame height [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>max_height</code></em></td><td valign="top">Maximum frame height [pixel].</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>step_height</code></em></td><td valign="top">Frame height step size [pixel].</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-frmsizeenum"></a><p class="title"><b>Table A.32. struct <span class="structname">v4l2_frmsizeenum</span></b></p><div class="table-contents"><table summary="struct v4l2_frmsizeenum" 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 size 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 sizes 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 size 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 size with the given index.</td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="vidioc-enum-framesizes.html#v4l2-frmsize-discrete" title="Table A.30. struct v4l2_frmsize_discrete">v4l2_frmsize_discrete</a></td><td valign="top"><em class="structfield"><code>discrete</code></em></td><td valign="top"> </td></tr><tr><td valign="top"> </td><td valign="top">struct <a class="link" href="vidioc-enum-framesizes.html#v4l2-frmsize-stepwise" title="Table A.31. struct v4l2_frmsize_stepwise">v4l2_frmsize_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="idp1112941284"></a><h2>Enums</h2><div class="table"><a name="v4l2-frmsizetypes"></a><p class="title"><b>Table A.33. enum <span class="structname">v4l2_frmsizetypes</span></b></p><div class="table-contents"><table summary="enum v4l2_frmsizetypes" 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_FRMSIZE_TYPE_DISCRETE</code></td><td valign="top">1</td><td valign="top">Discrete frame size.</td></tr><tr><td valign="top"><code class="constant">V4L2_FRMSIZE_TYPE_CONTINUOUS</code></td><td valign="top">2</td><td valign="top">Continuous frame size.</td></tr><tr><td valign="top"><code class="constant">V4L2_FRMSIZE_TYPE_STEPWISE</code></td><td valign="top">3</td><td valign="top">Step-wise defined frame size.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1112947396"></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-fmt.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-frameintervals.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_ENUM_FMT </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_FRAMEINTERVALS</td></tr></table></div></body></html> 44