vidioc-enum-fmt.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <refentry id="vidioc-enum-fmt">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_ENUM_FMT</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_ENUM_FMT</refname>
  8. <refpurpose>Enumerate image formats</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_fmtdesc
  17. *<parameter>argp</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. </refsynopsisdiv>
  21. <refsect1>
  22. <title>Arguments</title>
  23. <variablelist>
  24. <varlistentry>
  25. <term><parameter>fd</parameter></term>
  26. <listitem>
  27. <para>&fd;</para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term><parameter>request</parameter></term>
  32. <listitem>
  33. <para>VIDIOC_ENUM_FMT</para>
  34. </listitem>
  35. </varlistentry>
  36. <varlistentry>
  37. <term><parameter>argp</parameter></term>
  38. <listitem>
  39. <para></para>
  40. </listitem>
  41. </varlistentry>
  42. </variablelist>
  43. </refsect1>
  44. <refsect1>
  45. <title>Description</title>
  46. <para>To enumerate image formats applications initialize the
  47. <structfield>type</structfield> and <structfield>index</structfield>
  48. field of &v4l2-fmtdesc; and call the
  49. <constant>VIDIOC_ENUM_FMT</constant> ioctl with a pointer to this
  50. structure. Drivers fill the rest of the structure or return an
  51. &EINVAL;. All formats are enumerable by beginning at index zero and
  52. incrementing by one until <errorcode>EINVAL</errorcode> is
  53. returned.</para>
  54. <para>Note that after switching input or output the list of enumerated image
  55. formats may be different.</para>
  56. <table pgwide="1" frame="none" id="v4l2-fmtdesc">
  57. <title>struct <structname>v4l2_fmtdesc</structname></title>
  58. <tgroup cols="3">
  59. &cs-str;
  60. <tbody valign="top">
  61. <row>
  62. <entry>__u32</entry>
  63. <entry><structfield>index</structfield></entry>
  64. <entry>Number of the format in the enumeration, set by
  65. the application. This is in no way related to the <structfield>
  66. pixelformat</structfield> field.</entry>
  67. </row>
  68. <row>
  69. <entry>__u32</entry>
  70. <entry><structfield>type</structfield></entry>
  71. <entry>Type of the data stream, set by the application.
  72. Only these types are valid here:
  73. <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
  74. <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE</constant>,
  75. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
  76. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>,
  77. <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
  78. defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
  79. and higher. See <xref linkend="v4l2-buf-type" />.</entry>
  80. </row>
  81. <row>
  82. <entry>__u32</entry>
  83. <entry><structfield>flags</structfield></entry>
  84. <entry>See <xref linkend="fmtdesc-flags" /></entry>
  85. </row>
  86. <row>
  87. <entry>__u8</entry>
  88. <entry><structfield>description</structfield>[32]</entry>
  89. <entry>Description of the format, a NUL-terminated ASCII
  90. string. This information is intended for the user, for example: "YUV
  91. 4:2:2".</entry>
  92. </row>
  93. <row>
  94. <entry>__u32</entry>
  95. <entry><structfield>pixelformat</structfield></entry>
  96. <entry>The image format identifier. This is a
  97. four character code as computed by the v4l2_fourcc()
  98. macro:</entry>
  99. </row>
  100. <row>
  101. <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
  102. #define v4l2_fourcc(a,b,c,d) (((__u32)(a)&lt;&lt;0)|((__u32)(b)&lt;&lt;8)|((__u32)(c)&lt;&lt;16)|((__u32)(d)&lt;&lt;24))
  103. </programlisting></para><para>Several image formats are already
  104. defined by this specification in <xref linkend="pixfmt" />. Note these
  105. codes are not the same as those used in the Windows world.</para></entry>
  106. </row>
  107. <row>
  108. <entry>__u32</entry>
  109. <entry><structfield>reserved</structfield>[4]</entry>
  110. <entry>Reserved for future extensions. Drivers must set
  111. the array to zero.</entry>
  112. </row>
  113. </tbody>
  114. </tgroup>
  115. </table>
  116. <table pgwide="1" frame="none" id="fmtdesc-flags">
  117. <title>Image Format Description Flags</title>
  118. <tgroup cols="3">
  119. &cs-def;
  120. <tbody valign="top">
  121. <row>
  122. <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
  123. <entry>0x0001</entry>
  124. <entry>This is a compressed format.</entry>
  125. </row>
  126. <row>
  127. <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
  128. <entry>0x0002</entry>
  129. <entry>This format is not native to the device but emulated
  130. through software (usually libv4l2), where possible try to use a native format
  131. instead for better performance.</entry>
  132. </row>
  133. </tbody>
  134. </tgroup>
  135. </table>
  136. </refsect1>
  137. <refsect1>
  138. &return-value;
  139. <variablelist>
  140. <varlistentry>
  141. <term><errorcode>EINVAL</errorcode></term>
  142. <listitem>
  143. <para>The &v4l2-fmtdesc; <structfield>type</structfield>
  144. is not supported or the <structfield>index</structfield> is out of
  145. bounds.</para>
  146. </listitem>
  147. </varlistentry>
  148. </variablelist>
  149. </refsect1>
  150. </refentry>