4559c452a613e23dfa25e301753207be99b4451f
[cascardo/linux.git] / Documentation / DocBook / media / v4l / vidioc-cropcap.xml
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
53 limits, the pixel aspect of images and to calculate scale factors.
54 They set the <structfield>type</structfield> field of a v4l2_cropcap
55 structure to the respective buffer (stream) type and call the
56 <constant>VIDIOC_CROPCAP</constant> ioctl with a pointer to this
57 structure. Drivers fill the rest of the structure. The results are
58 constant except when switching the video standard. Remember this
59 switch can occur implicit when switching the video input or
60 output.</para>
61
62     <table pgwide="1" frame="none" id="v4l2-cropcap">
63       <title>struct <structname>v4l2_cropcap</structname></title>
64       <tgroup cols="3">
65         &cs-str;
66         <tbody valign="top">
67           <row>
68             <entry>__u32</entry>
69             <entry><structfield>type</structfield></entry>
70             <entry>Type of the data stream, set by the application.
71 Only these types are valid here:
72 <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
73 <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> and
74 <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>. See <xref linkend="v4l2-buf-type" />.</entry>
75           </row>
76           <row>
77             <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry>
78             <entry><structfield>bounds</structfield></entry>
79             <entry>Defines the window within capturing or output is
80 possible, this may exclude for example the horizontal and vertical
81 blanking areas. The cropping rectangle cannot exceed these limits.
82 Width and height are defined in pixels, the driver writer is free to
83 choose origin and units of the coordinate system in the analog
84 domain.</entry>
85           </row>
86           <row>
87             <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry>
88             <entry><structfield>defrect</structfield></entry>
89             <entry>Default cropping rectangle, it shall cover the
90 "whole picture". Assuming pixel aspect 1/1 this could be for example a
91 640&nbsp;&times;&nbsp;480 rectangle for NTSC, a
92 768&nbsp;&times;&nbsp;576 rectangle for PAL and SECAM centered over
93 the active picture area. The same co-ordinate system as for
94             <structfield>bounds</structfield> is used.</entry>
95           </row>
96           <row>
97             <entry>&v4l2-fract;</entry>
98             <entry><structfield>pixelaspect</structfield></entry>
99             <entry><para>This is the pixel aspect (y / x) when no
100 scaling is applied, the ratio of the actual sampling
101 frequency and the frequency required to get square
102 pixels.</para><para>When cropping coordinates refer to square pixels,
103 the driver sets <structfield>pixelaspect</structfield> to 1/1. Other
104 common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled
105 according to [<xref linkend="itu601" />].</para></entry>
106           </row>
107         </tbody>
108       </tgroup>
109     </table>
110
111     <!-- NB this table is duplicated in the overlay chapter. -->
112
113     <table pgwide="1" frame="none" id="v4l2-rect-crop">
114       <title>struct <structname>v4l2_rect</structname></title>
115       <tgroup cols="3">
116         &cs-str;
117         <tbody valign="top">
118           <row>
119             <entry>__s32</entry>
120             <entry><structfield>left</structfield></entry>
121             <entry>Horizontal offset of the top, left corner of the
122 rectangle, in pixels.</entry>
123           </row>
124           <row>
125             <entry>__s32</entry>
126             <entry><structfield>top</structfield></entry>
127             <entry>Vertical offset of the top, left corner of the
128 rectangle, in pixels.</entry>
129           </row>
130           <row>
131             <entry>__s32</entry>
132             <entry><structfield>width</structfield></entry>
133             <entry>Width of the rectangle, in pixels.</entry>
134           </row>
135           <row>
136             <entry>__s32</entry>
137             <entry><structfield>height</structfield></entry>
138             <entry>Height of the rectangle, in pixels. Width
139 and height cannot be negative, the fields are signed for
140 hysterical reasons. <!-- video4linux-list@redhat.com
141 on 22 Oct 2002 subject "Re:[V4L][patches!] Re:v4l2/kernel-2.5" -->
142 </entry>
143           </row>
144         </tbody>
145       </tgroup>
146     </table>
147   </refsect1>
148
149   <refsect1>
150     &return-value;
151
152     <variablelist>
153       <varlistentry>
154         <term><errorcode>EINVAL</errorcode></term>
155         <listitem>
156           <para>The &v4l2-cropcap; <structfield>type</structfield> is
157 invalid. This is not permitted for video capture, output and overlay devices,
158 which must support <constant>VIDIOC_CROPCAP</constant>.</para>
159         </listitem>
160       </varlistentry>
161     </variablelist>
162   </refsect1>
163 </refentry>