~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/media/v4l/vidioc-decoder-cmd.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/media/v4l/vidioc-decoder-cmd.rst (Architecture ppc) and /Documentation/userspace-api/media/v4l/vidioc-decoder-cmd.rst (Architecture i386)


  1 .. SPDX-License-Identifier: GFDL-1.1-no-invari      1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2 .. c:namespace:: V4L                                2 .. c:namespace:: V4L
  3                                                     3 
  4 .. _VIDIOC_DECODER_CMD:                             4 .. _VIDIOC_DECODER_CMD:
  5                                                     5 
  6 **********************************************      6 ************************************************
  7 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_C      7 ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD
  8 **********************************************      8 ************************************************
  9                                                     9 
 10 Name                                               10 Name
 11 ====                                               11 ====
 12                                                    12 
 13 VIDIOC_DECODER_CMD - VIDIOC_TRY_DECODER_CMD -      13 VIDIOC_DECODER_CMD - VIDIOC_TRY_DECODER_CMD - Execute an decoder command
 14                                                    14 
 15 Synopsis                                           15 Synopsis
 16 ========                                           16 ========
 17                                                    17 
 18 .. c:macro:: VIDIOC_DECODER_CMD                    18 .. c:macro:: VIDIOC_DECODER_CMD
 19                                                    19 
 20 ``int ioctl(int fd, VIDIOC_DECODER_CMD, struct     20 ``int ioctl(int fd, VIDIOC_DECODER_CMD, struct v4l2_decoder_cmd *argp)``
 21                                                    21 
 22 .. c:macro:: VIDIOC_TRY_DECODER_CMD                22 .. c:macro:: VIDIOC_TRY_DECODER_CMD
 23                                                    23 
 24 ``int ioctl(int fd, VIDIOC_TRY_DECODER_CMD, st     24 ``int ioctl(int fd, VIDIOC_TRY_DECODER_CMD, struct v4l2_decoder_cmd *argp)``
 25                                                    25 
 26 Arguments                                          26 Arguments
 27 =========                                          27 =========
 28                                                    28 
 29 ``fd``                                             29 ``fd``
 30     File descriptor returned by :c:func:`open(     30     File descriptor returned by :c:func:`open()`.
 31                                                    31 
 32 ``argp``                                           32 ``argp``
 33     pointer to struct :c:type:`v4l2_decoder_cm     33     pointer to struct :c:type:`v4l2_decoder_cmd`.
 34                                                    34 
 35 Description                                        35 Description
 36 ===========                                        36 ===========
 37                                                    37 
 38 These ioctls control an audio/video (usually M     38 These ioctls control an audio/video (usually MPEG-) decoder.
 39 ``VIDIOC_DECODER_CMD`` sends a command to the      39 ``VIDIOC_DECODER_CMD`` sends a command to the decoder,
 40 ``VIDIOC_TRY_DECODER_CMD`` can be used to try      40 ``VIDIOC_TRY_DECODER_CMD`` can be used to try a command without actually
 41 executing it. To send a command applications m     41 executing it. To send a command applications must initialize all fields
 42 of a struct :c:type:`v4l2_decoder_cmd` and cal     42 of a struct :c:type:`v4l2_decoder_cmd` and call
 43 ``VIDIOC_DECODER_CMD`` or ``VIDIOC_TRY_DECODER     43 ``VIDIOC_DECODER_CMD`` or ``VIDIOC_TRY_DECODER_CMD`` with a pointer to
 44 this structure.                                    44 this structure.
 45                                                    45 
 46 The ``cmd`` field must contain the command cod     46 The ``cmd`` field must contain the command code. Some commands use the
 47 ``flags`` field for additional information.        47 ``flags`` field for additional information.
 48                                                    48 
 49 A :c:func:`write()` or :ref:`VIDIOC_STREAMON`      49 A :c:func:`write()` or :ref:`VIDIOC_STREAMON`
 50 call sends an implicit START command to the de     50 call sends an implicit START command to the decoder if it has not been
 51 started yet. Applies to both queues of mem2mem     51 started yet. Applies to both queues of mem2mem decoders.
 52                                                    52 
 53 A :c:func:`close()` or :ref:`VIDIOC_STREAMOFF      53 A :c:func:`close()` or :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>`
 54 call of a streaming file descriptor sends an i     54 call of a streaming file descriptor sends an implicit immediate STOP
 55 command to the decoder, and all buffered data      55 command to the decoder, and all buffered data is discarded. Applies to both
 56 queues of mem2mem decoders.                        56 queues of mem2mem decoders.
 57                                                    57 
 58 In principle, these ioctls are optional, not a     58 In principle, these ioctls are optional, not all drivers may support them. They were
 59 introduced in Linux 3.3. They are, however, ma     59 introduced in Linux 3.3. They are, however, mandatory for stateful mem2mem decoders
 60 (as further documented in :ref:`decoder`).         60 (as further documented in :ref:`decoder`).
 61                                                    61 
 62 .. tabularcolumns:: |p{2.0cm}|p{1.1cm}|p{2.2cm     62 .. tabularcolumns:: |p{2.0cm}|p{1.1cm}|p{2.2cm}|p{11.8cm}|
 63                                                    63 
 64 .. c:type:: v4l2_decoder_cmd                       64 .. c:type:: v4l2_decoder_cmd
 65                                                    65 
 66 .. cssclass:: longtable                            66 .. cssclass:: longtable
 67                                                    67 
 68 .. flat-table:: struct v4l2_decoder_cmd            68 .. flat-table:: struct v4l2_decoder_cmd
 69     :header-rows:  0                               69     :header-rows:  0
 70     :stub-columns: 0                               70     :stub-columns: 0
 71     :widths: 1 1 1 3                               71     :widths: 1 1 1 3
 72                                                    72 
 73     * - __u32                                      73     * - __u32
 74       - ``cmd``                                    74       - ``cmd``
 75       -                                            75       -
 76       - The decoder command, see :ref:`decoder     76       - The decoder command, see :ref:`decoder-cmds`.
 77     * - __u32                                      77     * - __u32
 78       - ``flags``                                  78       - ``flags``
 79       -                                            79       -
 80       - Flags to go with the command. If no fl     80       - Flags to go with the command. If no flags are defined for this
 81         command, drivers and applications must     81         command, drivers and applications must set this field to zero.
 82     * - union {                                    82     * - union {
 83       - (anonymous)                                83       - (anonymous)
 84     * - struct                                     84     * - struct
 85       - ``start``                                  85       - ``start``
 86       -                                            86       -
 87       - Structure containing additional data f     87       - Structure containing additional data for the
 88         ``V4L2_DEC_CMD_START`` command.            88         ``V4L2_DEC_CMD_START`` command.
 89     * -                                            89     * -
 90       - __s32                                      90       - __s32
 91       - ``speed``                                  91       - ``speed``
 92       - Playback speed and direction. The play     92       - Playback speed and direction. The playback speed is defined as
 93         ``speed``/1000 of the normal speed. So     93         ``speed``/1000 of the normal speed. So 1000 is normal playback.
 94         Negative numbers denote reverse playba     94         Negative numbers denote reverse playback, so -1000 does reverse
 95         playback at normal speed. Speeds -1, 0     95         playback at normal speed. Speeds -1, 0 and 1 have special
 96         meanings: speed 0 is shorthand for 100     96         meanings: speed 0 is shorthand for 1000 (normal playback). A speed
 97         of 1 steps just one frame forward, a s     97         of 1 steps just one frame forward, a speed of -1 steps just one
 98         frame back.                                98         frame back.
 99     * -                                            99     * -
100       - __u32                                     100       - __u32
101       - ``format``                                101       - ``format``
102       - Format restrictions. This field is set    102       - Format restrictions. This field is set by the driver, not the
103         application. Possible values are ``V4L    103         application. Possible values are ``V4L2_DEC_START_FMT_NONE`` if
104         there are no format restrictions or ``    104         there are no format restrictions or ``V4L2_DEC_START_FMT_GOP`` if
105         the decoder operates on full GOPs (*Gr    105         the decoder operates on full GOPs (*Group Of Pictures*). This is
106         usually the case for reverse playback:    106         usually the case for reverse playback: the decoder needs full
107         GOPs, which it can then play in revers    107         GOPs, which it can then play in reverse order. So to implement
108         reverse playback the application must     108         reverse playback the application must feed the decoder the last
109         GOP in the video file, then the GOP be    109         GOP in the video file, then the GOP before that, etc. etc.
110     * - struct                                    110     * - struct
111       - ``stop``                                  111       - ``stop``
112       -                                           112       -
113       - Structure containing additional data f    113       - Structure containing additional data for the ``V4L2_DEC_CMD_STOP``
114         command.                                  114         command.
115     * -                                           115     * -
116       - __u64                                     116       - __u64
117       - ``pts``                                   117       - ``pts``
118       - Stop playback at this ``pts`` or immed    118       - Stop playback at this ``pts`` or immediately if the playback is
119         already past that timestamp. Leave to     119         already past that timestamp. Leave to 0 if you want to stop after
120         the last frame was decoded.               120         the last frame was decoded.
121     * - struct                                    121     * - struct
122       - ``raw``                                   122       - ``raw``
123     * -                                           123     * -
124       - __u32                                     124       - __u32
125       - ``data``\ [16]                            125       - ``data``\ [16]
126       - Reserved for future extensions. Driver    126       - Reserved for future extensions. Drivers and applications must set
127         the array to zero.                        127         the array to zero.
128     * - }                                         128     * - }
129       -                                           129       -
130                                                   130 
131                                                   131 
132 .. tabularcolumns:: |p{5.6cm}|p{0.6cm}|p{11.1c    132 .. tabularcolumns:: |p{5.6cm}|p{0.6cm}|p{11.1cm}|
133                                                   133 
134 .. cssclass:: longtable                           134 .. cssclass:: longtable
135                                                   135 
136 .. _decoder-cmds:                                 136 .. _decoder-cmds:
137                                                   137 
138 .. flat-table:: Decoder Commands                  138 .. flat-table:: Decoder Commands
139     :header-rows:  0                              139     :header-rows:  0
140     :stub-columns: 0                              140     :stub-columns: 0
141     :widths: 56 6 113                             141     :widths: 56 6 113
142                                                   142 
143     * - ``V4L2_DEC_CMD_START``                    143     * - ``V4L2_DEC_CMD_START``
144       - 0                                         144       - 0
145       - Start the decoder. When the decoder is    145       - Start the decoder. When the decoder is already running or paused,
146         this command will just change the play    146         this command will just change the playback speed. That means that
147         calling ``V4L2_DEC_CMD_START`` when th    147         calling ``V4L2_DEC_CMD_START`` when the decoder was paused will
148         *not* resume the decoder. You have to     148         *not* resume the decoder. You have to explicitly call
149         ``V4L2_DEC_CMD_RESUME`` for that. This    149         ``V4L2_DEC_CMD_RESUME`` for that. This command has one flag:
150         ``V4L2_DEC_CMD_START_MUTE_AUDIO``. If     150         ``V4L2_DEC_CMD_START_MUTE_AUDIO``. If set, then audio will be
151         muted when playing back at a non-stand    151         muted when playing back at a non-standard speed.
152                                                   152 
153         For a device implementing the :ref:`de    153         For a device implementing the :ref:`decoder`, once the drain sequence
154         is initiated with the ``V4L2_DEC_CMD_S    154         is initiated with the ``V4L2_DEC_CMD_STOP`` command, it must be driven
155         to completion before this command can     155         to completion before this command can be invoked.  Any attempt to
156         invoke the command while the drain seq    156         invoke the command while the drain sequence is in progress will trigger
157         an ``EBUSY`` error code.  The command     157         an ``EBUSY`` error code.  The command may be also used to restart the
158         decoder in case of an implicit stop in    158         decoder in case of an implicit stop initiated by the decoder itself,
159         without the ``V4L2_DEC_CMD_STOP`` bein    159         without the ``V4L2_DEC_CMD_STOP`` being called explicitly. See
160         :ref:`decoder` for more details.          160         :ref:`decoder` for more details.
161     * - ``V4L2_DEC_CMD_STOP``                     161     * - ``V4L2_DEC_CMD_STOP``
162       - 1                                         162       - 1
163       - Stop the decoder. When the decoder is     163       - Stop the decoder. When the decoder is already stopped, this
164         command does nothing. This command has    164         command does nothing. This command has two flags: if
165         ``V4L2_DEC_CMD_STOP_TO_BLACK`` is set,    165         ``V4L2_DEC_CMD_STOP_TO_BLACK`` is set, then the decoder will set
166         the picture to black after it stopped     166         the picture to black after it stopped decoding. Otherwise the last
167         image will repeat. If                     167         image will repeat. If
168         ``V4L2_DEC_CMD_STOP_IMMEDIATELY`` is s    168         ``V4L2_DEC_CMD_STOP_IMMEDIATELY`` is set, then the decoder stops
169         immediately (ignoring the ``pts`` valu    169         immediately (ignoring the ``pts`` value), otherwise it will keep
170         decoding until timestamp >= pts or unt    170         decoding until timestamp >= pts or until the last of the pending
171         data from its internal buffers was dec    171         data from its internal buffers was decoded.
172                                                   172 
173         For a device implementing the :ref:`de    173         For a device implementing the :ref:`decoder`, the command will initiate
174         the drain sequence as documented in :r    174         the drain sequence as documented in :ref:`decoder`.  No flags or other
175         arguments are accepted in this case. A    175         arguments are accepted in this case. Any attempt to invoke the command
176         again before the sequence completes wi    176         again before the sequence completes will trigger an ``EBUSY`` error
177         code.                                     177         code.
178     * - ``V4L2_DEC_CMD_PAUSE``                    178     * - ``V4L2_DEC_CMD_PAUSE``
179       - 2                                         179       - 2
180       - Pause the decoder. When the decoder ha    180       - Pause the decoder. When the decoder has not been started yet, the
181         driver will return an ``EPERM`` error     181         driver will return an ``EPERM`` error code. When the decoder is
182         already paused, this command does noth    182         already paused, this command does nothing. This command has one
183         flag: if ``V4L2_DEC_CMD_PAUSE_TO_BLACK    183         flag: if ``V4L2_DEC_CMD_PAUSE_TO_BLACK`` is set, then set the
184         decoder output to black when paused.      184         decoder output to black when paused.
185     * - ``V4L2_DEC_CMD_RESUME``                   185     * - ``V4L2_DEC_CMD_RESUME``
186       - 3                                         186       - 3
187       - Resume decoding after a PAUSE command.    187       - Resume decoding after a PAUSE command. When the decoder has not
188         been started yet, the driver will retu    188         been started yet, the driver will return an ``EPERM`` error code. When
189         the decoder is already running, this c    189         the decoder is already running, this command does nothing. No
190         flags are defined for this command.       190         flags are defined for this command.
191     * - ``V4L2_DEC_CMD_FLUSH``                    191     * - ``V4L2_DEC_CMD_FLUSH``
192       - 4                                         192       - 4
193       - Flush any held capture buffers. Only v    193       - Flush any held capture buffers. Only valid for stateless decoders.
194         This command is typically used when th    194         This command is typically used when the application reached the
195         end of the stream and the last output     195         end of the stream and the last output buffer had the
196         ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``    196         ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag set. This would prevent
197         dequeueing the capture buffer containi    197         dequeueing the capture buffer containing the last decoded frame.
198         So this command can be used to explici    198         So this command can be used to explicitly flush that final decoded
199         frame. This command does nothing if th    199         frame. This command does nothing if there are no held capture buffers.
200                                                   200 
201 Return Value                                      201 Return Value
202 ============                                      202 ============
203                                                   203 
204 On success 0 is returned, on error -1 and the     204 On success 0 is returned, on error -1 and the ``errno`` variable is set
205 appropriately. The generic error codes are des    205 appropriately. The generic error codes are described at the
206 :ref:`Generic Error Codes <gen-errors>` chapte    206 :ref:`Generic Error Codes <gen-errors>` chapter.
207                                                   207 
208 EBUSY                                             208 EBUSY
209     A drain sequence of a device implementing     209     A drain sequence of a device implementing the :ref:`decoder` is still in
210     progress. It is not allowed to issue anoth    210     progress. It is not allowed to issue another decoder command until it
211     completes.                                    211     completes.
212                                                   212 
213 EINVAL                                            213 EINVAL
214     The ``cmd`` field is invalid.                 214     The ``cmd`` field is invalid.
215                                                   215 
216 EPERM                                             216 EPERM
217     The application sent a PAUSE or RESUME com    217     The application sent a PAUSE or RESUME command when the decoder was
218     not running.                                  218     not running.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php