planar-apis.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <section id="planar-apis">
  2. <title>Single- and multi-planar APIs</title>
  3. <para>Some devices require data for each input or output video frame
  4. to be placed in discontiguous memory buffers. In such cases, one
  5. video frame has to be addressed using more than one memory address, i.e. one
  6. pointer per "plane". A plane is a sub-buffer of the current frame. For
  7. examples of such formats see <xref linkend="pixfmt" />.</para>
  8. <para>Initially, V4L2 API did not support multi-planar buffers and a set of
  9. extensions has been introduced to handle them. Those extensions constitute
  10. what is being referred to as the "multi-planar API".</para>
  11. <para>Some of the V4L2 API calls and structures are interpreted differently,
  12. depending on whether single- or multi-planar API is being used. An application
  13. can choose whether to use one or the other by passing a corresponding buffer
  14. type to its ioctl calls. Multi-planar versions of buffer types are suffixed
  15. with an `_MPLANE' string. For a list of available multi-planar buffer types
  16. see &v4l2-buf-type;.
  17. </para>
  18. <section>
  19. <title>Multi-planar formats</title>
  20. <para>Multi-planar API introduces new multi-planar formats. Those formats
  21. use a separate set of FourCC codes. It is important to distinguish between
  22. the multi-planar API and a multi-planar format. Multi-planar API calls can
  23. handle all single-planar formats as well (as long as they are passed in
  24. multi-planar API structures), while the single-planar API cannot
  25. handle multi-planar formats.</para>
  26. </section>
  27. <section>
  28. <title>Calls that distinguish between single and multi-planar APIs</title>
  29. <variablelist>
  30. <varlistentry>
  31. <term>&VIDIOC-QUERYCAP;</term>
  32. <listitem><para>Two additional multi-planar capabilities are added. They can
  33. be set together with non-multi-planar ones for devices that handle
  34. both single- and multi-planar formats.</para></listitem>
  35. </varlistentry>
  36. <varlistentry>
  37. <term>&VIDIOC-G-FMT;, &VIDIOC-S-FMT;, &VIDIOC-TRY-FMT;</term>
  38. <listitem><para>New structures for describing multi-planar formats are added:
  39. &v4l2-pix-format-mplane; and &v4l2-plane-pix-format;. Drivers may
  40. define new multi-planar formats, which have distinct FourCC codes from
  41. the existing single-planar ones.</para>
  42. </listitem>
  43. </varlistentry>
  44. <varlistentry>
  45. <term>&VIDIOC-QBUF;, &VIDIOC-DQBUF;, &VIDIOC-QUERYBUF;</term>
  46. <listitem><para>A new &v4l2-plane; structure for describing planes is added.
  47. Arrays of this structure are passed in the new
  48. <structfield>m.planes</structfield> field of &v4l2-buffer;.</para>
  49. </listitem>
  50. </varlistentry>
  51. <varlistentry>
  52. <term>&VIDIOC-REQBUFS;</term>
  53. <listitem><para>Will allocate multi-planar buffers as requested.</para></listitem>
  54. </varlistentry>
  55. </variablelist>
  56. </section>
  57. </section>