diff options
Diffstat (limited to 'Documentation/DocBook/v4l/vidioc-g-crop.xml')
-rw-r--r-- | Documentation/DocBook/v4l/vidioc-g-crop.xml | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Documentation/DocBook/v4l/vidioc-g-crop.xml b/Documentation/DocBook/v4l/vidioc-g-crop.xml new file mode 100644 index 000000000000..d235b1dedbed --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-g-crop.xml | |||
@@ -0,0 +1,143 @@ | |||
1 | <refentry id="vidioc-g-crop"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>ioctl VIDIOC_G_CROP, VIDIOC_S_CROP</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | |||
7 | <refnamediv> | ||
8 | <refname>VIDIOC_G_CROP</refname> | ||
9 | <refname>VIDIOC_S_CROP</refname> | ||
10 | <refpurpose>Get or set the current cropping rectangle</refpurpose> | ||
11 | </refnamediv> | ||
12 | |||
13 | <refsynopsisdiv> | ||
14 | <funcsynopsis> | ||
15 | <funcprototype> | ||
16 | <funcdef>int <function>ioctl</function></funcdef> | ||
17 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
18 | <paramdef>int <parameter>request</parameter></paramdef> | ||
19 | <paramdef>struct v4l2_crop *<parameter>argp</parameter></paramdef> | ||
20 | </funcprototype> | ||
21 | </funcsynopsis> | ||
22 | <funcsynopsis> | ||
23 | <funcprototype> | ||
24 | <funcdef>int <function>ioctl</function></funcdef> | ||
25 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
26 | <paramdef>int <parameter>request</parameter></paramdef> | ||
27 | <paramdef>const struct v4l2_crop *<parameter>argp</parameter></paramdef> | ||
28 | </funcprototype> | ||
29 | </funcsynopsis> | ||
30 | </refsynopsisdiv> | ||
31 | |||
32 | <refsect1> | ||
33 | <title>Arguments</title> | ||
34 | |||
35 | <variablelist> | ||
36 | <varlistentry> | ||
37 | <term><parameter>fd</parameter></term> | ||
38 | <listitem> | ||
39 | <para>&fd;</para> | ||
40 | </listitem> | ||
41 | </varlistentry> | ||
42 | <varlistentry> | ||
43 | <term><parameter>request</parameter></term> | ||
44 | <listitem> | ||
45 | <para>VIDIOC_G_CROP, VIDIOC_S_CROP</para> | ||
46 | </listitem> | ||
47 | </varlistentry> | ||
48 | <varlistentry> | ||
49 | <term><parameter>argp</parameter></term> | ||
50 | <listitem> | ||
51 | <para></para> | ||
52 | </listitem> | ||
53 | </varlistentry> | ||
54 | </variablelist> | ||
55 | </refsect1> | ||
56 | |||
57 | <refsect1> | ||
58 | <title>Description</title> | ||
59 | |||
60 | <para>To query the cropping rectangle size and position | ||
61 | applications set the <structfield>type</structfield> field of a | ||
62 | <structname>v4l2_crop</structname> structure to the respective buffer | ||
63 | (stream) type and call the <constant>VIDIOC_G_CROP</constant> ioctl | ||
64 | with a pointer to this structure. The driver fills the rest of the | ||
65 | structure or returns the &EINVAL; if cropping is not supported.</para> | ||
66 | |||
67 | <para>To change the cropping rectangle applications initialize the | ||
68 | <structfield>type</structfield> and &v4l2-rect; substructure named | ||
69 | <structfield>c</structfield> of a v4l2_crop structure and call the | ||
70 | <constant>VIDIOC_S_CROP</constant> ioctl with a pointer to this | ||
71 | structure.</para> | ||
72 | |||
73 | <para>The driver first adjusts the requested dimensions against | ||
74 | hardware limits, &ie; the bounds given by the capture/output window, | ||
75 | and it rounds to the closest possible values of horizontal and | ||
76 | vertical offset, width and height. In particular the driver must round | ||
77 | the vertical offset of the cropping rectangle to frame lines modulo | ||
78 | two, such that the field order cannot be confused.</para> | ||
79 | |||
80 | <para>Second the driver adjusts the image size (the opposite | ||
81 | rectangle of the scaling process, source or target depending on the | ||
82 | data direction) to the closest size possible while maintaining the | ||
83 | current horizontal and vertical scaling factor.</para> | ||
84 | |||
85 | <para>Finally the driver programs the hardware with the actual | ||
86 | cropping and image parameters. <constant>VIDIOC_S_CROP</constant> is a | ||
87 | write-only ioctl, it does not return the actual parameters. To query | ||
88 | them applications must call <constant>VIDIOC_G_CROP</constant> and | ||
89 | &VIDIOC-G-FMT;. When the parameters are unsuitable the application may | ||
90 | modify the cropping or image parameters and repeat the cycle until | ||
91 | satisfactory parameters have been negotiated.</para> | ||
92 | |||
93 | <para>When cropping is not supported then no parameters are | ||
94 | changed and <constant>VIDIOC_S_CROP</constant> returns the | ||
95 | &EINVAL;.</para> | ||
96 | |||
97 | <table pgwide="1" frame="none" id="v4l2-crop"> | ||
98 | <title>struct <structname>v4l2_crop</structname></title> | ||
99 | <tgroup cols="3"> | ||
100 | &cs-str; | ||
101 | <tbody valign="top"> | ||
102 | <row> | ||
103 | <entry>&v4l2-buf-type;</entry> | ||
104 | <entry><structfield>type</structfield></entry> | ||
105 | <entry>Type of the data stream, set by the application. | ||
106 | Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>, | ||
107 | <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, | ||
108 | <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver | ||
109 | defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> | ||
110 | and higher.</entry> | ||
111 | </row> | ||
112 | <row> | ||
113 | <entry>&v4l2-rect;</entry> | ||
114 | <entry><structfield>c</structfield></entry> | ||
115 | <entry>Cropping rectangle. The same co-ordinate system as | ||
116 | for &v4l2-cropcap; <structfield>bounds</structfield> is used.</entry> | ||
117 | </row> | ||
118 | </tbody> | ||
119 | </tgroup> | ||
120 | </table> | ||
121 | </refsect1> | ||
122 | |||
123 | <refsect1> | ||
124 | &return-value; | ||
125 | |||
126 | <variablelist> | ||
127 | <varlistentry> | ||
128 | <term><errorcode>EINVAL</errorcode></term> | ||
129 | <listitem> | ||
130 | <para>Cropping is not supported.</para> | ||
131 | </listitem> | ||
132 | </varlistentry> | ||
133 | </variablelist> | ||
134 | </refsect1> | ||
135 | </refentry> | ||
136 | |||
137 | <!-- | ||
138 | Local Variables: | ||
139 | mode: sgml | ||
140 | sgml-parent-document: "v4l2.sgml" | ||
141 | indent-tabs-mode: nil | ||
142 | End: | ||
143 | --> | ||