2018-08-30 10:15:26 -04:00
.. Permission is granted to copy, distribute and/or modify this
.. document under the terms of the GNU Free Documentation License,
.. Version 1.1 or any later version published by the Free Software
.. Foundation, with no Invariant Sections, no Front-Cover Texts
.. and no Back-Cover Texts. A copy of the license is included at
2020-03-04 10:21:39 +01:00
.. Documentation/userspace-api/media/fdl-appendix.rst.
2018-08-30 10:15:26 -04:00
..
.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
2016-06-30 15:18:56 +02:00
.. _planar-apis:
***** ***** ***** ***** ***** *** *
Single- and multi-planar APIs
***** ***** ***** ***** ***** *** *
Some devices require data for each input or output video frame to be
placed in discontiguous memory buffers. In such cases, one video frame
has to be addressed using more than one memory address, i.e. one pointer
per "plane". A plane is a sub-buffer of the current frame. For examples
of such formats see :ref: `pixfmt` .
Initially, V4L2 API did not support multi-planar buffers and a set of
extensions has been introduced to handle them. Those extensions
constitute what is being referred to as the "multi-planar API".
Some of the V4L2 API calls and structures are interpreted differently,
depending on whether single- or multi-planar API is being used. An
application can choose whether to use one or the other by passing a
corresponding buffer type to its ioctl calls. Multi-planar versions of
2016-07-03 10:28:06 -03:00
buffer types are suffixed with an `` _MPLANE `` string. For a list of
2016-06-30 15:18:56 +02:00
available multi-planar buffer types see enum
[media] docs-rst: fix cross-references for videodev2.h
There are several broken references there, due to the conversion to
C domain. Fix them using this shell script and manually adjust what's
broken:
# funcs is a file with the broken functions/references
for i in $(cat funcs|sort|uniq|perl -ne 'print "$1\n" if (m/(\S+)$/)'); do
i=${i//-/_}
echo $i
j=${i//_/-}
for k in $(git grep -l "_$j:" Documentation/); do
sed s,\_$j\:,"c\:type\:\: $i", <$k >a && mv a $k
done
for k in $(git grep -l "$j" Documentation/media/*.exceptions); do
sed s,$j,":c\:type\:\`$i\`", <$k >a && mv a $k
done
for k in $(git grep -l "$j" Documentation/); do
sed "s,:ref:\`$i <$j>\`,:c:type:\`$i\`," <$k >a && mv a $k
sed "s,:ref:\`$j\`,:c:type:\`$i\`," <$k >a && mv a $k
sed -E "s,:ref:\`(.*)<$j>\`,:c:type:\`\1<$i>\`," <$k >a && mv a $k
done
for k in $(git grep -l "<$j>" include/media); do
sed -E "s,:ref:\`(.*)<$j>\`,enum \&$i," <$k >a && mv a $k
done
done
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-08 06:41:26 -03:00
:c:type: `v4l2_buf_type` .
2016-06-30 15:18:56 +02:00
Multi-planar formats
====================
Multi-planar API introduces new multi-planar formats. Those formats use
a separate set of FourCC codes. It is important to distinguish between
the multi-planar API and a multi-planar format. Multi-planar API calls
can handle all single-planar formats as well (as long as they are passed
in multi-planar API structures), while the single-planar API cannot
handle multi-planar formats.
Calls that distinguish between single and multi-planar APIs
===========================================================
2016-07-03 10:28:06 -03:00
:ref: `VIDIOC_QUERYCAP <VIDIOC_QUERYCAP>`
2016-06-30 15:18:56 +02:00
Two additional multi-planar capabilities are added. They can be set
together with non-multi-planar ones for devices that handle both
single- and multi-planar formats.
2016-07-03 10:28:06 -03:00
:ref: `VIDIOC_G_FMT <VIDIOC_G_FMT>` , :ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` , :ref: `VIDIOC_TRY_FMT <VIDIOC_G_FMT>`
2016-06-30 15:18:56 +02:00
New structures for describing multi-planar formats are added: struct
2016-08-29 17:37:59 -03:00
:c:type: `v4l2_pix_format_mplane` and
struct :c:type: `v4l2_plane_pix_format` .
2016-06-30 15:18:56 +02:00
Drivers may define new multi-planar formats, which have distinct
FourCC codes from the existing single-planar ones.
2016-07-03 10:28:06 -03:00
:ref: `VIDIOC_QBUF <VIDIOC_QBUF>` , :ref: `VIDIOC_DQBUF <VIDIOC_QBUF>` , :ref: `VIDIOC_QUERYBUF <VIDIOC_QUERYBUF>`
2016-08-29 17:37:59 -03:00
A new struct :c:type: `v4l2_plane` structure for
2016-06-30 15:18:56 +02:00
describing planes is added. Arrays of this structure are passed in
the new `` m.planes `` field of struct
2016-08-29 17:37:59 -03:00
:c:type: `v4l2_buffer` .
2016-06-30 15:18:56 +02:00
2016-07-03 10:28:06 -03:00
:ref: `VIDIOC_REQBUFS <VIDIOC_REQBUFS>`
2016-06-30 15:18:56 +02:00
Will allocate multi-planar buffers as requested.