vidioc-subdev-g-selection.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _VIDIOC_SUBDEV_G_SELECTION:
  3. **********************************************************
  4. ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
  5. **********************************************************
  6. Name
  7. ====
  8. VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rectangles on a subdev pad
  9. Synopsis
  10. ========
  11. .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_SELECTION, struct v4l2_subdev_selection *argp )
  12. :name: VIDIOC_SUBDEV_G_SELECTION
  13. .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_SELECTION, struct v4l2_subdev_selection *argp )
  14. :name: VIDIOC_SUBDEV_S_SELECTION
  15. Arguments
  16. =========
  17. ``fd``
  18. File descriptor returned by :ref:`open() <func-open>`.
  19. ``argp``
  20. Description
  21. ===========
  22. The selections are used to configure various image processing
  23. functionality performed by the subdevs which affect the image size. This
  24. currently includes cropping, scaling and composition.
  25. The selection API replaces
  26. :ref:`the old subdev crop API <VIDIOC_SUBDEV_G_CROP>`. All the
  27. function of the crop API, and more, are supported by the selections API.
  28. See :ref:`subdev` for more information on how each selection target
  29. affects the image processing pipeline inside the subdevice.
  30. Types of selection targets
  31. --------------------------
  32. There are two types of selection targets: actual and bounds. The actual
  33. targets are the targets which configure the hardware. The BOUNDS target
  34. will return a rectangle that contain all possible actual rectangles.
  35. Discovering supported features
  36. ------------------------------
  37. To discover which targets are supported, the user can perform
  38. ``VIDIOC_SUBDEV_G_SELECTION`` on them. Any unsupported target will
  39. return ``EINVAL``.
  40. Selection targets and flags are documented in
  41. :ref:`v4l2-selections-common`.
  42. .. c:type:: v4l2_subdev_selection
  43. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
  44. .. flat-table:: struct v4l2_subdev_selection
  45. :header-rows: 0
  46. :stub-columns: 0
  47. :widths: 1 1 2
  48. * - __u32
  49. - ``which``
  50. - Active or try selection, from enum
  51. :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
  52. * - __u32
  53. - ``pad``
  54. - Pad number as reported by the media framework.
  55. * - __u32
  56. - ``target``
  57. - Target selection rectangle. See :ref:`v4l2-selections-common`.
  58. * - __u32
  59. - ``flags``
  60. - Flags. See :ref:`v4l2-selection-flags`.
  61. * - struct :c:type:`v4l2_rect`
  62. - ``r``
  63. - Selection rectangle, in pixels.
  64. * - __u32
  65. - ``reserved``\ [8]
  66. - Reserved for future extensions. Applications and drivers must set
  67. the array to zero.
  68. Return Value
  69. ============
  70. On success 0 is returned, on error -1 and the ``errno`` variable is set
  71. appropriately. The generic error codes are described at the
  72. :ref:`Generic Error Codes <gen-errors>` chapter.
  73. EBUSY
  74. The selection rectangle can't be changed because the pad is
  75. currently busy. This can be caused, for instance, by an active video
  76. stream on the pad. The ioctl must not be retried without performing
  77. another action to fix the problem first. Only returned by
  78. ``VIDIOC_SUBDEV_S_SELECTION``
  79. EINVAL
  80. The struct :c:type:`v4l2_subdev_selection`
  81. ``pad`` references a non-existing pad, the ``which`` field
  82. references a non-existing format, or the selection target is not
  83. supported on the given subdev pad.