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