vidioc-encoder-cmd.xml 6.1 KB

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