vidioc-encoder-cmd.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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>() or &VIDIOC-STREAMON; call sends an implicit
  67. START command to 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>() or &VIDIOC-STREAMOFF; call of a streaming
  73. file descriptor sends an implicit immediate STOP to the encoder, and all buffered
  74. data is discarded.</para>
  75. <para>These ioctls are optional, not all drivers may support
  76. them. They were introduced in Linux 2.6.21.</para>
  77. <table pgwide="1" frame="none" id="v4l2-encoder-cmd">
  78. <title>struct <structname>v4l2_encoder_cmd</structname></title>
  79. <tgroup cols="3">
  80. &cs-str;
  81. <tbody valign="top">
  82. <row>
  83. <entry>__u32</entry>
  84. <entry><structfield>cmd</structfield></entry>
  85. <entry>The encoder command, see <xref linkend="encoder-cmds" />.</entry>
  86. </row>
  87. <row>
  88. <entry>__u32</entry>
  89. <entry><structfield>flags</structfield></entry>
  90. <entry>Flags to go with the command, see <xref
  91. linkend="encoder-flags" />. If no flags are defined for
  92. this command, drivers and applications must set this field to
  93. zero.</entry>
  94. </row>
  95. <row>
  96. <entry>__u32</entry>
  97. <entry><structfield>data</structfield>[8]</entry>
  98. <entry>Reserved for future extensions. Drivers and
  99. applications must set the array to zero.</entry>
  100. </row>
  101. </tbody>
  102. </tgroup>
  103. </table>
  104. <table pgwide="1" frame="none" id="encoder-cmds">
  105. <title>Encoder Commands</title>
  106. <tgroup cols="3">
  107. &cs-def;
  108. <tbody valign="top">
  109. <row>
  110. <entry><constant>V4L2_ENC_CMD_START</constant></entry>
  111. <entry>0</entry>
  112. <entry>Start the encoder. When the encoder is already
  113. running or paused, this command does nothing. No flags are defined for
  114. this command.</entry>
  115. </row>
  116. <row>
  117. <entry><constant>V4L2_ENC_CMD_STOP</constant></entry>
  118. <entry>1</entry>
  119. <entry>Stop the encoder. When the
  120. <constant>V4L2_ENC_CMD_STOP_AT_GOP_END</constant> flag is set,
  121. encoding will continue until the end of the current <wordasword>Group
  122. Of Pictures</wordasword>, otherwise encoding will stop immediately.
  123. When the encoder is already stopped, this command does
  124. nothing.</entry>
  125. </row>
  126. <row>
  127. <entry><constant>V4L2_ENC_CMD_PAUSE</constant></entry>
  128. <entry>2</entry>
  129. <entry>Pause the encoder. When the encoder has not been
  130. started yet, the driver will return an &EPERM;. When the encoder is
  131. already paused, this command does nothing. No flags are defined for
  132. this command.</entry>
  133. </row>
  134. <row>
  135. <entry><constant>V4L2_ENC_CMD_RESUME</constant></entry>
  136. <entry>3</entry>
  137. <entry>Resume encoding after a PAUSE command. When the
  138. encoder has not been started yet, the driver will return an &EPERM;.
  139. When the encoder is already running, this command does nothing. No
  140. flags are defined for this command.</entry>
  141. </row>
  142. </tbody>
  143. </tgroup>
  144. </table>
  145. <table pgwide="1" frame="none" id="encoder-flags">
  146. <title>Encoder Command Flags</title>
  147. <tgroup cols="3">
  148. &cs-def;
  149. <tbody valign="top">
  150. <row>
  151. <entry><constant>V4L2_ENC_CMD_STOP_AT_GOP_END</constant></entry>
  152. <entry>0x0001</entry>
  153. <entry>Stop encoding at the end of the current <wordasword>Group Of
  154. Pictures</wordasword>, rather than immediately.</entry>
  155. </row>
  156. </tbody>
  157. </tgroup>
  158. </table>
  159. </refsect1>
  160. <refsect1>
  161. &return-value;
  162. <variablelist>
  163. <varlistentry>
  164. <term><errorcode>EINVAL</errorcode></term>
  165. <listitem>
  166. <para>The <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>