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