• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<refentry id="vidioc-cropcap">
2  <refmeta>
3    <refentrytitle>ioctl VIDIOC_CROPCAP</refentrytitle>
4    &manvol;
5  </refmeta>
6
7  <refnamediv>
8    <refname>VIDIOC_CROPCAP</refname>
9    <refpurpose>Information about the video cropping and scaling abilities</refpurpose>
10  </refnamediv>
11
12  <refsynopsisdiv>
13    <funcsynopsis>
14      <funcprototype>
15	<funcdef>int <function>ioctl</function></funcdef>
16	<paramdef>int <parameter>fd</parameter></paramdef>
17	<paramdef>int <parameter>request</parameter></paramdef>
18	<paramdef>struct v4l2_cropcap
19*<parameter>argp</parameter></paramdef>
20      </funcprototype>
21    </funcsynopsis>
22  </refsynopsisdiv>
23
24  <refsect1>
25    <title>Arguments</title>
26
27    <variablelist>
28      <varlistentry>
29	<term><parameter>fd</parameter></term>
30	<listitem>
31	  <para>&fd;</para>
32	</listitem>
33      </varlistentry>
34      <varlistentry>
35	<term><parameter>request</parameter></term>
36	<listitem>
37	  <para>VIDIOC_CROPCAP</para>
38	</listitem>
39      </varlistentry>
40      <varlistentry>
41	<term><parameter>argp</parameter></term>
42	<listitem>
43	  <para></para>
44	</listitem>
45      </varlistentry>
46    </variablelist>
47  </refsect1>
48
49  <refsect1>
50    <title>Description</title>
51
52    <para>Applications use this function to query the cropping
53limits, the pixel aspect of images and to calculate scale factors.
54They set the <structfield>type</structfield> field of a v4l2_cropcap
55structure to the respective buffer (stream) type and call the
56<constant>VIDIOC_CROPCAP</constant> ioctl with a pointer to this
57structure. Drivers fill the rest of the structure. The results are
58constant except when switching the video standard. Remember this
59switch can occur implicit when switching the video input or
60output.</para>
61
62    <para>This ioctl must be implemented for video capture or output devices that
63support cropping and/or scaling and/or have non-square pixels, and for overlay devices.</para>
64
65    <table pgwide="1" frame="none" id="v4l2-cropcap">
66      <title>struct <structname>v4l2_cropcap</structname></title>
67      <tgroup cols="3">
68	&cs-str;
69	<tbody valign="top">
70	  <row>
71	    <entry>__u32</entry>
72	    <entry><structfield>type</structfield></entry>
73	    <entry>Type of the data stream, set by the application.
74Only these types are valid here:
75<constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
76<constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>,
77<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
78<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant> and
79<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>. See <xref linkend="v4l2-buf-type" />.</entry>
80	  </row>
81	  <row>
82	    <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry>
83	    <entry><structfield>bounds</structfield></entry>
84	    <entry>Defines the window within capturing or output is
85possible, this may exclude for example the horizontal and vertical
86blanking areas. The cropping rectangle cannot exceed these limits.
87Width and height are defined in pixels, the driver writer is free to
88choose origin and units of the coordinate system in the analog
89domain.</entry>
90	  </row>
91	  <row>
92	    <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry>
93	    <entry><structfield>defrect</structfield></entry>
94	    <entry>Default cropping rectangle, it shall cover the
95"whole picture". Assuming pixel aspect 1/1 this could be for example a
96640&nbsp;&times;&nbsp;480 rectangle for NTSC, a
97768&nbsp;&times;&nbsp;576 rectangle for PAL and SECAM centered over
98the active picture area. The same co-ordinate system as for
99	    <structfield>bounds</structfield> is used.</entry>
100	  </row>
101	  <row>
102	    <entry>&v4l2-fract;</entry>
103	    <entry><structfield>pixelaspect</structfield></entry>
104	    <entry><para>This is the pixel aspect (y / x) when no
105scaling is applied, the ratio of the actual sampling
106frequency and the frequency required to get square
107pixels.</para><para>When cropping coordinates refer to square pixels,
108the driver sets <structfield>pixelaspect</structfield> to 1/1. Other
109common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled
110according to [<xref linkend="itu601" />].</para></entry>
111	  </row>
112	</tbody>
113      </tgroup>
114    </table>
115
116    <!-- NB this table is duplicated in the overlay chapter. -->
117
118    <table pgwide="1" frame="none" id="v4l2-rect-crop">
119      <title>struct <structname>v4l2_rect</structname></title>
120      <tgroup cols="3">
121	&cs-str;
122	<tbody valign="top">
123	  <row>
124	    <entry>__s32</entry>
125	    <entry><structfield>left</structfield></entry>
126	    <entry>Horizontal offset of the top, left corner of the
127rectangle, in pixels.</entry>
128	  </row>
129	  <row>
130	    <entry>__s32</entry>
131	    <entry><structfield>top</structfield></entry>
132	    <entry>Vertical offset of the top, left corner of the
133rectangle, in pixels.</entry>
134	  </row>
135	  <row>
136	    <entry>__u32</entry>
137	    <entry><structfield>width</structfield></entry>
138	    <entry>Width of the rectangle, in pixels.</entry>
139	  </row>
140	  <row>
141	    <entry>__u32</entry>
142	    <entry><structfield>height</structfield></entry>
143	    <entry>Height of the rectangle, in pixels.</entry>
144	  </row>
145	</tbody>
146      </tgroup>
147    </table>
148  </refsect1>
149
150  <refsect1>
151    &return-value;
152
153    <variablelist>
154      <varlistentry>
155	<term><errorcode>EINVAL</errorcode></term>
156	<listitem>
157	  <para>The &v4l2-cropcap; <structfield>type</structfield> is
158invalid.</para>
159	</listitem>
160      </varlistentry>
161    </variablelist>
162  </refsect1>
163</refentry>
164