1*059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 254f38fcaSMauro Carvalho Chehab 354f38fcaSMauro Carvalho Chehab.. _VIDIOC_STREAMON: 454f38fcaSMauro Carvalho Chehab 554f38fcaSMauro Carvalho Chehab*************************************** 654f38fcaSMauro Carvalho Chehabioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF 754f38fcaSMauro Carvalho Chehab*************************************** 854f38fcaSMauro Carvalho Chehab 954f38fcaSMauro Carvalho ChehabName 1054f38fcaSMauro Carvalho Chehab==== 1154f38fcaSMauro Carvalho Chehab 1254f38fcaSMauro Carvalho ChehabVIDIOC_STREAMON - VIDIOC_STREAMOFF - Start or stop streaming I/O 1354f38fcaSMauro Carvalho Chehab 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab======== 1754f38fcaSMauro Carvalho Chehab 1854f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_STREAMON, const int *argp ) 1954f38fcaSMauro Carvalho Chehab :name: VIDIOC_STREAMON 2054f38fcaSMauro Carvalho Chehab 2154f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_STREAMOFF, const int *argp ) 2254f38fcaSMauro Carvalho Chehab :name: VIDIOC_STREAMOFF 2354f38fcaSMauro Carvalho Chehab 2454f38fcaSMauro Carvalho Chehab 2554f38fcaSMauro Carvalho ChehabArguments 2654f38fcaSMauro Carvalho Chehab========= 2754f38fcaSMauro Carvalho Chehab 2854f38fcaSMauro Carvalho Chehab``fd`` 2954f38fcaSMauro Carvalho Chehab File descriptor returned by :ref:`open() <func-open>`. 3054f38fcaSMauro Carvalho Chehab 3154f38fcaSMauro Carvalho Chehab``argp`` 3254f38fcaSMauro Carvalho Chehab Pointer to an integer. 3354f38fcaSMauro Carvalho Chehab 3454f38fcaSMauro Carvalho ChehabDescription 3554f38fcaSMauro Carvalho Chehab=========== 3654f38fcaSMauro Carvalho Chehab 3754f38fcaSMauro Carvalho ChehabThe ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl start and stop 3854f38fcaSMauro Carvalho Chehabthe capture or output process during streaming 3954f38fcaSMauro Carvalho Chehab(:ref:`memory mapping <mmap>`, :ref:`user pointer <userp>` or 4054f38fcaSMauro Carvalho Chehab:ref:`DMABUF <dmabuf>`) I/O. 4154f38fcaSMauro Carvalho Chehab 4254f38fcaSMauro Carvalho ChehabCapture hardware is disabled and no input buffers are filled (if there 4354f38fcaSMauro Carvalho Chehabare any empty buffers in the incoming queue) until ``VIDIOC_STREAMON`` 4454f38fcaSMauro Carvalho Chehabhas been called. Output hardware is disabled and no video signal is 4554f38fcaSMauro Carvalho Chehabproduced until ``VIDIOC_STREAMON`` has been called. The ioctl will 4654f38fcaSMauro Carvalho Chehabsucceed when at least one output buffer is in the incoming queue. 4754f38fcaSMauro Carvalho Chehab 4854f38fcaSMauro Carvalho ChehabMemory-to-memory devices will not start until ``VIDIOC_STREAMON`` has 4954f38fcaSMauro Carvalho Chehabbeen called for both the capture and output stream types. 5054f38fcaSMauro Carvalho Chehab 5154f38fcaSMauro Carvalho ChehabIf ``VIDIOC_STREAMON`` fails then any already queued buffers will remain 5254f38fcaSMauro Carvalho Chehabqueued. 5354f38fcaSMauro Carvalho Chehab 5454f38fcaSMauro Carvalho ChehabThe ``VIDIOC_STREAMOFF`` ioctl, apart of aborting or finishing any DMA 5554f38fcaSMauro Carvalho Chehabin progress, unlocks any user pointer buffers locked in physical memory, 5654f38fcaSMauro Carvalho Chehaband it removes all buffers from the incoming and outgoing queues. That 5754f38fcaSMauro Carvalho Chehabmeans all images captured but not dequeued yet will be lost, likewise 5854f38fcaSMauro Carvalho Chehaball images enqueued for output but not transmitted yet. I/O returns to 5954f38fcaSMauro Carvalho Chehabthe same state as after calling 6054f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_REQBUFS` and can be restarted 6154f38fcaSMauro Carvalho Chehabaccordingly. 6254f38fcaSMauro Carvalho Chehab 6354f38fcaSMauro Carvalho ChehabIf buffers have been queued with :ref:`VIDIOC_QBUF` and 6454f38fcaSMauro Carvalho Chehab``VIDIOC_STREAMOFF`` is called without ever having called 6554f38fcaSMauro Carvalho Chehab``VIDIOC_STREAMON``, then those queued buffers will also be removed from 6654f38fcaSMauro Carvalho Chehabthe incoming queue and all are returned to the same state as after 6754f38fcaSMauro Carvalho Chehabcalling :ref:`VIDIOC_REQBUFS` and can be restarted 6854f38fcaSMauro Carvalho Chehabaccordingly. 6954f38fcaSMauro Carvalho Chehab 7054f38fcaSMauro Carvalho ChehabBoth ioctls take a pointer to an integer, the desired buffer or stream 7154f38fcaSMauro Carvalho Chehabtype. This is the same as struct 7254f38fcaSMauro Carvalho Chehab:c:type:`v4l2_requestbuffers` ``type``. 7354f38fcaSMauro Carvalho Chehab 7454f38fcaSMauro Carvalho ChehabIf ``VIDIOC_STREAMON`` is called when streaming is already in progress, 7554f38fcaSMauro Carvalho Chehabor if ``VIDIOC_STREAMOFF`` is called when streaming is already stopped, 7654f38fcaSMauro Carvalho Chehabthen 0 is returned. Nothing happens in the case of ``VIDIOC_STREAMON``, 7754f38fcaSMauro Carvalho Chehabbut ``VIDIOC_STREAMOFF`` will return queued buffers to their starting 7854f38fcaSMauro Carvalho Chehabstate as mentioned above. 7954f38fcaSMauro Carvalho Chehab 8054f38fcaSMauro Carvalho Chehab.. note:: 8154f38fcaSMauro Carvalho Chehab 8254f38fcaSMauro Carvalho Chehab Applications can be preempted for unknown periods right before 8354f38fcaSMauro Carvalho Chehab or after the ``VIDIOC_STREAMON`` or ``VIDIOC_STREAMOFF`` calls, there is 8454f38fcaSMauro Carvalho Chehab no notion of starting or stopping "now". Buffer timestamps can be used 8554f38fcaSMauro Carvalho Chehab to synchronize with other events. 8654f38fcaSMauro Carvalho Chehab 8754f38fcaSMauro Carvalho Chehab 8854f38fcaSMauro Carvalho ChehabReturn Value 8954f38fcaSMauro Carvalho Chehab============ 9054f38fcaSMauro Carvalho Chehab 9154f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 9254f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 9354f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 9454f38fcaSMauro Carvalho Chehab 9554f38fcaSMauro Carvalho ChehabEINVAL 9654f38fcaSMauro Carvalho Chehab The buffer ``type`` is not supported, or no buffers have been 9754f38fcaSMauro Carvalho Chehab allocated (memory mapping) or enqueued (output) yet. 9854f38fcaSMauro Carvalho Chehab 9954f38fcaSMauro Carvalho ChehabEPIPE 10054f38fcaSMauro Carvalho Chehab The driver implements 10154f38fcaSMauro Carvalho Chehab :ref:`pad-level format configuration <pad-level-formats>` and the 10254f38fcaSMauro Carvalho Chehab pipeline configuration is invalid. 10354f38fcaSMauro Carvalho Chehab 10454f38fcaSMauro Carvalho ChehabENOLINK 10554f38fcaSMauro Carvalho Chehab The driver implements Media Controller interface and the pipeline 10654f38fcaSMauro Carvalho Chehab link configuration is invalid. 107