vidioc-enum-fmt.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. <table pgwide="1" frame="none" id="v4l2-fmtdesc">
  55. <title>struct <structname>v4l2_fmtdesc</structname></title>
  56. <tgroup cols="3">
  57. &cs-str;
  58. <tbody valign="top">
  59. <row>
  60. <entry>__u32</entry>
  61. <entry><structfield>index</structfield></entry>
  62. <entry>Number of the format in the enumeration, set by
  63. the application. This is in no way related to the <structfield>
  64. pixelformat</structfield> field.</entry>
  65. </row>
  66. <row>
  67. <entry>&v4l2-buf-type;</entry>
  68. <entry><structfield>type</structfield></entry>
  69. <entry>Type of the data stream, set by the application.
  70. Only these types are valid here:
  71. <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
  72. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
  73. <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
  74. defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
  75. and higher.</entry>
  76. </row>
  77. <row>
  78. <entry>__u32</entry>
  79. <entry><structfield>flags</structfield></entry>
  80. <entry>See <xref linkend="fmtdesc-flags" /></entry>
  81. </row>
  82. <row>
  83. <entry>__u8</entry>
  84. <entry><structfield>description</structfield>[32]</entry>
  85. <entry>Description of the format, a NUL-terminated ASCII
  86. string. This information is intended for the user, for example: "YUV
  87. 4:2:2".</entry>
  88. </row>
  89. <row>
  90. <entry>__u32</entry>
  91. <entry><structfield>pixelformat</structfield></entry>
  92. <entry>The image format identifier. This is a
  93. four character code as computed by the v4l2_fourcc()
  94. macro:</entry>
  95. </row>
  96. <row>
  97. <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
  98. #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))
  99. </programlisting></para><para>Several image formats are already
  100. defined by this specification in <xref linkend="pixfmt" />. Note these
  101. codes are not the same as those used in the Windows world.</para></entry>
  102. </row>
  103. <row>
  104. <entry>__u32</entry>
  105. <entry><structfield>reserved</structfield>[4]</entry>
  106. <entry>Reserved for future extensions. Drivers must set
  107. the array to zero.</entry>
  108. </row>
  109. </tbody>
  110. </tgroup>
  111. </table>
  112. <table pgwide="1" frame="none" id="fmtdesc-flags">
  113. <title>Image Format Description Flags</title>
  114. <tgroup cols="3">
  115. &cs-def;
  116. <tbody valign="top">
  117. <row>
  118. <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
  119. <entry>0x0001</entry>
  120. <entry>This is a compressed format.</entry>
  121. </row>
  122. <row>
  123. <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
  124. <entry>0x0002</entry>
  125. <entry>This format is not native to the device but emulated
  126. through software (usually libv4l2), where possible try to use a native format
  127. instead for better performance.</entry>
  128. </row>
  129. </tbody>
  130. </tgroup>
  131. </table>
  132. </refsect1>
  133. <refsect1>
  134. &return-value;
  135. <variablelist>
  136. <varlistentry>
  137. <term><errorcode>EINVAL</errorcode></term>
  138. <listitem>
  139. <para>The &v4l2-fmtdesc; <structfield>type</structfield>
  140. is not supported or the <structfield>index</structfield> is out of
  141. bounds.</para>
  142. </listitem>
  143. </varlistentry>
  144. </variablelist>
  145. </refsect1>
  146. </refentry>
  147. <!--
  148. Local Variables:
  149. mode: sgml
  150. sgml-parent-document: "v4l2.sgml"
  151. indent-tabs-mode: nil
  152. End:
  153. -->