vidioc-decoder-cmd.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <refentry id="vidioc-decoder-cmd">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_DECODER_CMD</refname>
  8. <refname>VIDIOC_TRY_DECODER_CMD</refname>
  9. <refpurpose>Execute an decoder 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_decoder_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_DECODER_CMD, VIDIOC_TRY_DECODER_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-) decoder.
  52. <constant>VIDIOC_DECODER_CMD</constant> sends a command to the
  53. decoder, <constant>VIDIOC_TRY_DECODER_CMD</constant> can be used to
  54. try a command without actually executing it. To send a command applications
  55. must initialize all fields of a &v4l2-decoder-cmd; and call
  56. <constant>VIDIOC_DECODER_CMD</constant> or <constant>VIDIOC_TRY_DECODER_CMD</constant>
  57. with a pointer to this structure.</para>
  58. <para>The <structfield>cmd</structfield> field must contain the
  59. command code. Some commands use the <structfield>flags</structfield> field for
  60. additional information.
  61. </para>
  62. <para>A <function>write</function>() or &VIDIOC-STREAMON; call sends an implicit
  63. START command to the decoder if it has not been started yet.
  64. </para>
  65. <para>A <function>close</function>() or &VIDIOC-STREAMOFF; call of a streaming
  66. file descriptor sends an implicit immediate STOP command to the decoder, and all
  67. buffered data is discarded.</para>
  68. <para>These ioctls are optional, not all drivers may support
  69. them. They were introduced in Linux 3.3.</para>
  70. <table pgwide="1" frame="none" id="v4l2-decoder-cmd">
  71. <title>struct <structname>v4l2_decoder_cmd</structname></title>
  72. <tgroup cols="5">
  73. &cs-str;
  74. <tbody valign="top">
  75. <row>
  76. <entry>__u32</entry>
  77. <entry><structfield>cmd</structfield></entry>
  78. <entry></entry>
  79. <entry></entry>
  80. <entry>The decoder command, see <xref linkend="decoder-cmds" />.</entry>
  81. </row>
  82. <row>
  83. <entry>__u32</entry>
  84. <entry><structfield>flags</structfield></entry>
  85. <entry></entry>
  86. <entry></entry>
  87. <entry>Flags to go with the command. If no flags are defined for
  88. this command, drivers and applications must set this field to zero.</entry>
  89. </row>
  90. <row>
  91. <entry>union</entry>
  92. <entry>(anonymous)</entry>
  93. <entry></entry>
  94. <entry></entry>
  95. <entry></entry>
  96. </row>
  97. <row>
  98. <entry></entry>
  99. <entry>struct</entry>
  100. <entry><structfield>start</structfield></entry>
  101. <entry></entry>
  102. <entry>Structure containing additional data for the
  103. <constant>V4L2_DEC_CMD_START</constant> command.</entry>
  104. </row>
  105. <row>
  106. <entry></entry>
  107. <entry></entry>
  108. <entry>__s32</entry>
  109. <entry><structfield>speed</structfield></entry>
  110. <entry>Playback speed and direction. The playback speed is defined as
  111. <structfield>speed</structfield>/1000 of the normal speed. So 1000 is normal playback.
  112. Negative numbers denote reverse playback, so -1000 does reverse playback at normal
  113. speed. Speeds -1, 0 and 1 have special meanings: speed 0 is shorthand for 1000
  114. (normal playback). A speed of 1 steps just one frame forward, a speed of -1 steps
  115. just one frame back.
  116. </entry>
  117. </row>
  118. <row>
  119. <entry></entry>
  120. <entry></entry>
  121. <entry>__u32</entry>
  122. <entry><structfield>format</structfield></entry>
  123. <entry>Format restrictions. This field is set by the driver, not the
  124. application. Possible values are <constant>V4L2_DEC_START_FMT_NONE</constant> if
  125. there are no format restrictions or <constant>V4L2_DEC_START_FMT_GOP</constant>
  126. if the decoder operates on full GOPs (<wordasword>Group Of Pictures</wordasword>).
  127. This is usually the case for reverse playback: the decoder needs full GOPs, which
  128. it can then play in reverse order. So to implement reverse playback the application
  129. must feed the decoder the last GOP in the video file, then the GOP before that, etc. etc.
  130. </entry>
  131. </row>
  132. <row>
  133. <entry></entry>
  134. <entry>struct</entry>
  135. <entry><structfield>stop</structfield></entry>
  136. <entry></entry>
  137. <entry>Structure containing additional data for the
  138. <constant>V4L2_DEC_CMD_STOP</constant> command.</entry>
  139. </row>
  140. <row>
  141. <entry></entry>
  142. <entry></entry>
  143. <entry>__u64</entry>
  144. <entry><structfield>pts</structfield></entry>
  145. <entry>Stop playback at this <structfield>pts</structfield> or immediately
  146. if the playback is already past that timestamp. Leave to 0 if you want to stop after the
  147. last frame was decoded.
  148. </entry>
  149. </row>
  150. <row>
  151. <entry></entry>
  152. <entry>struct</entry>
  153. <entry><structfield>raw</structfield></entry>
  154. <entry></entry>
  155. <entry></entry>
  156. </row>
  157. <row>
  158. <entry></entry>
  159. <entry></entry>
  160. <entry>__u32</entry>
  161. <entry><structfield>data</structfield>[16]</entry>
  162. <entry>Reserved for future extensions. Drivers and
  163. applications must set the array to zero.</entry>
  164. </row>
  165. </tbody>
  166. </tgroup>
  167. </table>
  168. <table pgwide="1" frame="none" id="decoder-cmds">
  169. <title>Decoder Commands</title>
  170. <tgroup cols="3">
  171. &cs-def;
  172. <tbody valign="top">
  173. <row>
  174. <entry><constant>V4L2_DEC_CMD_START</constant></entry>
  175. <entry>0</entry>
  176. <entry>Start the decoder. When the decoder is already
  177. running or paused, this command will just change the playback speed.
  178. That means that calling <constant>V4L2_DEC_CMD_START</constant> when
  179. the decoder was paused will <emphasis>not</emphasis> resume the decoder.
  180. You have to explicitly call <constant>V4L2_DEC_CMD_RESUME</constant> for that.
  181. This command has one flag:
  182. <constant>V4L2_DEC_CMD_START_MUTE_AUDIO</constant>. If set, then audio will
  183. be muted when playing back at a non-standard speed.
  184. </entry>
  185. </row>
  186. <row>
  187. <entry><constant>V4L2_DEC_CMD_STOP</constant></entry>
  188. <entry>1</entry>
  189. <entry>Stop the decoder. When the decoder is already stopped,
  190. this command does nothing. This command has two flags:
  191. if <constant>V4L2_DEC_CMD_STOP_TO_BLACK</constant> is set, then the decoder will
  192. set the picture to black after it stopped decoding. Otherwise the last image will
  193. repeat. If <constant>V4L2_DEC_CMD_STOP_IMMEDIATELY</constant> is set, then the decoder
  194. stops immediately (ignoring the <structfield>pts</structfield> value), otherwise it
  195. will keep decoding until timestamp >= pts or until the last of the pending data from
  196. its internal buffers was decoded.
  197. </entry>
  198. </row>
  199. <row>
  200. <entry><constant>V4L2_DEC_CMD_PAUSE</constant></entry>
  201. <entry>2</entry>
  202. <entry>Pause the decoder. When the decoder has not been
  203. started yet, the driver will return an &EPERM;. When the decoder is
  204. already paused, this command does nothing. This command has one flag:
  205. if <constant>V4L2_DEC_CMD_PAUSE_TO_BLACK</constant> is set, then set the
  206. decoder output to black when paused.
  207. </entry>
  208. </row>
  209. <row>
  210. <entry><constant>V4L2_DEC_CMD_RESUME</constant></entry>
  211. <entry>3</entry>
  212. <entry>Resume decoding after a PAUSE command. When the
  213. decoder has not been started yet, the driver will return an &EPERM;.
  214. When the decoder is already running, this command does nothing. No
  215. flags are defined for this command.</entry>
  216. </row>
  217. </tbody>
  218. </tgroup>
  219. </table>
  220. </refsect1>
  221. <refsect1>
  222. &return-value;
  223. <variablelist>
  224. <varlistentry>
  225. <term><errorcode>EINVAL</errorcode></term>
  226. <listitem>
  227. <para>The <structfield>cmd</structfield> field is invalid.</para>
  228. </listitem>
  229. </varlistentry>
  230. <varlistentry>
  231. <term><errorcode>EPERM</errorcode></term>
  232. <listitem>
  233. <para>The application sent a PAUSE or RESUME command when
  234. the decoder was not running.</para>
  235. </listitem>
  236. </varlistentry>
  237. </variablelist>
  238. </refsect1>
  239. </refentry>