vidioc-remove-bufs.rst 2.5 KB

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