dev-mem2mem.rst 1.9 KB

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