Merge remote-tracking branch 'regulator/for-next'
[deliverable/linux.git] / Documentation / media / uapi / v4l / vidioc-streamon.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_STREAMON:
5377d91f
MH
4
5***************************************
6ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF
7***************************************
8
15e7d615 9Name
586027ce 10====
5377d91f 11
586027ce 12VIDIOC_STREAMON - VIDIOC_STREAMOFF - Start or stop streaming I/O
5377d91f 13
15e7d615
MCC
14
15Synopsis
5377d91f
MH
16========
17
41d80465
MCC
18.. c:function:: int ioctl( int fd, VIDIOC_STREAMON, const int *argp )
19 :name: VIDIOC_STREAMON
20
21.. c:function:: int ioctl( int fd, VIDIOC_STREAMOFF, const int *argp )
22 :name: VIDIOC_STREAMOFF
5377d91f 23
586027ce 24
15e7d615 25Arguments
5377d91f
MH
26=========
27
28``fd``
29 File descriptor returned by :ref:`open() <func-open>`.
30
5377d91f
MH
31``argp``
32
33
15e7d615 34Description
5377d91f
MH
35===========
36
37The ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl start and stop
38the capture or output process during streaming
39(:ref:`memory mapping <mmap>`, :ref:`user pointer <userp>` or
40:ref:`DMABUF <dmabuf>`) I/O.
41
42Capture hardware is disabled and no input buffers are filled (if there
43are any empty buffers in the incoming queue) until ``VIDIOC_STREAMON``
44has been called. Output hardware is disabled and no video signal is
45produced until ``VIDIOC_STREAMON`` has been called. The ioctl will
46succeed when at least one output buffer is in the incoming queue.
47
48Memory-to-memory devices will not start until ``VIDIOC_STREAMON`` has
49been called for both the capture and output stream types.
50
51If ``VIDIOC_STREAMON`` fails then any already queued buffers will remain
52queued.
53
54The ``VIDIOC_STREAMOFF`` ioctl, apart of aborting or finishing any DMA
55in progress, unlocks any user pointer buffers locked in physical memory,
56and it removes all buffers from the incoming and outgoing queues. That
57means all images captured but not dequeued yet will be lost, likewise
58all images enqueued for output but not transmitted yet. I/O returns to
59the same state as after calling
7347081e 60:ref:`VIDIOC_REQBUFS` and can be restarted
5377d91f
MH
61accordingly.
62
7347081e 63If buffers have been queued with :ref:`VIDIOC_QBUF` and
5377d91f
MH
64``VIDIOC_STREAMOFF`` is called without ever having called
65``VIDIOC_STREAMON``, then those queued buffers will also be removed from
66the incoming queue and all are returned to the same state as after
7347081e 67calling :ref:`VIDIOC_REQBUFS` and can be restarted
5377d91f
MH
68accordingly.
69
70Both ioctls take a pointer to an integer, the desired buffer or stream
71type. This is the same as struct
e8be7e97 72:c:type:`v4l2_requestbuffers` ``type``.
5377d91f
MH
73
74If ``VIDIOC_STREAMON`` is called when streaming is already in progress,
75or if ``VIDIOC_STREAMOFF`` is called when streaming is already stopped,
76then 0 is returned. Nothing happens in the case of ``VIDIOC_STREAMON``,
77but ``VIDIOC_STREAMOFF`` will return queued buffers to their starting
78state as mentioned above.
79
b6b6e678
MCC
80.. note::
81
82 Applications can be preempted for unknown periods right before
706f8a99
MCC
83 or after the ``VIDIOC_STREAMON`` or ``VIDIOC_STREAMOFF`` calls, there is
84 no notion of starting or stopping "now". Buffer timestamps can be used
85 to synchronize with other events.
5377d91f
MH
86
87
15e7d615 88Return Value
5377d91f
MH
89============
90
91On success 0 is returned, on error -1 and the ``errno`` variable is set
92appropriately. The generic error codes are described at the
93:ref:`Generic Error Codes <gen-errors>` chapter.
94
95EINVAL
96 The buffer ``type`` is not supported, or no buffers have been
97 allocated (memory mapping) or enqueued (output) yet.
98
99EPIPE
100 The driver implements
101 :ref:`pad-level format configuration <pad-level-formats>` and the
102 pipeline configuration is invalid.
103
104ENOLINK
105 The driver implements Media Controller interface and the pipeline
106 link configuration is invalid.
This page took 0.052858 seconds and 5 git commands to generate.