vidioc-encoder-cmd.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <refentry id="vidioc-encoder-cmd">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_ENCODER_CMD</refname>
  8. <refname>VIDIOC_TRY_ENCODER_CMD</refname>
  9. <refpurpose>Execute an encoder command</refpurpose>
  10. </refnamediv>
  11. <refsynopsisdiv>
  12. <funcsynopsis>
  13. <funcprototype>
  14. <funcdef>int <function>ioctl</function></funcdef>
  15. <paramdef>int <parameter>fd</parameter></paramdef>
  16. <paramdef>int <parameter>request</parameter></paramdef>
  17. <paramdef>struct v4l2_encoder_cmd *<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_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD</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. <note>
  47. <title>Experimental</title>
  48. <para>This is an <link linkend="experimental">experimental</link>
  49. interface and may change in the future.</para>
  50. </note>
  51. <para>These ioctls control an audio/video (usually MPEG-) encoder.
  52. <constant>VIDIOC_ENCODER_CMD</constant> sends a command to the
  53. encoder, <constant>VIDIOC_TRY_ENCODER_CMD</constant> can be used to
  54. try a command without actually executing it.</para>
  55. <para>To send a command applications must initialize all fields of a
  56. &v4l2-encoder-cmd; and call
  57. <constant>VIDIOC_ENCODER_CMD</constant> or
  58. <constant>VIDIOC_TRY_ENCODER_CMD</constant> with a pointer to this
  59. structure.</para>
  60. <para>The <structfield>cmd</structfield> field must contain the
  61. command code. The <structfield>flags</structfield> field is currently
  62. only used by the STOP command and contains one bit: If the
  63. <constant>V4L2_ENC_CMD_STOP_AT_GOP_END</constant> flag is set,
  64. encoding will continue until the end of the current <wordasword>Group
  65. Of Pictures</wordasword>, otherwise it will stop immediately.</para>
  66. <para>A <function>read</function>() call sends a START command to
  67. the encoder if it has not been started yet. After a STOP command,
  68. <function>read</function>() calls will read the remaining data
  69. buffered by the driver. When the buffer is empty,
  70. <function>read</function>() will return zero and the next
  71. <function>read</function>() call will restart the encoder.</para>
  72. <para>A <function>close</function>() call sends an immediate STOP
  73. to the encoder, and all buffered data is discarded.</para>
  74. <para>These ioctls are optional, not all drivers may support
  75. them. They were introduced in Linux 2.6.21.</para>
  76. <table pgwide="1" frame="none" id="v4l2-encoder-cmd">
  77. <title>struct <structname>v4l2_encoder_cmd</structname></title>
  78. <tgroup cols="3">
  79. &cs-str;
  80. <tbody valign="top">
  81. <row>
  82. <entry>__u32</entry>
  83. <entry><structfield>cmd</structfield></entry>
  84. <entry>The encoder command, see <xref linkend="encoder-cmds" />.</entry>
  85. </row>
  86. <row>
  87. <entry>__u32</entry>
  88. <entry><structfield>flags</structfield></entry>
  89. <entry>Flags to go with the command, see <xref
  90. linkend="encoder-flags" />. If no flags are defined for
  91. this command, drivers and applications must set this field to
  92. zero.</entry>
  93. </row>
  94. <row>
  95. <entry>__u32</entry>
  96. <entry><structfield>data</structfield>[8]</entry>
  97. <entry>Reserved for future extensions. Drivers and
  98. applications must set the array to zero.</entry>
  99. </row>
  100. </tbody>
  101. </tgroup>
  102. </table>
  103. <table pgwide="1" frame="none" id="encoder-cmds">
  104. <title>Encoder Commands</title>
  105. <tgroup cols="3">
  106. &cs-def;
  107. <tbody valign="top">
  108. <row>
  109. <entry><constant>V4L2_ENC_CMD_START</constant></entry>
  110. <entry>0</entry>
  111. <entry>Start the encoder. When the encoder is already
  112. running or paused, this command does nothing. No flags are defined for
  113. this command.</entry>
  114. </row>
  115. <row>
  116. <entry><constant>V4L2_ENC_CMD_STOP</constant></entry>
  117. <entry>1</entry>
  118. <entry>Stop the encoder. When the
  119. <constant>V4L2_ENC_CMD_STOP_AT_GOP_END</constant> flag is set,
  120. encoding will continue until the end of the current <wordasword>Group
  121. Of Pictures</wordasword>, otherwise encoding will stop immediately.
  122. When the encoder is already stopped, this command does
  123. nothing.</entry>
  124. </row>
  125. <row>
  126. <entry><constant>V4L2_ENC_CMD_PAUSE</constant></entry>
  127. <entry>2</entry>
  128. <entry>Pause the encoder. When the encoder has not been
  129. started yet, the driver will return an &EPERM;. When the encoder is
  130. already paused, this command does nothing. No flags are defined for
  131. this command.</entry>
  132. </row>
  133. <row>
  134. <entry><constant>V4L2_ENC_CMD_RESUME</constant></entry>
  135. <entry>3</entry>
  136. <entry>Resume encoding after a PAUSE command. When the
  137. encoder has not been started yet, the driver will return an &EPERM;.
  138. When the encoder is already running, this command does nothing. No
  139. flags are defined for this command.</entry>
  140. </row>
  141. </tbody>
  142. </tgroup>
  143. </table>
  144. <table pgwide="1" frame="none" id="encoder-flags">
  145. <title>Encoder Command Flags</title>
  146. <tgroup cols="3">
  147. &cs-def;
  148. <tbody valign="top">
  149. <row>
  150. <entry><constant>V4L2_ENC_CMD_STOP_AT_GOP_END</constant></entry>
  151. <entry>0x0001</entry>
  152. <entry>Stop encoding at the end of the current <wordasword>Group Of
  153. Pictures</wordasword>, rather than immediately.</entry>
  154. </row>
  155. </tbody>
  156. </tgroup>
  157. </table>
  158. </refsect1>
  159. <refsect1>
  160. &return-value;
  161. <variablelist>
  162. <varlistentry>
  163. <term><errorcode>EINVAL</errorcode></term>
  164. <listitem>
  165. <para>The driver does not support this ioctl, or the
  166. <structfield>cmd</structfield> field is invalid.</para>
  167. </listitem>
  168. </varlistentry>
  169. <varlistentry>
  170. <term><errorcode>EPERM</errorcode></term>
  171. <listitem>
  172. <para>The application sent a PAUSE or RESUME command when
  173. the encoder was not running.</para>
  174. </listitem>
  175. </varlistentry>
  176. </variablelist>
  177. </refsect1>
  178. </refentry>
  179. <!--
  180. Local Variables:
  181. mode: sgml
  182. sgml-parent-document: "v4l2.sgml"
  183. indent-tabs-mode: nil
  184. End:
  185. -->