<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>ioctl VIDIOC_QUERYBUF</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API" /><link rel="up" href="apa.html" title="Appendix A. Function Reference" /><link rel="prev" href="re54.html" title="ioctl VIDIOC_QBUF, VIDIOC_DQBUF" /><link rel="next" href="re56.html" title="ioctl VIDIOC_QUERYCAP" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_QUERYBUF</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re54.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="re56.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="ioctl VIDIOC_QUERYBUF"><a id="vidioc-querybuf"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_QUERYBUF — Query the status of a buffer</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_buffer *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2730324"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="re64.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_QUERYBUF</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2730392"></a><h2>Description</h2><p>This ioctl is part of the <a class="link" href="ch03s02.html" title="Streaming I/O (Memory Mapping)">memory mapping</a> I/O method. It can be used to query the status of a buffer at any time after buffers have been allocated with the <a class="link" href="re59.html" title="ioctl VIDIOC_REQBUFS"><code class="constant">VIDIOC_REQBUFS</code></a> ioctl.</p><p>Applications set the <em class="structfield"><code>type</code></em> field of a struct <a class="link" href="ch03s05.html#v4l2-buffer" title="Table 3.1. struct v4l2_buffer">v4l2_buffer</a> to the same buffer type as previously struct <a class="link" href="re41.html#v4l2-format" title="Table A.46. struct v4l2_format">v4l2_format</a> <em class="structfield"><code>type</code></em> and struct <a class="link" href="re59.html#v4l2-requestbuffers" title="Table A.72. struct v4l2_requestbuffers">v4l2_requestbuffers</a> <em class="structfield"><code>type</code></em>, and the <em class="structfield"><code>index</code></em> field. Valid index numbers range from zero to the number of buffers allocated with <a class="link" href="re59.html" title="ioctl VIDIOC_REQBUFS"><code class="constant">VIDIOC_REQBUFS</code></a> (struct <a class="link" href="re59.html#v4l2-requestbuffers" title="Table A.72. struct v4l2_requestbuffers">v4l2_requestbuffers</a> <em class="structfield"><code>count</code></em>) minus one. After calling <code class="constant">VIDIOC_QUERYBUF</code> with a pointer to this structure drivers return an error code or fill the rest of the structure.</p><p>In the <em class="structfield"><code>flags</code></em> field the <code class="constant">V4L2_BUF_FLAG_MAPPED</code>, <code class="constant">V4L2_BUF_FLAG_QUEUED</code> and <code class="constant">V4L2_BUF_FLAG_DONE</code> flags will be valid. The <em class="structfield"><code>memory</code></em> field will be set to <code class="constant">V4L2_MEMORY_MMAP</code>, the <em class="structfield"><code>m.offset</code></em> contains the offset of the buffer from the start of the device memory, the <em class="structfield"><code>length</code></em> field its size. The driver may or may not set the remaining fields and flags, they are meaningless in this context.</p><p>The <span class="structname">v4l2_buffer</span> structure is specified in <a class="xref" href="ch03s05.html" title="Buffers">the section called “Buffers”</a>.</p></div><div class="refsect1" title="Return Value"><a id="id2730536"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately:</p><div class="variablelist"><dl><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The buffer <em class="structfield"><code>type</code></em> is not supported, or the <em class="structfield"><code>index</code></em> is out of bounds.</p></dd></dl></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re54.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="apa.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re56.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_QBUF, VIDIOC_DQBUF </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_QUERYCAP</td></tr></table></div></body></html>