1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_SUBDEV_G_SELECTION:
5 **********************************************************
6 ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
7 **********************************************************
12 VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rectangles on a subdev pad
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp )
25 File descriptor returned by :ref:`open() <func-open>`.
28 VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
36 The selections are used to configure various image processing
37 functionality performed by the subdevs which affect the image size. This
38 currently includes cropping, scaling and composition.
40 The selection API replaces
41 :ref:`the old subdev crop API <VIDIOC_SUBDEV_G_CROP>`. All the
42 function of the crop API, and more, are supported by the selections API.
44 See :ref:`subdev` for more information on how each selection target
45 affects the image processing pipeline inside the subdevice.
48 Types of selection targets
49 --------------------------
51 There are two types of selection targets: actual and bounds. The actual
52 targets are the targets which configure the hardware. The BOUNDS target
53 will return a rectangle that contain all possible actual rectangles.
56 Discovering supported features
57 ------------------------------
59 To discover which targets are supported, the user can perform
60 ``VIDIOC_SUBDEV_G_SELECTION`` on them. Any unsupported target will
63 Selection targets and flags are documented in
64 :ref:`v4l2-selections-common`.
67 .. _v4l2-subdev-selection:
69 .. flat-table:: struct v4l2_subdev_selection
81 - Active or try selection, from enum
82 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
90 - Pad number as reported by the media framework.
98 - Target selection rectangle. See :ref:`v4l2-selections-common`.
106 - Flags. See :ref:`v4l2-selection-flags`.
110 - struct :ref:`v4l2_rect <v4l2-rect>`
114 - Selection rectangle, in pixels.
122 - Reserved for future extensions. Applications and drivers must set
129 On success 0 is returned, on error -1 and the ``errno`` variable is set
130 appropriately. The generic error codes are described at the
131 :ref:`Generic Error Codes <gen-errors>` chapter.
134 The selection rectangle can't be changed because the pad is
135 currently busy. This can be caused, for instance, by an active video
136 stream on the pad. The ioctl must not be retried without performing
137 another action to fix the problem first. Only returned by
138 ``VIDIOC_SUBDEV_S_SELECTION``
141 The struct :ref:`v4l2_subdev_selection <v4l2-subdev-selection>`
142 ``pad`` references a non-existing pad, the ``which`` field
143 references a non-existing format, or the selection target is not
144 supported on the given subdev pad.