vidioc-querybuf.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <refentry id="vidioc-querybuf">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_QUERYBUF</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_QUERYBUF</refname>
  8. <refpurpose>Query the status of a buffer</refpurpose>
  9. </refnamediv>
  10. <refsynopsisdiv>
  11. <funcsynopsis>
  12. <funcprototype>
  13. <funcdef>int <function>ioctl</function></funcdef>
  14. <paramdef>int <parameter>fd</parameter></paramdef>
  15. <paramdef>int <parameter>request</parameter></paramdef>
  16. <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef>
  17. </funcprototype>
  18. </funcsynopsis>
  19. </refsynopsisdiv>
  20. <refsect1>
  21. <title>Arguments</title>
  22. <variablelist>
  23. <varlistentry>
  24. <term><parameter>fd</parameter></term>
  25. <listitem>
  26. <para>&fd;</para>
  27. </listitem>
  28. </varlistentry>
  29. <varlistentry>
  30. <term><parameter>request</parameter></term>
  31. <listitem>
  32. <para>VIDIOC_QUERYBUF</para>
  33. </listitem>
  34. </varlistentry>
  35. <varlistentry>
  36. <term><parameter>argp</parameter></term>
  37. <listitem>
  38. <para></para>
  39. </listitem>
  40. </varlistentry>
  41. </variablelist>
  42. </refsect1>
  43. <refsect1>
  44. <title>Description</title>
  45. <para>This ioctl is part of the <link linkend="mmap">streaming
  46. </link> I/O method. It can be used to query the status of a
  47. buffer at any time after buffers have been allocated with the
  48. &VIDIOC-REQBUFS; ioctl.</para>
  49. <para>Applications set the <structfield>type</structfield> field
  50. of a &v4l2-buffer; to the same buffer type as was previously used with
  51. &v4l2-format; <structfield>type</structfield> and &v4l2-requestbuffers;
  52. <structfield>type</structfield>, and the <structfield>index</structfield>
  53. field. Valid index numbers range from zero
  54. to the number of buffers allocated with &VIDIOC-REQBUFS;
  55. (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.
  56. The <structfield>reserved</structfield> and <structfield>reserved2 </structfield>
  57. fields must be set to 0.
  58. When using the <link linkend="planar-apis">multi-planar API</link>, the
  59. <structfield>m.planes</structfield> field must contain a userspace pointer to an
  60. array of &v4l2-plane; and the <structfield>length</structfield> field has
  61. to be set to the number of elements in that array.
  62. After calling <constant>VIDIOC_QUERYBUF</constant> with a pointer to
  63. this structure drivers return an error code or fill the rest of
  64. the structure.</para>
  65. <para>In the <structfield>flags</structfield> field the
  66. <constant>V4L2_BUF_FLAG_MAPPED</constant>,
  67. <constant>V4L2_BUF_FLAG_PREPARED</constant>,
  68. <constant>V4L2_BUF_FLAG_QUEUED</constant> and
  69. <constant>V4L2_BUF_FLAG_DONE</constant> flags will be valid. The
  70. <structfield>memory</structfield> field will be set to the current
  71. I/O method. For the single-planar API, the <structfield>m.offset</structfield>
  72. contains the offset of the buffer from the start of the device memory,
  73. the <structfield>length</structfield> field its size. For the multi-planar API,
  74. fields <structfield>m.mem_offset</structfield> and
  75. <structfield>length</structfield> in the <structfield>m.planes</structfield>
  76. array elements will be used instead and the <structfield>length</structfield>
  77. field of &v4l2-buffer; is set to the number of filled-in array elements.
  78. The driver may or may not set the remaining fields and flags, they are
  79. meaningless in this context.</para>
  80. <para>The <structname>v4l2_buffer</structname> structure is
  81. specified in <xref linkend="buffer" />.</para>
  82. </refsect1>
  83. <refsect1>
  84. &return-value;
  85. <variablelist>
  86. <varlistentry>
  87. <term><errorcode>EINVAL</errorcode></term>
  88. <listitem>
  89. <para>The buffer <structfield>type</structfield> is not
  90. supported, or the <structfield>index</structfield> is out of bounds.</para>
  91. </listitem>
  92. </varlistentry>
  93. </variablelist>
  94. </refsect1>
  95. </refentry>