About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / DocBook / media / v4l / vidioc-subdev-g-crop.xml


Based on kernel version 4.7.2. Page generated on 2016-08-22 22:45 EST.

1	<refentry id="vidioc-subdev-g-crop">
2	  <refmeta>
3	    <refentrytitle>ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP</refentrytitle>
4	    &manvol;
5	  </refmeta>
6	
7	  <refnamediv>
8	    <refname>VIDIOC_SUBDEV_G_CROP</refname>
9	    <refname>VIDIOC_SUBDEV_S_CROP</refname>
10	    <refpurpose>Get or set the crop rectangle on a subdev pad</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_subdev_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_subdev_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_SUBDEV_G_CROP, VIDIOC_SUBDEV_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	    <note>
61	      <title>Obsolete</title>
62	
63	      <para>This is an <link linkend="obsolete">obsolete</link>
64	      interface and may be removed in the future. It is superseded by
65	      <link linkend="vidioc-subdev-g-selection">the selection
66	      API</link>.</para>
67	    </note>
68	
69	    <para>To retrieve the current crop rectangle applications set the
70	    <structfield>pad</structfield> field of a &v4l2-subdev-crop; to the
71	    desired pad number as reported by the media API and the
72	    <structfield>which</structfield> field to
73	    <constant>V4L2_SUBDEV_FORMAT_ACTIVE</constant>. They then call the
74	    <constant>VIDIOC_SUBDEV_G_CROP</constant> ioctl with a pointer to this
75	    structure. The driver fills the members of the <structfield>rect</structfield>
76	    field or returns &EINVAL; if the input arguments are invalid, or if cropping
77	    is not supported on the given pad.</para>
78	
79	    <para>To change the current crop rectangle applications set both the
80	    <structfield>pad</structfield> and <structfield>which</structfield> fields
81	    and all members of the <structfield>rect</structfield> field. They then call
82	    the <constant>VIDIOC_SUBDEV_S_CROP</constant> ioctl with a pointer to this
83	    structure. The driver verifies the requested crop rectangle, adjusts it
84	    based on the hardware capabilities and configures the device. Upon return
85	    the &v4l2-subdev-crop; contains the current format as would be returned
86	    by a <constant>VIDIOC_SUBDEV_G_CROP</constant> call.</para>
87	
88	    <para>Applications can query the device capabilities by setting the
89	    <structfield>which</structfield> to
90	    <constant>V4L2_SUBDEV_FORMAT_TRY</constant>. When set, 'try' crop
91	    rectangles are not applied to the device by the driver, but are mangled
92	    exactly as active crop rectangles and stored in the sub-device file handle.
93	    Two applications querying the same sub-device would thus not interact with
94	    each other.</para>
95	
96	    <para>Drivers must not return an error solely because the requested crop
97	    rectangle doesn't match the device capabilities. They must instead modify
98	    the rectangle to match what the hardware can provide. The modified format
99	    should be as close as possible to the original request.</para>
100	
101	    <table pgwide="1" frame="none" id="v4l2-subdev-crop">
102	      <title>struct <structname>v4l2_subdev_crop</structname></title>
103	      <tgroup cols="3">
104	        &cs-str;
105		<tbody valign="top">
106		  <row>
107		    <entry>__u32</entry>
108		    <entry><structfield>pad</structfield></entry>
109		    <entry>Pad number as reported by the media framework.</entry>
110		  </row>
111		  <row>
112		    <entry>__u32</entry>
113		    <entry><structfield>which</structfield></entry>
114		    <entry>Crop rectangle to get or set, from
115		    &v4l2-subdev-format-whence;.</entry>
116		  </row>
117		  <row>
118		    <entry>&v4l2-rect;</entry>
119		    <entry><structfield>rect</structfield></entry>
120		    <entry>Crop rectangle boundaries, in pixels.</entry>
121		  </row>
122		  <row>
123		    <entry>__u32</entry>
124		    <entry><structfield>reserved</structfield>[8]</entry>
125		    <entry>Reserved for future extensions. Applications and drivers must
126		    set the array to zero.</entry>
127		  </row>
128		</tbody>
129	      </tgroup>
130	    </table>
131	  </refsect1>
132	
133	  <refsect1>
134	    &return-value;
135	
136	    <variablelist>
137	      <varlistentry>
138		<term><errorcode>EBUSY</errorcode></term>
139		<listitem>
140		  <para>The crop rectangle can't be changed because the pad is currently
141		  busy. This can be caused, for instance, by an active video stream on
142		  the pad. The ioctl must not be retried without performing another
143		  action to fix the problem first. Only returned by
144		  <constant>VIDIOC_SUBDEV_S_CROP</constant></para>
145		</listitem>
146	      </varlistentry>
147	      <varlistentry>
148		<term><errorcode>EINVAL</errorcode></term>
149		<listitem>
150		  <para>The &v4l2-subdev-crop; <structfield>pad</structfield>
151		  references a non-existing pad, the <structfield>which</structfield>
152		  field references a non-existing format, or cropping is not supported
153		  on the given subdev pad.</para>
154		</listitem>
155	      </varlistentry>
156	    </variablelist>
157	  </refsect1>
158	</refentry>
Hide Line Numbers


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog