<?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.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="re21.html" title="V4L2 ioctl()" /><link rel="next" href="re23.html" title="ioctl VIDIOC_DBG_G_CHIP_IDENT" /></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="re21.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="re23.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="ioctl VIDIOC_CROPCAP"><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" 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_cropcap *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2683828"></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_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" title="Description"><a id="id2685341"></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><div class="table"><a id="v4l2-cropcap"></a><p class="title"><b>Table A.1. struct <span class="structname">v4l2_cropcap</span></b></p><div class="table-contents"><table summary="struct v4l2_cropcap" width="100%" border="0"><colgroup><col /><col /><col /></colgroup><tbody valign="top"><tr><td valign="top">enum <a class="link" href="ch03s05.html#v4l2-buf-type" title="Table 3.2. enum v4l2_buf_type">v4l2_buf_type</a></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_OUTPUT</code>, <code class="constant">V4L2_BUF_TYPE_VIDEO_OVERLAY</code>, and custom (driver defined) types with code <code class="constant">V4L2_BUF_TYPE_PRIVATE</code> and higher.</td></tr><tr><td valign="top">struct <a class="link" href="re22.html#v4l2-rect-crop" title="Table A.2. 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="re22.html#v4l2-rect-crop" title="Table A.2. 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="re33.html#v4l2-fract" title="Table A.28. 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"><b>Table A.2. struct <span class="structname">v4l2_rect</span></b></p><div class="table-contents"><table summary="struct v4l2_rect" width="100%" border="0"><colgroup><col /><col /><col /></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" title="Return Value"><a id="id2685674"></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><div class="variablelist"><dl><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The struct <a class="link" href="re22.html#v4l2-cropcap" title="Table A.1. struct v4l2_cropcap">v4l2_cropcap</a> <em class="structfield"><code>type</code></em> is invalid or the ioctl is not supported. This is not permitted for video capture, output and overlay devices, which must support <code class="constant">VIDIOC_CROPCAP</code>.</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="re21.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="re23.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">V4L2 ioctl() </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_IDENT</td></tr></table></div></body></html>