<?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_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><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 id="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 <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>struct v4l2_cropcap *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a id="idm140470012440128"></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 id="idm140470012432000"></a><h2>Description</h2><p>Applications use this function to query the cropping limits, the pixel aspect of images and to calculate scale factors. They set the <em class="structfield"><code>type</code></em> field of a v4l2_cropcap structure to the respective buffer (stream) type and call the <code class="constant">VIDIOC_CROPCAP</code> ioctl with a pointer to this structure. Drivers fill the rest of the structure. The results are constant except when switching the video standard. Remember this switch can occur implicit when switching the video input or output.</p><p>This ioctl must be implemented for video capture or output devices that support cropping and/or scaling and/or have non-square pixels, and for overlay devices.</p><div class="table"><a id="v4l2-cropcap"></a><p class="title"><strong>Table A.2. struct <span class="structname">v4l2_cropcap</span></strong></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. Only these types are valid here: <code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE</code>, <code class="constant">V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</code>, <code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT</code>, <code class="constant">V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</code> and <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 possible, this may exclude for example the horizontal and vertical blanking areas. The cropping rectangle cannot exceed these limits. Width and height are defined in pixels, the driver writer is free to choose origin and units of the coordinate system in the analog domain.</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 "whole picture". Assuming pixel aspect 1/1 this could be for example a 640 × 480 rectangle for NTSC, a 768 × 576 rectangle for PAL and SECAM centered over the active picture area. The same co-ordinate system as for <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.43. 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 scaling is applied, the ratio of the actual sampling frequency and the frequency required to get square pixels.</p><p>When cropping coordinates refer to square pixels, the driver sets <em class="structfield"><code>pixelaspect</code></em> to 1/1. Other common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled according 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 id="v4l2-rect-crop"></a><p class="title"><strong>Table A.3. struct <span class="structname">v4l2_rect</span></strong></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 rectangle, 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 rectangle, in pixels.</td></tr><tr><td valign="top">__s32</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">__s32</td><td valign="top"><em class="structfield"><code>height</code></em></td><td valign="top">Height of the rectangle, in pixels. Width and height cannot be negative, the fields are signed for hysterical reasons. </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="refsect1"><a id="idm140470012393312"></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 invalid.</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>