vidioc-enum-fmt.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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> and
  77. <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>. See <xref linkend="v4l2-buf-type" />.</entry>
  78. </row>
  79. <row>
  80. <entry>__u32</entry>
  81. <entry><structfield>flags</structfield></entry>
  82. <entry>See <xref linkend="fmtdesc-flags" /></entry>
  83. </row>
  84. <row>
  85. <entry>__u8</entry>
  86. <entry><structfield>description</structfield>[32]</entry>
  87. <entry>Description of the format, a NUL-terminated ASCII
  88. string. This information is intended for the user, for example: "YUV
  89. 4:2:2".</entry>
  90. </row>
  91. <row>
  92. <entry>__u32</entry>
  93. <entry><structfield>pixelformat</structfield></entry>
  94. <entry>The image format identifier. This is a
  95. four character code as computed by the v4l2_fourcc()
  96. macro:</entry>
  97. </row>
  98. <row>
  99. <entry spanname="hspan"><para><programlisting id="v4l2-fourcc">
  100. #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))
  101. </programlisting></para><para>Several image formats are already
  102. defined by this specification in <xref linkend="pixfmt" />. Note these
  103. codes are not the same as those used in the Windows world.</para></entry>
  104. </row>
  105. <row>
  106. <entry>__u32</entry>
  107. <entry><structfield>reserved</structfield>[4]</entry>
  108. <entry>Reserved for future extensions. Drivers must set
  109. the array to zero.</entry>
  110. </row>
  111. </tbody>
  112. </tgroup>
  113. </table>
  114. <table pgwide="1" frame="none" id="fmtdesc-flags">
  115. <title>Image Format Description Flags</title>
  116. <tgroup cols="3">
  117. &cs-def;
  118. <tbody valign="top">
  119. <row>
  120. <entry><constant>V4L2_FMT_FLAG_COMPRESSED</constant></entry>
  121. <entry>0x0001</entry>
  122. <entry>This is a compressed format.</entry>
  123. </row>
  124. <row>
  125. <entry><constant>V4L2_FMT_FLAG_EMULATED</constant></entry>
  126. <entry>0x0002</entry>
  127. <entry>This format is not native to the device but emulated
  128. through software (usually libv4l2), where possible try to use a native format
  129. instead for better performance.</entry>
  130. </row>
  131. </tbody>
  132. </tgroup>
  133. </table>
  134. </refsect1>
  135. <refsect1>
  136. &return-value;
  137. <variablelist>
  138. <varlistentry>
  139. <term><errorcode>EINVAL</errorcode></term>
  140. <listitem>
  141. <para>The &v4l2-fmtdesc; <structfield>type</structfield>
  142. is not supported or the <structfield>index</structfield> is out of
  143. bounds.</para>
  144. </listitem>
  145. </varlistentry>
  146. </variablelist>
  147. </refsect1>
  148. </refentry>