Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 
0003 .. _mem2mem:
0004 
0005 ********************************
0006 Video Memory-To-Memory Interface
0007 ********************************
0008 
0009 A V4L2 memory-to-memory device can compress, decompress, transform, or
0010 otherwise convert video data from one format into another format, in memory.
0011 Such memory-to-memory devices set the ``V4L2_CAP_VIDEO_M2M`` or
0012 ``V4L2_CAP_VIDEO_M2M_MPLANE`` capability. Examples of memory-to-memory
0013 devices are codecs, scalers, deinterlacers or format converters (i.e.
0014 converting from YUV to RGB).
0015 
0016 A memory-to-memory video node acts just like a normal video node, but it
0017 supports both output (sending frames from memory to the hardware)
0018 and capture (receiving the processed frames from the hardware into
0019 memory) stream I/O. An application will have to setup the stream I/O for
0020 both sides and finally call :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>`
0021 for both capture and output to start the hardware.
0022 
0023 Memory-to-memory devices function as a shared resource: you can
0024 open the video node multiple times, each application setting up their
0025 own properties that are local to the file handle, and each can use
0026 it independently from the others. The driver will arbitrate access to
0027 the hardware and reprogram it whenever another file handler gets access.
0028 This is different from the usual video node behavior where the video
0029 properties are global to the device (i.e. changing something through one
0030 file handle is visible through another file handle).
0031 
0032 One of the most common memory-to-memory device is the codec. Codecs
0033 are more complicated than most and require additional setup for
0034 their codec parameters. This is done through codec controls.
0035 See :ref:`codec-controls`. More details on how to use codec memory-to-memory
0036 devices are given in the following sections.
0037 
0038 .. toctree::
0039     :maxdepth: 1
0040 
0041     dev-decoder
0042     dev-encoder
0043     dev-stateless-decoder