About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

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




Custom Search

Based on kernel version 4.1. Page generated on 2015-06-28 12:12 EST.

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>Do not use the multiplanar buffer types.  Use <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>
74	instead of <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>
75	and use <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> instead of
76	<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>.</para>
77	
78	    <para>The driver first adjusts the requested dimensions against
79	hardware limits, &ie; the bounds given by the capture/output window,
80	and it rounds to the closest possible values of horizontal and
81	vertical offset, width and height. In particular the driver must round
82	the vertical offset of the cropping rectangle to frame lines modulo
83	two, such that the field order cannot be confused.</para>
84	
85	    <para>Second the driver adjusts the image size (the opposite
86	rectangle of the scaling process, source or target depending on the
87	data direction) to the closest size possible while maintaining the
88	current horizontal and vertical scaling factor.</para>
89	
90	    <para>Finally the driver programs the hardware with the actual
91	cropping and image parameters. <constant>VIDIOC_S_CROP</constant> is a
92	write-only ioctl, it does not return the actual parameters. To query
93	them applications must call <constant>VIDIOC_G_CROP</constant> and
94	&VIDIOC-G-FMT;. When the parameters are unsuitable the application may
95	modify the cropping or image parameters and repeat the cycle until
96	satisfactory parameters have been negotiated.</para>
97	
98	    <para>When cropping is not supported then no parameters are
99	changed and <constant>VIDIOC_S_CROP</constant> returns the
100	&EINVAL;.</para>
101	
102	    <table pgwide="1" frame="none" id="v4l2-crop">
103	      <title>struct <structname>v4l2_crop</structname></title>
104	      <tgroup cols="3">
105		&cs-str;
106		<tbody valign="top">
107		  <row>
108		    <entry>__u32</entry>
109		    <entry><structfield>type</structfield></entry>
110		    <entry>Type of the data stream, set by the application.
111	Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
112	<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant> and
113	<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>. See <xref linkend="v4l2-buf-type" />.</entry>
114		  </row>
115		  <row>
116		    <entry>&v4l2-rect;</entry>
117		    <entry><structfield>c</structfield></entry>
118		    <entry>Cropping rectangle. The same co-ordinate system as
119	for &v4l2-cropcap; <structfield>bounds</structfield> is used.</entry>
120		  </row>
121		</tbody>
122	      </tgroup>
123	    </table>
124	  </refsect1>
125	
126	  <refsect1>
127	    &return-value;
128	  </refsect1>
129	</refentry>
Hide Line Numbers
About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Information is copyright its respective author. All material is available from the Linux Kernel Source distributed under a GPL License. This page is provided as a free service by mjmwired.net.