io.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _io:
  3. ############
  4. Input/Output
  5. ############
  6. The V4L2 API defines several different methods to read from or write to
  7. a device. All drivers exchanging data with applications must support at
  8. least one of them.
  9. The classic I/O method using the :ref:`read() <func-read>` and
  10. :ref:`write() <func-write>` function is automatically selected after opening a
  11. V4L2 device. When the driver does not support this method attempts to
  12. read or write will fail at any time.
  13. Other methods must be negotiated. To select the streaming I/O method
  14. with memory mapped or user buffers applications call the
  15. :ref:`VIDIOC_REQBUFS` ioctl. The asynchronous I/O
  16. method is not defined yet.
  17. Video overlay can be considered another I/O method, although the
  18. application does not directly receive the image data. It is selected by
  19. initiating video overlay with the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
  20. ioctl. For more information see :ref:`overlay`.
  21. Generally exactly one I/O method, including overlay, is associated with
  22. each file descriptor. The only exceptions are applications not
  23. exchanging data with a driver ("panel applications", see :ref:`open`)
  24. and drivers permitting simultaneous video capturing and overlay using
  25. the same file descriptor, for compatibility with V4L and earlier
  26. versions of V4L2.
  27. :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` and :ref:`VIDIOC_REQBUFS` would permit this to some
  28. degree, but for simplicity drivers need not support switching the I/O
  29. method (after first switching away from read/write) other than by
  30. closing and reopening the device.
  31. The following sections describe the various I/O methods in more detail.
  32. .. toctree::
  33. :maxdepth: 1
  34. rw
  35. mmap
  36. userp
  37. dmabuf
  38. async
  39. buffer
  40. field-order