1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_CROPCAP</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-create-bufs.html" title="ioctl VIDIOC_CREATE_BUFS"><link rel="next" href="vidioc-dbg-g-chip-info.html" title="ioctl VIDIOC_DBG_G_CHIP_INFO"></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_CROPCAP</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-create-bufs.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-dbg-g-chip-info.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-cropcap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_CROPCAP — Information about the video cropping and scaling abilities</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_cropcap 2*<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1111855300"></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_CROPCAP</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="idp1111993236"></a><h2>Description</h2><p>Applications use this function to query the cropping 3limits, the pixel aspect of images and to calculate scale factors. 4They set the <em class="structfield"><code>type</code></em> field of a v4l2_cropcap 5structure to the respective buffer (stream) type and call the 6<code class="constant">VIDIOC_CROPCAP</code> ioctl with a pointer to this 7structure. Drivers fill the rest of the structure. The results are 8constant except when switching the video standard. Remember this 9switch can occur implicit when switching the video input or 10output.</p><p>Do not use the multiplanar buffer types. Use <code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE</code> 11instead of <code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</code> 12and use <code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT</code> instead of 13<code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</code>.</p><p>This ioctl must be implemented for video capture or output devices that 14support cropping and/or scaling and/or have non-square pixels, and for overlay devices.</p><div class="table"><a name="v4l2-cropcap"></a><p class="title"><b>Table A.2. struct <span class="structname">v4l2_cropcap</span></b></p><div class="table-contents"><table summary="struct v4l2_cropcap" 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>type</code></em></td><td valign="top">Type of the data stream, set by the application. 15Only these types are valid here: 16<code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE</code>, 17<code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT</code> and 18<code class="constant">V4L2_BUF_TYPE_VIDEO_OVERLAY</code>. 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">struct <a class="link" href="vidioc-cropcap.html#v4l2-rect-crop" title="Table A.3. struct v4l2_rect">v4l2_rect</a></td><td valign="top"><em class="structfield"><code>bounds</code></em></td><td valign="top">Defines the window within capturing or output is 19possible, this may exclude for example the horizontal and vertical 20blanking areas. The cropping rectangle cannot exceed these limits. 21Width and height are defined in pixels, the driver writer is free to 22choose origin and units of the coordinate system in the analog 23domain.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-cropcap.html#v4l2-rect-crop" title="Table A.3. struct v4l2_rect">v4l2_rect</a></td><td valign="top"><em class="structfield"><code>defrect</code></em></td><td valign="top">Default cropping rectangle, it shall cover the 24"whole picture". Assuming pixel aspect 1/1 this could be for example a 25640 × 480 rectangle for NTSC, a 26768 × 576 rectangle for PAL and SECAM centered over 27the active picture area. The same co-ordinate system as for 28 <em class="structfield"><code>bounds</code></em> is used.</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>pixelaspect</code></em></td><td valign="top"><p>This is the pixel aspect (y / x) when no 29scaling is applied, the ratio of the actual sampling 30frequency and the frequency required to get square 31pixels.</p><p>When cropping coordinates refer to square pixels, 32the driver sets <em class="structfield"><code>pixelaspect</code></em> to 1/1. Other 33common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled 34according to [<a class="xref" href="bi01.html#itu601" title='ITU-R Recommendation BT.601-5 "Studio Encoding Parameters of Digital Television for Standard 4:3 and Wide-Screen 16:9 Aspect Ratios"'>[<abbr class="abbrev">ITU BT.601</abbr>]</a>].</p></td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-rect-crop"></a><p class="title"><b>Table A.3. struct <span class="structname">v4l2_rect</span></b></p><div class="table-contents"><table summary="struct v4l2_rect" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>left</code></em></td><td valign="top">Horizontal offset of the top, left corner of the 35rectangle, in pixels.</td></tr><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>top</code></em></td><td valign="top">Vertical offset of the top, left corner of the 36rectangle, in pixels.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>width</code></em></td><td valign="top">Width of the rectangle, in pixels.</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 rectangle, in pixels.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1112014180"></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 class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The struct <a class="link" href="vidioc-cropcap.html#v4l2-cropcap" title="Table A.2. struct v4l2_cropcap">v4l2_cropcap</a> <em class="structfield"><code>type</code></em> is 37invalid.</p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-create-bufs.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-dbg-g-chip-info.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_CREATE_BUFS </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_DBG_G_CHIP_INFO</td></tr></table></div></body></html> 38