About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

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




Custom Search

Based on kernel version 3.16. Page generated on 2014-08-06 21:39 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>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>__u32</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> and
108	<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>. See <xref linkend="v4l2-buf-type" />.</entry>
109		  </row>
110		  <row>
111		    <entry>&v4l2-rect;</entry>
112		    <entry><structfield>c</structfield></entry>
113		    <entry>Cropping rectangle. The same co-ordinate system as
114	for &v4l2-cropcap; <structfield>bounds</structfield> is used.</entry>
115		  </row>
116		</tbody>
117	      </tgroup>
118	    </table>
119	  </refsect1>
120	
121	  <refsect1>
122	    &return-value;
123	  </refsect1>
124	</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.