Debian Codegraph @

Documentation/userspace-api/media/v4l/vidioc-remove-bufs.rst

raw
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_REMOVE_BUFS:
5
6 ************************
7 ioctl VIDIOC_REMOVE_BUFS
8 ************************
9
10 Name
11 ====
12
13 VIDIOC_REMOVE_BUFS - Removes buffers from a queue
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_REMOVE_BUFS
19
20 ``int ioctl(int fd, VIDIOC_REMOVE_BUFS, struct v4l2_remove_buffers *argp)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by :c:func:`open()`.
27
28 ``argp``
29 Pointer to struct :c:type:`v4l2_remove_buffers`.
30
31 Description
32 ===========
33
34 Applications can optionally call the :ref:`VIDIOC_REMOVE_BUFS` ioctl to
35 remove buffers from a queue.
36 :ref:`VIDIOC_CREATE_BUFS` ioctl support is mandatory to enable :ref:`VIDIOC_REMOVE_BUFS`.
37 This ioctl is available if the ``V4L2_BUF_CAP_SUPPORTS_REMOVE_BUFS`` capability
38 is set on the queue when :c:func:`VIDIOC_REQBUFS` or :c:func:`VIDIOC_CREATE_BUFS`
39 are invoked.
40
41 .. c:type:: v4l2_remove_buffers
42
43 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
44
45 .. flat-table:: struct v4l2_remove_buffers
46 :header-rows: 0
47 :stub-columns: 0
48 :widths: 1 1 2
49
50 * - __u32
51 - ``index``
52 - The starting buffer index to remove. This field is ignored if count == 0.
53 * - __u32
54 - ``count``
55 - The number of buffers to be removed with indices 'index' until 'index + count - 1'.
56 All buffers in this range must be valid and in DEQUEUED state.
57 :ref:`VIDIOC_REMOVE_BUFS` will always check the validity of ``type``, if it is
58 invalid it returns ``EINVAL`` error code.
59 If count is set to 0 :ref:`VIDIOC_REMOVE_BUFS` will do nothing and return 0.
60 * - __u32
61 - ``type``
62 - Type of the stream or buffers, this is the same as the struct
63 :c:type:`v4l2_format` ``type`` field. See
64 :c:type:`v4l2_buf_type` for valid values.
65 * - __u32
66 - ``reserved``\ [13]
67 - A place holder for future extensions. Drivers and applications
68 must set the array to zero.
69
70 Return Value
71 ============
72
73 On success 0 is returned, on error -1 and the ``errno`` variable is set
74 appropriately. The generic error codes are described at the
75 :ref:`Generic Error Codes <gen-errors>` chapter. If an error occurs, no
76 buffers will be freed and one of the error codes below will be returned:
77
78 EBUSY
79 File I/O is in progress.
80 One or more of the buffers in the range ``index`` to ``index + count - 1`` are not
81 in DEQUEUED state.
82
83 EINVAL
84 One or more of the buffers in the range ``index`` to ``index + count - 1`` do not
85 exist in the queue.
86 The buffer type (``type`` field) is not valid.