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