| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 1 | <refentry id="vidioc-querybuf"> | 
 | 2 |   <refmeta> | 
 | 3 |     <refentrytitle>ioctl VIDIOC_QUERYBUF</refentrytitle> | 
 | 4 |     &manvol; | 
 | 5 |   </refmeta> | 
 | 6 |  | 
 | 7 |   <refnamediv> | 
 | 8 |     <refname>VIDIOC_QUERYBUF</refname> | 
 | 9 |     <refpurpose>Query the status of a buffer</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_buffer *<parameter>argp</parameter></paramdef> | 
 | 19 |       </funcprototype> | 
 | 20 |     </funcsynopsis> | 
 | 21 |   </refsynopsisdiv> | 
 | 22 |  | 
 | 23 |   <refsect1> | 
 | 24 |     <title>Arguments</title> | 
 | 25 |  | 
 | 26 |     <variablelist> | 
 | 27 |       <varlistentry> | 
 | 28 | 	<term><parameter>fd</parameter></term> | 
 | 29 | 	<listitem> | 
 | 30 | 	  <para>&fd;</para> | 
 | 31 | 	</listitem> | 
 | 32 |       </varlistentry> | 
 | 33 |       <varlistentry> | 
 | 34 | 	<term><parameter>request</parameter></term> | 
 | 35 | 	<listitem> | 
 | 36 | 	  <para>VIDIOC_QUERYBUF</para> | 
 | 37 | 	</listitem> | 
 | 38 |       </varlistentry> | 
 | 39 |       <varlistentry> | 
 | 40 | 	<term><parameter>argp</parameter></term> | 
 | 41 | 	<listitem> | 
 | 42 | 	  <para></para> | 
 | 43 | 	</listitem> | 
 | 44 |       </varlistentry> | 
 | 45 |     </variablelist> | 
 | 46 |   </refsect1> | 
 | 47 |  | 
 | 48 |   <refsect1> | 
 | 49 |     <title>Description</title> | 
 | 50 |  | 
 | 51 |     <para>This ioctl is part of the <link linkend="mmap">memory | 
 | 52 | mapping</link> I/O method. It can be used to query the status of a | 
 | 53 | buffer at any time after buffers have been allocated with the | 
 | 54 | &VIDIOC-REQBUFS; ioctl.</para> | 
 | 55 |  | 
 | 56 |     <para>Applications set the <structfield>type</structfield> field | 
| Hans Verkuil | 995f5fe | 2010-02-20 09:41:03 -0300 | [diff] [blame] | 57 |     of a &v4l2-buffer; to the same buffer type as was previously used with | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 58 | &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers; | 
 | 59 | <structfield>type</structfield>, and the <structfield>index</structfield> | 
 | 60 |     field. Valid index numbers range from zero | 
 | 61 | to the number of buffers allocated with &VIDIOC-REQBUFS; | 
 | 62 |     (&v4l2-requestbuffers; <structfield>count</structfield>) minus one. | 
| Hans Verkuil | 995f5fe | 2010-02-20 09:41:03 -0300 | [diff] [blame] | 63 | The <structfield>reserved</structfield> field should to set to 0. | 
| Pawel Osciak | 53b5d57 | 2011-01-07 01:41:33 -0300 | [diff] [blame] | 64 | When using the <link linkend="planar-apis">multi-planar API</link>, the | 
 | 65 | <structfield>m.planes</structfield> field must contain a userspace pointer to an | 
 | 66 | array of &v4l2-plane; and the <structfield>length</structfield> field has | 
 | 67 | to be set to the number of elements in that array. | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 68 | After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to | 
 | 69 |     this structure drivers return an error code or fill the rest of | 
 | 70 | the structure.</para> | 
 | 71 |  | 
 | 72 |     <para>In the <structfield>flags</structfield> field the | 
 | 73 | <constant>V4L2_BUF_FLAG_MAPPED</constant>, | 
 | 74 | <constant>V4L2_BUF_FLAG_QUEUED</constant> and | 
 | 75 | <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The | 
| Hans Verkuil | 995f5fe | 2010-02-20 09:41:03 -0300 | [diff] [blame] | 76 | <structfield>memory</structfield> field will be set to the current | 
| Pawel Osciak | 53b5d57 | 2011-01-07 01:41:33 -0300 | [diff] [blame] | 77 | I/O method. For the single-planar API, the <structfield>m.offset</structfield> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 78 | contains the offset of the buffer from the start of the device memory, | 
| Pawel Osciak | 53b5d57 | 2011-01-07 01:41:33 -0300 | [diff] [blame] | 79 | the <structfield>length</structfield> field its size. For the multi-planar API, | 
 | 80 | fields <structfield>m.mem_offset</structfield> and | 
 | 81 | <structfield>length</structfield> in the <structfield>m.planes</structfield> | 
 | 82 | array elements will be used instead. The driver may or may not set the remaining | 
 | 83 | fields and flags, they are meaningless in this context.</para> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 84 |  | 
 | 85 |     <para>The <structname>v4l2_buffer</structname> structure is | 
 | 86 |     specified in <xref linkend="buffer" />.</para> | 
 | 87 |   </refsect1> | 
 | 88 |  | 
 | 89 |   <refsect1> | 
 | 90 |     &return-value; | 
 | 91 |  | 
 | 92 |     <variablelist> | 
 | 93 |       <varlistentry> | 
 | 94 | 	<term><errorcode>EINVAL</errorcode></term> | 
 | 95 | 	<listitem> | 
 | 96 | 	  <para>The buffer <structfield>type</structfield> is not | 
 | 97 | supported, or the <structfield>index</structfield> is out of bounds.</para> | 
 | 98 | 	</listitem> | 
 | 99 |       </varlistentry> | 
 | 100 |     </variablelist> | 
 | 101 |   </refsect1> | 
 | 102 | </refentry> | 
 | 103 |  | 
 | 104 | <!-- | 
 | 105 | Local Variables: | 
 | 106 | mode: sgml | 
 | 107 | sgml-parent-document: "v4l2.sgml" | 
 | 108 | indent-tabs-mode: nil | 
 | 109 | End: | 
 | 110 | --> |