Commit 49179ff4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: Documentation/media: rename "Codec Interface"

The "Codec Interface" chapter is poorly named since codecs are just one
use-case of the Memory-to-Memory Interface. Rename it and clean up the
text a bit.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 0b7a4b41
...@@ -91,7 +91,7 @@ A request must contain at least one buffer, otherwise ``ENOENT`` is returned. ...@@ -91,7 +91,7 @@ A request must contain at least one buffer, otherwise ``ENOENT`` is returned.
A queued request cannot be modified anymore. A queued request cannot be modified anymore.
.. caution:: .. caution::
For :ref:`memory-to-memory devices <codec>` you can use requests only for For :ref:`memory-to-memory devices <mem2mem>` you can use requests only for
output buffers, not for capture buffers. Attempting to add a capture buffer output buffers, not for capture buffers. Attempting to add a capture buffer
to a request will result in an ``EACCES`` error. to a request will result in an ``EACCES`` error.
...@@ -152,7 +152,7 @@ if it had just been allocated. ...@@ -152,7 +152,7 @@ if it had just been allocated.
Example for a Codec Device Example for a Codec Device
-------------------------- --------------------------
For use-cases such as :ref:`codecs <codec>`, the request API can be used For use-cases such as :ref:`codecs <mem2mem>`, the request API can be used
to associate specific controls to to associate specific controls to
be applied by the driver for the OUTPUT buffer, allowing user-space be applied by the driver for the OUTPUT buffer, allowing user-space
to queue many such buffers in advance. It can also take advantage of requests' to queue many such buffers in advance. It can also take advantage of requests'
......
...@@ -7,37 +7,36 @@ ...@@ -7,37 +7,36 @@
.. ..
.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
.. _codec: .. _mem2mem:
*************** ********************************
Codec Interface Video Memory-To-Memory Interface
*************** ********************************
A V4L2 codec can compress, decompress, transform, or otherwise convert A V4L2 memory-to-memory device can compress, decompress, transform, or
video data from one format into another format, in memory. Typically otherwise convert video data from one format into another format, in memory.
such devices are memory-to-memory devices (i.e. devices with the Such memory-to-memory devices set the ``V4L2_CAP_VIDEO_M2M`` or
``V4L2_CAP_VIDEO_M2M`` or ``V4L2_CAP_VIDEO_M2M_MPLANE`` capability set). ``V4L2_CAP_VIDEO_M2M_MPLANE`` capability. Examples of memory-to-memory
devices are codecs, scalers, deinterlacers or format converters (i.e.
converting from YUV to RGB).
A memory-to-memory video node acts just like a normal video node, but it A memory-to-memory video node acts just like a normal video node, but it
supports both output (sending frames from memory to the codec hardware) supports both output (sending frames from memory to the hardware)
and capture (receiving the processed frames from the codec hardware into and capture (receiving the processed frames from the hardware into
memory) stream I/O. An application will have to setup the stream I/O for memory) stream I/O. An application will have to setup the stream I/O for
both sides and finally call :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>` both sides and finally call :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>`
for both capture and output to start the codec. for both capture and output to start the hardware.
Video compression codecs use the MPEG controls to setup their codec
parameters
.. note::
The MPEG controls actually support many more codecs than
just MPEG. See :ref:`mpeg-controls`.
Memory-to-memory devices function as a shared resource: you can Memory-to-memory devices function as a shared resource: you can
open the video node multiple times, each application setting up their open the video node multiple times, each application setting up their
own codec properties that are local to the file handle, and each can use own properties that are local to the file handle, and each can use
it independently from the others. The driver will arbitrate access to it independently from the others. The driver will arbitrate access to
the codec and reprogram it whenever another file handler gets access. the hardware and reprogram it whenever another file handler gets access.
This is different from the usual video node behavior where the video This is different from the usual video node behavior where the video
properties are global to the device (i.e. changing something through one properties are global to the device (i.e. changing something through one
file handle is visible through another file handle). file handle is visible through another file handle).
One of the most common memory-to-memory device is the codec. Codecs
are more complicated than most and require additional setup for
their codec parameters. This is done through codec controls.
See :ref:`mpeg-controls`.
...@@ -21,7 +21,7 @@ Interfaces ...@@ -21,7 +21,7 @@ Interfaces
dev-overlay dev-overlay
dev-output dev-output
dev-osd dev-osd
dev-codec dev-mem2mem
dev-raw-vbi dev-raw-vbi
dev-sliced-vbi dev-sliced-vbi
dev-radio dev-radio
......
...@@ -73,7 +73,7 @@ Compressed Formats ...@@ -73,7 +73,7 @@ Compressed Formats
- 'MG2S' - 'MG2S'
- MPEG-2 parsed slice data, as extracted from the MPEG-2 bitstream. - MPEG-2 parsed slice data, as extracted from the MPEG-2 bitstream.
This format is adapted for stateless video decoders that implement a This format is adapted for stateless video decoders that implement a
MPEG-2 pipeline (using the :ref:`codec` and :ref:`media-request-api`). MPEG-2 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
Metadata associated with the frame to decode is required to be passed Metadata associated with the frame to decode is required to be passed
through the ``V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS`` control and through the ``V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS`` control and
quantization matrices can optionally be specified through the quantization matrices can optionally be specified through the
......
...@@ -123,7 +123,7 @@ then ``EINVAL`` will be returned. ...@@ -123,7 +123,7 @@ then ``EINVAL`` will be returned.
:ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>` or calling :ref:`VIDIOC_REQBUFS` :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>` or calling :ref:`VIDIOC_REQBUFS`
the check for this will be reset. the check for this will be reset.
For :ref:`memory-to-memory devices <codec>` you can specify the For :ref:`memory-to-memory devices <mem2mem>` you can specify the
``request_fd`` only for output buffers, not for capture buffers. Attempting ``request_fd`` only for output buffers, not for capture buffers. Attempting
to specify this for a capture buffer will result in an ``EACCES`` error. to specify this for a capture buffer will result in an ``EACCES`` error.
......
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