Commit 760c7010 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

doc-rst: linux_tv: avoid using c:func::

Using auto-generated links is dangerous, as there are multiple
definitions for syscalls (at least one on each book part).

So, reference them by their explicit reference.

I used this small script to help writing this patch:

for i in $(git grep -l "c:func:"); do perl -ne 's/\:c\:func:\`(open|close|read|poll|write|select|mmap|munmap|ioctl)\(\)`/:ref:`$1() <func-$1>`/; print $_' < $i >a && mv a $i; done
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 5d2b3f12
...@@ -72,8 +72,9 @@ that possible. ...@@ -72,8 +72,9 @@ that possible.
Return Value Return Value
============ ============
On success :c:func:`open()` returns the new file descriptor. On error On success :ref:`open() <frontend_f_open>` returns the new file descriptor.
-1 is returned, and the ``errno`` variable is set appropriately. On error, -1 is returned, and the ``errno`` variable is set appropriately.
Possible error codes are: Possible error codes are:
EACCES EACCES
......
...@@ -146,4 +146,4 @@ outputted buffers. ...@@ -146,4 +146,4 @@ outputted buffers.
Drivers implementing DMABUF importing I/O must support the Drivers implementing DMABUF importing I/O must support the
``VIDIOC_REQBUFS``, ``VIDIOC_QBUF``, ``VIDIOC_DQBUF``, ``VIDIOC_REQBUFS``, ``VIDIOC_QBUF``, ``VIDIOC_DQBUF``,
``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctls, and the ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctls, and the
:c:func:`select()` and :c:func:`poll()` functions. :ref:`select() <func-select>` and :ref:`poll() <func-poll>` functions.
...@@ -38,7 +38,7 @@ Arguments ...@@ -38,7 +38,7 @@ Arguments
Description Description
=========== ===========
The :c:func:`ioctl()` function is used to program V4L2 devices. The The :ref:`ioctl() <func-ioctl>` function is used to program V4L2 devices. The
argument ``fd`` must be an open file descriptor. An ioctl ``request`` argument ``fd`` must be an open file descriptor. An ioctl ``request``
has encoded in it whether the argument is an input, output or read/write has encoded in it whether the argument is an input, output or read/write
parameter, and the size of the argument ``argp`` in bytes. Macros and parameter, and the size of the argument ``argp`` in bytes. Macros and
......
...@@ -49,7 +49,7 @@ Arguments ...@@ -49,7 +49,7 @@ Arguments
module, which is used by the bttv, saa7134, saa7146, cx88 and vivi module, which is used by the bttv, saa7134, saa7146, cx88 and vivi
driver supports only ``PROT_READ`` | ``PROT_WRITE``. When the driver supports only ``PROT_READ`` | ``PROT_WRITE``. When the
driver does not support the desired protection the driver does not support the desired protection the
:c:func:`mmap()` function fails. :ref:`mmap() <func-mmap>` function fails.
Note device memory accesses (e. g. the memory on a graphics card Note device memory accesses (e. g. the memory on a graphics card
with video capturing hardware) may incur a performance penalty with video capturing hardware) may incur a performance penalty
...@@ -65,7 +65,7 @@ Arguments ...@@ -65,7 +65,7 @@ Arguments
``MAP_FIXED`` requests that the driver selects no other address than ``MAP_FIXED`` requests that the driver selects no other address than
the one specified. If the specified address cannot be used, the one specified. If the specified address cannot be used,
:c:func:`mmap()` will fail. If ``MAP_FIXED`` is specified, :ref:`mmap() <func-mmap>` will fail. If ``MAP_FIXED`` is specified,
``start`` must be a multiple of the pagesize. Use of this option is ``start`` must be a multiple of the pagesize. Use of this option is
discouraged. discouraged.
...@@ -92,7 +92,7 @@ Arguments ...@@ -92,7 +92,7 @@ Arguments
Description Description
=========== ===========
The :c:func:`mmap()` function asks to map ``length`` bytes starting at The :ref:`mmap() <func-mmap>` function asks to map ``length`` bytes starting at
``offset`` in the memory of the device specified by ``fd`` into the ``offset`` in the memory of the device specified by ``fd`` into the
application address space, preferably at address ``start``. This latter application address space, preferably at address ``start``. This latter
address is a hint only, and is usually specified as 0. address is a hint only, and is usually specified as 0.
...@@ -108,7 +108,7 @@ To unmap buffers the :ref:`munmap() <func-munmap>` function is used. ...@@ -108,7 +108,7 @@ To unmap buffers the :ref:`munmap() <func-munmap>` function is used.
Return Value Return Value
============ ============
On success :c:func:`mmap()` returns a pointer to the mapped buffer. On On success :ref:`mmap() <func-mmap>` returns a pointer to the mapped buffer. On
error ``MAP_FAILED`` (-1) is returned, and the ``errno`` variable is set error ``MAP_FAILED`` (-1) is returned, and the ``errno`` variable is set
appropriately. Possible error codes are: appropriately. Possible error codes are:
......
...@@ -31,7 +31,7 @@ Arguments ...@@ -31,7 +31,7 @@ Arguments
``length`` ``length``
Length of the mapped buffer. This must be the same value as given to Length of the mapped buffer. This must be the same value as given to
:c:func:`mmap()` and returned by the driver in the struct :ref:`mmap() <func-mmap>` and returned by the driver in the struct
:ref:`v4l2_buffer <v4l2-buffer>` ``length`` field for the :ref:`v4l2_buffer <v4l2-buffer>` ``length`` field for the
single-planar API and in the struct single-planar API and in the struct
:ref:`v4l2_plane <v4l2-plane>` ``length`` field for the :ref:`v4l2_plane <v4l2-plane>` ``length`` field for the
...@@ -48,7 +48,7 @@ buffer and frees it, if possible. ...@@ -48,7 +48,7 @@ buffer and frees it, if possible.
Return Value Return Value
============ ============
On success :c:func:`munmap()` returns 0, on failure -1 and the On success :ref:`munmap() <func-munmap>` returns 0, on failure -1 and the
``errno`` variable is set appropriately: ``errno`` variable is set appropriately:
EINVAL EINVAL
......
...@@ -45,10 +45,10 @@ Arguments ...@@ -45,10 +45,10 @@ Arguments
Description Description
=========== ===========
To open a V4L2 device applications call :c:func:`open()` with the To open a V4L2 device applications call :ref:`open() <func-open>` with the
desired device name. This function has no side effects; all data format desired device name. This function has no side effects; all data format
parameters, current input or output, control values or other properties parameters, current input or output, control values or other properties
remain unchanged. At the first :c:func:`open()` call after loading the remain unchanged. At the first :ref:`open() <func-open>` call after loading the
driver they will be reset to default values, drivers are never in an driver they will be reset to default values, drivers are never in an
undefined state. undefined state.
...@@ -56,7 +56,7 @@ undefined state. ...@@ -56,7 +56,7 @@ undefined state.
Return Value Return Value
============ ============
On success :c:func:`open()` returns the new file descriptor. On error On success :ref:`open() <func-open>` returns the new file descriptor. On error
-1 is returned, and the ``errno`` variable is set appropriately. -1 is returned, and the ``errno`` variable is set appropriately.
Possible error codes are: Possible error codes are:
......
...@@ -24,7 +24,7 @@ Synopsis ...@@ -24,7 +24,7 @@ Synopsis
Description Description
=========== ===========
With the :c:func:`poll()` function applications can suspend execution With the :ref:`poll() <func-poll>` function applications can suspend execution
until the driver has captured data or is ready to accept data for until the driver has captured data or is ready to accept data for
output. output.
...@@ -37,7 +37,7 @@ display. When buffers are already in the outgoing queue of the driver ...@@ -37,7 +37,7 @@ display. When buffers are already in the outgoing queue of the driver
(capture) or the incoming queue isn't full (display) the function (capture) or the incoming queue isn't full (display) the function
returns immediately. returns immediately.
On success :c:func:`poll()` returns the number of file descriptors On success :ref:`poll() <func-poll>` returns the number of file descriptors
that have been selected (that is, file descriptors for which the that have been selected (that is, file descriptors for which the
``revents`` field of the respective :c:func:`struct pollfd` structure ``revents`` field of the respective :c:func:`struct pollfd` structure
is non-zero). Capture devices set the ``POLLIN`` and ``POLLRDNORM`` is non-zero). Capture devices set the ``POLLIN`` and ``POLLRDNORM``
...@@ -45,49 +45,49 @@ flags in the ``revents`` field, output devices the ``POLLOUT`` and ...@@ -45,49 +45,49 @@ flags in the ``revents`` field, output devices the ``POLLOUT`` and
``POLLWRNORM`` flags. When the function timed out it returns a value of ``POLLWRNORM`` flags. When the function timed out it returns a value of
zero, on failure it returns -1 and the ``errno`` variable is set zero, on failure it returns -1 and the ``errno`` variable is set
appropriately. When the application did not call appropriately. When the application did not call
:ref:`VIDIOC_STREAMON` the :c:func:`poll()` :ref:`VIDIOC_STREAMON` the :ref:`poll() <func-poll>`
function succeeds, but sets the ``POLLERR`` flag in the ``revents`` function succeeds, but sets the ``POLLERR`` flag in the ``revents``
field. When the application has called field. When the application has called
:ref:`VIDIOC_STREAMON` for a capture device but :ref:`VIDIOC_STREAMON` for a capture device but
hasn't yet called :ref:`VIDIOC_QBUF`, the hasn't yet called :ref:`VIDIOC_QBUF`, the
:c:func:`poll()` function succeeds and sets the ``POLLERR`` flag in :ref:`poll() <func-poll>` function succeeds and sets the ``POLLERR`` flag in
the ``revents`` field. For output devices this same situation will cause the ``revents`` field. For output devices this same situation will cause
:c:func:`poll()` to succeed as well, but it sets the ``POLLOUT`` and :ref:`poll() <func-poll>` to succeed as well, but it sets the ``POLLOUT`` and
``POLLWRNORM`` flags in the ``revents`` field. ``POLLWRNORM`` flags in the ``revents`` field.
If an event occurred (see :ref:`VIDIOC_DQEVENT`) If an event occurred (see :ref:`VIDIOC_DQEVENT`)
then ``POLLPRI`` will be set in the ``revents`` field and then ``POLLPRI`` will be set in the ``revents`` field and
:c:func:`poll()` will return. :ref:`poll() <func-poll>` will return.
When use of the :c:func:`read()` function has been negotiated and the When use of the :ref:`read() <func-read>` function has been negotiated and the
driver does not capture yet, the :c:func:`poll()` function starts driver does not capture yet, the :ref:`poll() <func-poll>` function starts
capturing. When that fails it returns a ``POLLERR`` as above. Otherwise capturing. When that fails it returns a ``POLLERR`` as above. Otherwise
it waits until data has been captured and can be read. When the driver it waits until data has been captured and can be read. When the driver
captures continuously (as opposed to, for example, still images) the captures continuously (as opposed to, for example, still images) the
function may return immediately. function may return immediately.
When use of the :c:func:`write()` function has been negotiated and the When use of the :ref:`write() <func-write>` function has been negotiated and the
driver does not stream yet, the :c:func:`poll()` function starts driver does not stream yet, the :ref:`poll() <func-poll>` function starts
streaming. When that fails it returns a ``POLLERR`` as above. Otherwise streaming. When that fails it returns a ``POLLERR`` as above. Otherwise
it waits until the driver is ready for a non-blocking it waits until the driver is ready for a non-blocking
:c:func:`write()` call. :ref:`write() <func-write>` call.
If the caller is only interested in events (just ``POLLPRI`` is set in If the caller is only interested in events (just ``POLLPRI`` is set in
the ``events`` field), then :c:func:`poll()` will *not* start the ``events`` field), then :ref:`poll() <func-poll>` will *not* start
streaming if the driver does not stream yet. This makes it possible to streaming if the driver does not stream yet. This makes it possible to
just poll for events and not for buffers. just poll for events and not for buffers.
All drivers implementing the :c:func:`read()` or :c:func:`write()` All drivers implementing the :ref:`read() <func-read>` or :ref:`write() <func-write>`
function or streaming I/O must also support the :c:func:`poll()` function or streaming I/O must also support the :ref:`poll() <func-poll>`
function. function.
For more details see the :c:func:`poll()` manual page. For more details see the :ref:`poll() <func-poll>` manual page.
Return Value Return Value
============ ============
On success, :c:func:`poll()` returns the number structures which have On success, :ref:`poll() <func-poll>` returns the number structures which have
non-zero ``revents`` fields, or zero if the call timed out. On error -1 non-zero ``revents`` fields, or zero if the call timed out. On error -1
is returned, and the ``errno`` variable is set appropriately: is returned, and the ``errno`` variable is set appropriately:
......
...@@ -34,48 +34,48 @@ Arguments ...@@ -34,48 +34,48 @@ Arguments
Description Description
=========== ===========
:c:func:`read()` attempts to read up to ``count`` bytes from file :ref:`read() <func-read>` attempts to read up to ``count`` bytes from file
descriptor ``fd`` into the buffer starting at ``buf``. The layout of the descriptor ``fd`` into the buffer starting at ``buf``. The layout of the
data in the buffer is discussed in the respective device interface data in the buffer is discussed in the respective device interface
section, see ##. If ``count`` is zero, :c:func:`read()` returns zero section, see ##. If ``count`` is zero, :ref:`read() <func-read>` returns zero
and has no other results. If ``count`` is greater than ``SSIZE_MAX``, and has no other results. If ``count`` is greater than ``SSIZE_MAX``,
the result is unspecified. Regardless of the ``count`` value each the result is unspecified. Regardless of the ``count`` value each
:c:func:`read()` call will provide at most one frame (two fields) :ref:`read() <func-read>` call will provide at most one frame (two fields)
worth of data. worth of data.
By default :c:func:`read()` blocks until data becomes available. When By default :ref:`read() <func-read>` blocks until data becomes available. When
the ``O_NONBLOCK`` flag was given to the :ref:`open() <func-open>` the ``O_NONBLOCK`` flag was given to the :ref:`open() <func-open>`
function it returns immediately with an ``EAGAIN`` error code when no data function it returns immediately with an ``EAGAIN`` error code when no data
is available. The :ref:`select() <func-select>` or is available. The :ref:`select() <func-select>` or
:ref:`poll() <func-poll>` functions can always be used to suspend :ref:`poll() <func-poll>` functions can always be used to suspend
execution until data becomes available. All drivers supporting the execution until data becomes available. All drivers supporting the
:c:func:`read()` function must also support :c:func:`select()` and :ref:`read() <func-read>` function must also support :ref:`select() <func-select>` and
:c:func:`poll()`. :ref:`poll() <func-poll>`.
Drivers can implement read functionality in different ways, using a Drivers can implement read functionality in different ways, using a
single or multiple buffers and discarding the oldest or newest frames single or multiple buffers and discarding the oldest or newest frames
once the internal buffers are filled. once the internal buffers are filled.
:c:func:`read()` never returns a "snapshot" of a buffer being filled. :ref:`read() <func-read>` never returns a "snapshot" of a buffer being filled.
Using a single buffer the driver will stop capturing when the Using a single buffer the driver will stop capturing when the
application starts reading the buffer until the read is finished. Thus application starts reading the buffer until the read is finished. Thus
only the period of the vertical blanking interval is available for only the period of the vertical blanking interval is available for
reading, or the capture rate must fall below the nominal frame rate of reading, or the capture rate must fall below the nominal frame rate of
the video standard. the video standard.
The behavior of :c:func:`read()` when called during the active picture The behavior of :ref:`read() <func-read>` when called during the active picture
period or the vertical blanking separating the top and bottom field period or the vertical blanking separating the top and bottom field
depends on the discarding policy. A driver discarding the oldest frames depends on the discarding policy. A driver discarding the oldest frames
keeps capturing into an internal buffer, continuously overwriting the keeps capturing into an internal buffer, continuously overwriting the
previously, not read frame, and returns the frame being received at the previously, not read frame, and returns the frame being received at the
time of the :c:func:`read()` call as soon as it is complete. time of the :ref:`read() <func-read>` call as soon as it is complete.
A driver discarding the newest frames stops capturing until the next A driver discarding the newest frames stops capturing until the next
:c:func:`read()` call. The frame being received at :c:func:`read()` :ref:`read() <func-read>` call. The frame being received at :ref:`read() <func-read>`
time is discarded, returning the following frame instead. Again this time is discarded, returning the following frame instead. Again this
implies a reduction of the capture rate to one half or less of the implies a reduction of the capture rate to one half or less of the
nominal frame rate. An example of this model is the video read mode of nominal frame rate. An example of this model is the video read mode of
the bttv driver, initiating a DMA to user memory when :c:func:`read()` the bttv driver, initiating a DMA to user memory when :ref:`read() <func-read>`
is called and returning when the DMA finished. is called and returning when the DMA finished.
In the multiple buffer model drivers maintain a ring of internal In the multiple buffer model drivers maintain a ring of internal
...@@ -97,7 +97,7 @@ Return Value ...@@ -97,7 +97,7 @@ Return Value
On success, the number of bytes read is returned. It is not an error if On success, the number of bytes read is returned. It is not an error if
this number is smaller than the number of bytes requested, or the amount this number is smaller than the number of bytes requested, or the amount
of data required for one frame. This may happen for example because of data required for one frame. This may happen for example because
:c:func:`read()` was interrupted by a signal. On error, -1 is :ref:`read() <func-read>` was interrupted by a signal. On error, -1 is
returned, and the ``errno`` variable is set appropriately. In this case returned, and the ``errno`` variable is set appropriately. In this case
the next read will start at the beginning of a new frame. Possible error the next read will start at the beginning of a new frame. Possible error
codes are: codes are:
...@@ -125,5 +125,5 @@ EIO ...@@ -125,5 +125,5 @@ EIO
communicate with a remote device (USB camera etc.). communicate with a remote device (USB camera etc.).
EINVAL EINVAL
The :c:func:`read()` function is not supported by this driver, not The :ref:`read() <func-read>` function is not supported by this driver, not
on this device, or generally not on this type of device. on this device, or generally not on this type of device.
...@@ -26,7 +26,7 @@ Synopsis ...@@ -26,7 +26,7 @@ Synopsis
Description Description
=========== ===========
With the :c:func:`select()` function applications can suspend With the :ref:`select() <func-select>` function applications can suspend
execution until the driver has captured data or is ready to accept data execution until the driver has captured data or is ready to accept data
for output. for output.
...@@ -35,40 +35,40 @@ buffer has been filled or displayed and can be dequeued with the ...@@ -35,40 +35,40 @@ buffer has been filled or displayed and can be dequeued with the
:ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl. When buffers are already in :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl. When buffers are already in
the outgoing queue of the driver the function returns immediately. the outgoing queue of the driver the function returns immediately.
On success :c:func:`select()` returns the total number of bits set in On success :ref:`select() <func-select>` returns the total number of bits set in
:c:func:`struct fd_set`. When the function timed out it returns :c:func:`struct fd_set`. When the function timed out it returns
a value of zero. On failure it returns -1 and the ``errno`` variable is a value of zero. On failure it returns -1 and the ``errno`` variable is
set appropriately. When the application did not call set appropriately. When the application did not call
:ref:`VIDIOC_QBUF` or :ref:`VIDIOC_QBUF` or
:ref:`VIDIOC_STREAMON` yet the :c:func:`select()` :ref:`VIDIOC_STREAMON` yet the :ref:`select() <func-select>`
function succeeds, setting the bit of the file descriptor in ``readfds`` function succeeds, setting the bit of the file descriptor in ``readfds``
or ``writefds``, but subsequent :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` or ``writefds``, but subsequent :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>`
calls will fail. [1]_ calls will fail. [1]_
When use of the :c:func:`read()` function has been negotiated and the When use of the :ref:`read() <func-read>` function has been negotiated and the
driver does not capture yet, the :c:func:`select()` function starts driver does not capture yet, the :ref:`select() <func-select>` function starts
capturing. When that fails, :c:func:`select()` returns successful and capturing. When that fails, :ref:`select() <func-select>` returns successful and
a subsequent :c:func:`read()` call, which also attempts to start a subsequent :ref:`read() <func-read>` call, which also attempts to start
capturing, will return an appropriate error code. When the driver capturing, will return an appropriate error code. When the driver
captures continuously (as opposed to, for example, still images) and captures continuously (as opposed to, for example, still images) and
data is already available the :c:func:`select()` function returns data is already available the :ref:`select() <func-select>` function returns
immediately. immediately.
When use of the :c:func:`write()` function has been negotiated the When use of the :ref:`write() <func-write>` function has been negotiated the
:c:func:`select()` function just waits until the driver is ready for a :ref:`select() <func-select>` function just waits until the driver is ready for a
non-blocking :c:func:`write()` call. non-blocking :ref:`write() <func-write>` call.
All drivers implementing the :c:func:`read()` or :c:func:`write()` All drivers implementing the :ref:`read() <func-read>` or :ref:`write() <func-write>`
function or streaming I/O must also support the :c:func:`select()` function or streaming I/O must also support the :ref:`select() <func-select>`
function. function.
For more details see the :c:func:`select()` manual page. For more details see the :ref:`select() <func-select>` manual page.
Return Value Return Value
============ ============
On success, :c:func:`select()` returns the number of descriptors On success, :ref:`select() <func-select>` returns the number of descriptors
contained in the three returned descriptor sets, which will be zero if contained in the three returned descriptor sets, which will be zero if
the timeout expired. On error -1 is returned, and the ``errno`` variable the timeout expired. On error -1 is returned, and the ``errno`` variable
is set appropriately; the sets and ``timeout`` are undefined. Possible is set appropriately; the sets and ``timeout`` are undefined. Possible
...@@ -94,6 +94,6 @@ EINVAL ...@@ -94,6 +94,6 @@ EINVAL
``FD_SETSIZE``. ``FD_SETSIZE``.
.. [1] .. [1]
The Linux kernel implements :c:func:`select()` like the The Linux kernel implements :ref:`select() <func-select>` like the
:ref:`poll() <func-poll>` function, but :c:func:`select()` cannot :ref:`poll() <func-poll>` function, but :ref:`select() <func-select>` cannot
return a ``POLLERR``. return a ``POLLERR``.
...@@ -34,10 +34,10 @@ Arguments ...@@ -34,10 +34,10 @@ Arguments
Description Description
=========== ===========
:c:func:`write()` writes up to ``count`` bytes to the device :ref:`write() <func-write>` writes up to ``count`` bytes to the device
referenced by the file descriptor ``fd`` from the buffer starting at referenced by the file descriptor ``fd`` from the buffer starting at
``buf``. When the hardware outputs are not active yet, this function ``buf``. When the hardware outputs are not active yet, this function
enables them. When ``count`` is zero, :c:func:`write()` returns 0 enables them. When ``count`` is zero, :ref:`write() <func-write>` returns 0
without any other effect. without any other effect.
When the application does not provide more data in time, the previous When the application does not provide more data in time, the previous
...@@ -76,5 +76,5 @@ EIO ...@@ -76,5 +76,5 @@ EIO
I/O error. This indicates some hardware problem. I/O error. This indicates some hardware problem.
EINVAL EINVAL
The :c:func:`write()` function is not supported by this driver, The :ref:`write() <func-write>` function is not supported by this driver,
not on this device, or generally not on this type of device. not on this device, or generally not on this type of device.
...@@ -9,8 +9,8 @@ The V4L2 API defines several different methods to read from or write to ...@@ -9,8 +9,8 @@ The V4L2 API defines several different methods to read from or write to
a device. All drivers exchanging data with applications must support at a device. All drivers exchanging data with applications must support at
least one of them. least one of them.
The classic I/O method using the :c:func:`read()` and The classic I/O method using the :ref:`read() <func-read>` and
:c:func:`write()` function is automatically selected after opening a :ref:`write() <func-write>` function is automatically selected after opening a
V4L2 device. When the driver does not support this method attempts to V4L2 device. When the driver does not support this method attempts to
read or write will fail at any time. read or write will fail at any time.
......
...@@ -38,7 +38,7 @@ are freed. The device configuration remain unchanged. ...@@ -38,7 +38,7 @@ are freed. The device configuration remain unchanged.
Return Value Return Value
============ ============
:c:func:`close()` returns 0 on success. On error, -1 is returned, and :ref:`close() <func-close>` returns 0 on success. On error, -1 is returned, and
``errno`` is set appropriately. Possible error codes are: ``errno`` is set appropriately. Possible error codes are:
EBADF EBADF
......
...@@ -38,7 +38,7 @@ Arguments ...@@ -38,7 +38,7 @@ Arguments
Description Description
=========== ===========
The :c:func:`ioctl()` function manipulates media device parameters. The :ref:`ioctl() <func-ioctl>` function manipulates media device parameters.
The argument ``fd`` must be an open file descriptor. The argument ``fd`` must be an open file descriptor.
The ioctl ``request`` code specifies the media function to be called. It The ioctl ``request`` code specifies the media function to be called. It
......
...@@ -35,7 +35,7 @@ Arguments ...@@ -35,7 +35,7 @@ Arguments
Description Description
=========== ===========
To open a media device applications call :c:func:`open()` with the To open a media device applications call :ref:`open() <func-open>` with the
desired device name. The function has no side effects; the device desired device name. The function has no side effects; the device
configuration remain unchanged. configuration remain unchanged.
...@@ -47,7 +47,7 @@ EBADF. ...@@ -47,7 +47,7 @@ EBADF.
Return Value Return Value
============ ============
:c:func:`open()` returns the new file descriptor on success. On error, :ref:`open() <func-open>` returns the new file descriptor on success. On error,
-1 is returned, and ``errno`` is set appropriately. Possible error codes -1 is returned, and ``errno`` is set appropriately. Possible error codes
are: are:
......
...@@ -40,7 +40,7 @@ location of the buffers in device memory can be determined with the ...@@ -40,7 +40,7 @@ location of the buffers in device memory can be determined with the
:ref:`VIDIOC_QUERYBUF` ioctl. In the single-planar :ref:`VIDIOC_QUERYBUF` ioctl. In the single-planar
API case, the ``m.offset`` and ``length`` returned in a struct API case, the ``m.offset`` and ``length`` returned in a struct
:ref:`v4l2_buffer <v4l2-buffer>` are passed as sixth and second :ref:`v4l2_buffer <v4l2-buffer>` are passed as sixth and second
parameter to the :c:func:`mmap()` function. When using the parameter to the :ref:`mmap() <func-mmap>` function. When using the
multi-planar API, struct :ref:`v4l2_buffer <v4l2-buffer>` contains an multi-planar API, struct :ref:`v4l2_buffer <v4l2-buffer>` contains an
array of struct :ref:`v4l2_plane <v4l2-plane>` structures, each array of struct :ref:`v4l2_plane <v4l2-plane>` structures, each
containing its own ``m.offset`` and ``length``. When using the containing its own ``m.offset`` and ``length``. When using the
...@@ -251,15 +251,15 @@ event it should examine the struct :ref:`v4l2_buffer <v4l2-buffer>` ...@@ -251,15 +251,15 @@ event it should examine the struct :ref:`v4l2_buffer <v4l2-buffer>`
Drivers implementing memory mapping I/O must support the Drivers implementing memory mapping I/O must support the
``VIDIOC_REQBUFS``, ``VIDIOC_QUERYBUF``, ``VIDIOC_QBUF``, ``VIDIOC_REQBUFS``, ``VIDIOC_QUERYBUF``, ``VIDIOC_QBUF``,
``VIDIOC_DQBUF``, ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl, ``VIDIOC_DQBUF``, ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl,
the :c:func:`mmap()`, :c:func:`munmap()`, :c:func:`select()` and the :ref:`mmap() <func-mmap>`, :ref:`munmap() <func-munmap>`, :ref:`select() <func-select>` and
:c:func:`poll()` function. [3]_ :ref:`poll() <func-poll>` function. [3]_
[capture example] [capture example]
.. [1] .. [1]
One could use one file descriptor and set the buffer type field One could use one file descriptor and set the buffer type field
accordingly when calling :ref:`VIDIOC_QBUF` etc., accordingly when calling :ref:`VIDIOC_QBUF` etc.,
but it makes the :c:func:`select()` function ambiguous. We also but it makes the :ref:`select() <func-select>` function ambiguous. We also
like the clean approach of one file descriptor per logical stream. like the clean approach of one file descriptor per logical stream.
Video overlay for example is also a logical stream, although the CPU Video overlay for example is also a logical stream, although the CPU
is not needed for continuous operation. is not needed for continuous operation.
...@@ -272,6 +272,6 @@ the :c:func:`mmap()`, :c:func:`munmap()`, :c:func:`select()` and ...@@ -272,6 +272,6 @@ the :c:func:`mmap()`, :c:func:`munmap()`, :c:func:`select()` and
scatter-gather lists and the like. scatter-gather lists and the like.
.. [3] .. [3]
At the driver level :c:func:`select()` and :c:func:`poll()` are At the driver level :ref:`select() <func-select>` and :ref:`poll() <func-poll>` are
the same, and :c:func:`select()` is too important to be optional. the same, and :ref:`select() <func-select>` is too important to be optional.
The rest should be evident. The rest should be evident.
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
Read/Write Read/Write
********** **********
Input and output devices support the :c:func:`read()` and Input and output devices support the :ref:`read() <func-read>` and
:c:func:`write()` function, respectively, when the :ref:`write() <func-write>` function, respectively, when the
``V4L2_CAP_READWRITE`` flag in the ``capabilities`` field of struct ``V4L2_CAP_READWRITE`` flag in the ``capabilities`` field of struct
:ref:`v4l2_capability <v4l2-capability>` returned by the :ref:`v4l2_capability <v4l2-capability>` returned by the
:ref:`VIDIOC_QUERYCAP` ioctl is set. :ref:`VIDIOC_QUERYCAP` ioctl is set.
...@@ -43,5 +43,5 @@ driver must also support the :ref:`select() <func-select>` and ...@@ -43,5 +43,5 @@ driver must also support the :ref:`select() <func-select>` and
capturing still images. capturing still images.
.. [2] .. [2]
At the driver level :c:func:`select()` and :c:func:`poll()` are At the driver level :ref:`select() <func-select>` and :ref:`poll() <func-poll>` are
the same, and :c:func:`select()` is too important to be optional. the same, and :ref:`select() <func-select>` is too important to be optional.
...@@ -94,7 +94,7 @@ outputted buffers. ...@@ -94,7 +94,7 @@ outputted buffers.
Drivers implementing user pointer I/O must support the Drivers implementing user pointer I/O must support the
``VIDIOC_REQBUFS``, ``VIDIOC_QBUF``, ``VIDIOC_DQBUF``, ``VIDIOC_REQBUFS``, ``VIDIOC_QBUF``, ``VIDIOC_DQBUF``,
``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl, the ``VIDIOC_STREAMON`` and ``VIDIOC_STREAMOFF`` ioctl, the
:c:func:`select()` and :c:func:`poll()` function. [2]_ :ref:`select() <func-select>` and :ref:`poll() <func-poll>` function. [2]_
.. [1] .. [1]
We expect that frequently used buffers are typically not swapped out. We expect that frequently used buffers are typically not swapped out.
...@@ -109,6 +109,6 @@ Drivers implementing user pointer I/O must support the ...@@ -109,6 +109,6 @@ Drivers implementing user pointer I/O must support the
because an application may share them with other processes. because an application may share them with other processes.
.. [2] .. [2]
At the driver level :c:func:`select()` and :c:func:`poll()` are At the driver level :ref:`select() <func-select>` and :ref:`poll() <func-poll>` are
the same, and :c:func:`select()` is too important to be optional. the same, and :ref:`select() <func-select>` is too important to be optional.
The rest should be evident. The rest should be evident.
...@@ -43,11 +43,11 @@ this structure. ...@@ -43,11 +43,11 @@ this structure.
The ``cmd`` field must contain the command code. Some commands use the The ``cmd`` field must contain the command code. Some commands use the
``flags`` field for additional information. ``flags`` field for additional information.
A :c:func:`write()`() or :ref:`VIDIOC_STREAMON` A :ref:`write() <func-write>` or :ref:`VIDIOC_STREAMON`
call sends an implicit START command to the decoder if it has not been call sends an implicit START command to the decoder if it has not been
started yet. started yet.
A :c:func:`close()`() or :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>` A :ref:`close() <func-close>` or :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>`
call of a streaming file descriptor sends an implicit immediate STOP call of a streaming file descriptor sends an implicit immediate STOP
command to the decoder, and all buffered data is discarded. command to the decoder, and all buffered data is discarded.
......
...@@ -48,14 +48,14 @@ currently only used by the STOP command and contains one bit: If the ...@@ -48,14 +48,14 @@ currently only used by the STOP command and contains one bit: If the
until the end of the current *Group Of Pictures*, otherwise it will stop until the end of the current *Group Of Pictures*, otherwise it will stop
immediately. immediately.
A :c:func:`read()`() or :ref:`VIDIOC_STREAMON` A :ref:`read() <func-read>` or :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>`
call sends an implicit START command to the encoder if it has not been call sends an implicit START command to the encoder if it has not been
started yet. After a STOP command, :c:func:`read()`() calls will read started yet. After a STOP command, :ref:`read() <func-read>` calls will read
the remaining data buffered by the driver. When the buffer is empty, the remaining data buffered by the driver. When the buffer is empty,
:c:func:`read()`() will return zero and the next :c:func:`read()`() :ref:`read() <func-read>` will return zero and the next :ref:`read() <func-read>`
call will restart the encoder. call will restart the encoder.
A :c:func:`close()`() or :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>` A :ref:`close() <func-close>` or :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>`
call of a streaming file descriptor sends an implicit immediate STOP to call of a streaming file descriptor sends an implicit immediate STOP to
the encoder, and all buffered data is discarded. the encoder, and all buffered data is discarded.
......
...@@ -35,8 +35,8 @@ Description ...@@ -35,8 +35,8 @@ Description
The current video standard determines a nominal number of frames per The current video standard determines a nominal number of frames per
second. If less than this number of frames is to be captured or output, second. If less than this number of frames is to be captured or output,
applications can request frame skipping or duplicating on the driver applications can request frame skipping or duplicating on the driver
side. This is especially useful when using the :c:func:`read()` or side. This is especially useful when using the :ref:`read() <func-read>` or
:c:func:`write()`, which are not augmented by timestamps or sequence :ref:`write() <func-write>`, which are not augmented by timestamps or sequence
counters, and to avoid unnecessary data copying. counters, and to avoid unnecessary data copying.
Further these ioctls can be used to determine the number of buffers used Further these ioctls can be used to determine the number of buffers used
...@@ -260,7 +260,7 @@ union holding separate parameters for input and output devices. ...@@ -260,7 +260,7 @@ union holding separate parameters for input and output devices.
- ``writebuffers`` - ``writebuffers``
- Applications set this field to the desired number of buffers used - Applications set this field to the desired number of buffers used
internally by the driver in :c:func:`write()` mode. Drivers internally by the driver in :ref:`write() <func-write>` mode. Drivers
return the actual number of buffers. When an application requests return the actual number of buffers. When an application requests
zero buffers, drivers should just return the current setting zero buffers, drivers should just return the current setting
rather than the minimum or an error code. For details see rather than the minimum or an error code. For details see
...@@ -337,7 +337,7 @@ union holding separate parameters for input and output devices. ...@@ -337,7 +337,7 @@ union holding separate parameters for input and output devices.
- Moving objects in the image might have excessive motion blur. - Moving objects in the image might have excessive motion blur.
- Capture might only work through the :c:func:`read()` call. - Capture might only work through the :ref:`read() <func-read>` call.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment