| 1 |
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later |
| 2 |
.. c:namespace:: V4L |
| 3 |
|
| 4 |
.. _mem2mem: |
| 5 |
|
| 6 |
******************************** |
| 7 |
Video Memory-To-Memory Interface |
| 8 |
******************************** |
| 9 |
|
| 10 |
A V4L2 memory-to-memory device can compress, decompress, transform, or |
| 11 |
otherwise convert video data from one format into another format, in memory. |
| 12 |
Such memory-to-memory devices set the ``V4L2_CAP_VIDEO_M2M`` or |
| 13 |
``V4L2_CAP_VIDEO_M2M_MPLANE`` capability. Examples of memory-to-memory |
| 14 |
devices are codecs, scalers, deinterlacers or format converters (i.e. |
| 15 |
converting from YUV to RGB). |
| 16 |
|
| 17 |
A memory-to-memory video node acts just like a normal video node, but it |
| 18 |
supports both output (sending frames from memory to the hardware) |
| 19 |
and capture (receiving the processed frames from the hardware into |
| 20 |
memory) stream I/O. An application will have to setup the stream I/O for |
| 21 |
both sides and finally call :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>` |
| 22 |
for both capture and output to start the hardware. |
| 23 |
|
| 24 |
Memory-to-memory devices function as a shared resource: you can |
| 25 |
open the video node multiple times, each application setting up their |
| 26 |
own properties that are local to the file handle, and each can use |
| 27 |
it independently from the others. The driver will arbitrate access to |
| 28 |
the hardware and reprogram it whenever another file handler gets access. |
| 29 |
This is different from the usual video node behavior where the video |
| 30 |
properties are global to the device (i.e. changing something through one |
| 31 |
file handle is visible through another file handle). |
| 32 |
|
| 33 |
One of the most common memory-to-memory device is the codec. Codecs |
| 34 |
are more complicated than most and require additional setup for |
| 35 |
their codec parameters. This is done through codec controls. |
| 36 |
See :ref:`codec-controls`. More details on how to use codec memory-to-memory |
| 37 |
devices are given in the following sections. |
| 38 |
|
| 39 |
.. toctree:: |
| 40 |
:maxdepth: 1 |
| 41 |
|
| 42 |
dev-decoder |
| 43 |
dev-encoder |
| 44 |
dev-stateless-decoder |