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