<?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_STREAMON, VIDIOC_STREAMOFF</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="re60.html" title="ioctl VIDIOC_S_HW_FREQ_SEEK" /><link rel="next" href="re62.html" title="V4L2 mmap()" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re60.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="re62.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF"><a id="vidioc-streamon"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_STREAMON, VIDIOC_STREAMOFF — Start or stop streaming I/O</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>const int *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2737255"></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_STREAMON, VIDIOC_STREAMOFF</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="id2738282"></a><h2>Description</h2><p>The <code class="constant">VIDIOC_STREAMON</code> and <code class="constant">VIDIOC_STREAMOFF</code> ioctl start and stop the capture or output process during streaming (<a class="link" href="ch03s02.html" title="Streaming I/O (Memory Mapping)">memory mapping</a> or <a class="link" href="ch03s03.html" title="Streaming I/O (User Pointers)">user pointer</a>) I/O.</p><p>Specifically the capture hardware is disabled and no input buffers are filled (if there are any empty buffers in the incoming queue) until <code class="constant">VIDIOC_STREAMON</code> has been called. Accordingly the output hardware is disabled, no video signal is produced until <code class="constant">VIDIOC_STREAMON</code> has been called. The ioctl will succeed only when at least one output buffer is in the incoming queue.</p><p>The <code class="constant">VIDIOC_STREAMOFF</code> ioctl, apart of aborting or finishing any DMA in progress, unlocks any user pointer buffers locked in physical memory, and it removes all buffers from the incoming and outgoing queues. That means all images captured but not dequeued yet will be lost, likewise all images enqueued for output but not transmitted yet. I/O returns to the same state as after calling <a class="link" href="re59.html" title="ioctl VIDIOC_REQBUFS"><code class="constant">VIDIOC_REQBUFS</code></a> and can be restarted accordingly.</p><p>Both ioctls take a pointer to an integer, the desired buffer or stream type. This is the same as 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>.</p><p>Note applications can be preempted for unknown periods right before or after the <code class="constant">VIDIOC_STREAMON</code> or <code class="constant">VIDIOC_STREAMOFF</code> calls, there is no notion of starting or stopping "now". Buffer timestamps can be used to synchronize with other events.</p></div><div class="refsect1" title="Return Value"><a id="id2738382"></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>Streaming I/O is not supported, the buffer <em class="structfield"><code>type</code></em> is not supported, or no buffers have been allocated (memory mapping) or enqueued (output) yet.</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="re60.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="re62.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_S_HW_FREQ_SEEK </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> V4L2 mmap()</td></tr></table></div></body></html>