1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="ioctl VIDIOC_REQBUFS"
17HREF="r13696.htm"><LINK
18REL="NEXT"
19TITLE="V4L2 mmap()"
20HREF="r13889.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="r13696.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="r13889.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="VIDIOC-STREAMON"
74></A
75>ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN13821"
80></A
81><H2
82>Name</H2
83>VIDIOC_STREAMON, VIDIOC_STREAMOFF&nbsp;--&nbsp;Start or stop streaming I/O</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN13825"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><P
94></P
95><A
96NAME="AEN13826"
97></A
98><P
99><CODE
100><CODE
101CLASS="FUNCDEF"
102>int ioctl</CODE
103>(int fd, int request, const int *argp);</CODE
104></P
105><P
106></P
107></DIV
108></DIV
109><DIV
110CLASS="REFSECT1"
111><A
112NAME="AEN13836"
113></A
114><H2
115>Arguments</H2
116><P
117></P
118><DIV
119CLASS="VARIABLELIST"
120><DL
121><DT
122><CODE
123CLASS="PARAMETER"
124>fd</CODE
125></DT
126><DD
127><P
128>File descriptor returned by <A
129HREF="r14090.htm"
130><CODE
131CLASS="FUNCTION"
132>open()</CODE
133></A
134>.</P
135></DD
136><DT
137><CODE
138CLASS="PARAMETER"
139>request</CODE
140></DT
141><DD
142><P
143>VIDIOC_STREAMON, VIDIOC_STREAMOFF</P
144></DD
145><DT
146><CODE
147CLASS="PARAMETER"
148>argp</CODE
149></DT
150><DD
151><P
152></P
153></DD
154></DL
155></DIV
156></DIV
157><DIV
158CLASS="REFSECT1"
159><A
160NAME="AEN13856"
161></A
162><H2
163>Description</H2
164><P
165>The <CODE
166CLASS="CONSTANT"
167>VIDIOC_STREAMON</CODE
168> and
169<CODE
170CLASS="CONSTANT"
171>VIDIOC_STREAMOFF</CODE
172> ioctl start and stop the capture
173or output process during streaming (<A
174HREF="x5791.htm"
175>memory
176mapping</A
177> or <A
178HREF="x5884.htm"
179>user pointer</A
180>) I/O.</P
181><P
182>Specifically the capture hardware is disabled and no input
183buffers are filled (if there are any empty buffers in the incoming
184queue) until <CODE
185CLASS="CONSTANT"
186>VIDIOC_STREAMON</CODE
187> has been called.
188Accordingly the output hardware is disabled, no video signal is
189produced until <CODE
190CLASS="CONSTANT"
191>VIDIOC_STREAMON</CODE
192> has been called.
193The ioctl will succeed only when at least one output buffer is in the
194incoming queue.</P
195><P
196>The <CODE
197CLASS="CONSTANT"
198>VIDIOC_STREAMOFF</CODE
199> ioctl, apart of
200aborting or finishing any DMA in progress, unlocks any user pointer
201buffers locked in physical memory, and it removes all buffers from the
202incoming and outgoing queues. That means all images captured but not
203dequeued yet will be lost, likewise all images enqueued for output but
204not transmitted yet. I/O returns to the same state as after calling
205<A
206HREF="r13696.htm"
207><CODE
208CLASS="CONSTANT"
209>VIDIOC_REQBUFS</CODE
210></A
211> and can be restarted accordingly.</P
212><P
213>Both ioctls take a pointer to an integer, the desired buffer or
214stream type. This is the same as struct&nbsp;<A
215HREF="r13696.htm#V4L2-REQUESTBUFFERS"
216>v4l2_requestbuffers</A
217>
218<CODE
219CLASS="STRUCTFIELD"
220>type</CODE
221>.</P
222><P
223>Note applications can be preempted for unknown periods right
224before or after the <CODE
225CLASS="CONSTANT"
226>VIDIOC_STREAMON</CODE
227> or
228<CODE
229CLASS="CONSTANT"
230>VIDIOC_STREAMOFF</CODE
231> calls, there is no notion of
232starting or stopping "now". Buffer timestamps can be used to
233synchronize with other events.</P
234></DIV
235><DIV
236CLASS="REFSECT1"
237><A
238NAME="AEN13876"
239></A
240><H2
241>Return Value</H2
242><P
243>On success <SPAN
244CLASS="RETURNVALUE"
245>0</SPAN
246> is returned, on error <SPAN
247CLASS="RETURNVALUE"
248>-1</SPAN
249> and the <CODE
250CLASS="VARNAME"
251>errno</CODE
252> variable is set appropriately:</P
253><P
254></P
255><DIV
256CLASS="VARIABLELIST"
257><DL
258><DT
259><SPAN
260CLASS="ERRORCODE"
261>EINVAL</SPAN
262></DT
263><DD
264><P
265>Streaming I/O is not supported, the buffer
266<CODE
267CLASS="STRUCTFIELD"
268>type</CODE
269> is not supported, or no buffers have
270been allocated (memory mapping) or enqueued (output) yet.</P
271></DD
272></DL
273></DIV
274></DIV
275><DIV
276CLASS="NAVFOOTER"
277><HR
278ALIGN="LEFT"
279WIDTH="100%"><TABLE
280SUMMARY="Footer navigation table"
281WIDTH="100%"
282BORDER="0"
283CELLPADDING="0"
284CELLSPACING="0"
285><TR
286><TD
287WIDTH="33%"
288ALIGN="left"
289VALIGN="top"
290><A
291HREF="r13696.htm"
292ACCESSKEY="P"
293>Prev</A
294></TD
295><TD
296WIDTH="34%"
297ALIGN="center"
298VALIGN="top"
299><A
300HREF="book1.htm"
301ACCESSKEY="H"
302>Home</A
303></TD
304><TD
305WIDTH="33%"
306ALIGN="right"
307VALIGN="top"
308><A
309HREF="r13889.htm"
310ACCESSKEY="N"
311>Next</A
312></TD
313></TR
314><TR
315><TD
316WIDTH="33%"
317ALIGN="left"
318VALIGN="top"
319>ioctl VIDIOC_REQBUFS</TD
320><TD
321WIDTH="34%"
322ALIGN="center"
323VALIGN="top"
324><A
325HREF="r7624.htm"
326ACCESSKEY="U"
327>Up</A
328></TD
329><TD
330WIDTH="33%"
331ALIGN="right"
332VALIGN="top"
333>V4L2 mmap()</TD
334></TR
335></TABLE
336></DIV
337></BODY
338></HTML
339>
340