~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/media/v4l/vidioc-g-crop.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/media/v4l/vidioc-g-crop.rst (Architecture alpha) and /Documentation/userspace-api/media/v4l/vidioc-g-crop.rst (Architecture m68k)


  1 .. SPDX-License-Identifier: GFDL-1.1-no-invari      1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2 .. c:namespace:: V4L                                2 .. c:namespace:: V4L
  3                                                     3 
  4 .. _VIDIOC_G_CROP:                                  4 .. _VIDIOC_G_CROP:
  5                                                     5 
  6 **********************************                  6 **********************************
  7 ioctl VIDIOC_G_CROP, VIDIOC_S_CROP                  7 ioctl VIDIOC_G_CROP, VIDIOC_S_CROP
  8 **********************************                  8 **********************************
  9                                                     9 
 10 Name                                               10 Name
 11 ====                                               11 ====
 12                                                    12 
 13 VIDIOC_G_CROP - VIDIOC_S_CROP - Get or set the     13 VIDIOC_G_CROP - VIDIOC_S_CROP - Get or set the current cropping rectangle
 14                                                    14 
 15 Synopsis                                           15 Synopsis
 16 ========                                           16 ========
 17                                                    17 
 18 .. c:macro:: VIDIOC_G_CROP                         18 .. c:macro:: VIDIOC_G_CROP
 19                                                    19 
 20 ``int ioctl(int fd, VIDIOC_G_CROP, struct v4l2     20 ``int ioctl(int fd, VIDIOC_G_CROP, struct v4l2_crop *argp)``
 21                                                    21 
 22 .. c:macro:: VIDIOC_S_CROP                         22 .. c:macro:: VIDIOC_S_CROP
 23                                                    23 
 24 ``int ioctl(int fd, VIDIOC_S_CROP, const struc     24 ``int ioctl(int fd, VIDIOC_S_CROP, const struct v4l2_crop *argp)``
 25                                                    25 
 26 Arguments                                          26 Arguments
 27 =========                                          27 =========
 28                                                    28 
 29 ``fd``                                             29 ``fd``
 30     File descriptor returned by :c:func:`open(     30     File descriptor returned by :c:func:`open()`.
 31                                                    31 
 32 ``argp``                                           32 ``argp``
 33     Pointer to struct :c:type:`v4l2_crop`.         33     Pointer to struct :c:type:`v4l2_crop`.
 34                                                    34 
 35 Description                                        35 Description
 36 ===========                                        36 ===========
 37                                                    37 
 38 To query the cropping rectangle size and posit     38 To query the cropping rectangle size and position applications set the
 39 ``type`` field of a struct :c:type:`v4l2_crop`     39 ``type`` field of a struct :c:type:`v4l2_crop` structure to the
 40 respective buffer (stream) type and call the :     40 respective buffer (stream) type and call the :ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` ioctl
 41 with a pointer to this structure. The driver f     41 with a pointer to this structure. The driver fills the rest of the
 42 structure or returns the ``EINVAL`` error code     42 structure or returns the ``EINVAL`` error code if cropping is not supported.
 43                                                    43 
 44 To change the cropping rectangle applications      44 To change the cropping rectangle applications initialize the ``type``
 45 and struct :c:type:`v4l2_rect` substructure na     45 and struct :c:type:`v4l2_rect` substructure named ``c`` of a
 46 v4l2_crop structure and call the :ref:`VIDIOC_     46 v4l2_crop structure and call the :ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` ioctl with a pointer
 47 to this structure.                                 47 to this structure.
 48                                                    48 
 49 The driver first adjusts the requested dimensi     49 The driver first adjusts the requested dimensions against hardware
 50 limits, i. e. the bounds given by the capture/     50 limits, i. e. the bounds given by the capture/output window, and it
 51 rounds to the closest possible values of horiz     51 rounds to the closest possible values of horizontal and vertical offset,
 52 width and height. In particular the driver mus     52 width and height. In particular the driver must round the vertical
 53 offset of the cropping rectangle to frame line     53 offset of the cropping rectangle to frame lines modulo two, such that
 54 the field order cannot be confused.                54 the field order cannot be confused.
 55                                                    55 
 56 Second the driver adjusts the image size (the      56 Second the driver adjusts the image size (the opposite rectangle of the
 57 scaling process, source or target depending on     57 scaling process, source or target depending on the data direction) to
 58 the closest size possible while maintaining th     58 the closest size possible while maintaining the current horizontal and
 59 vertical scaling factor.                           59 vertical scaling factor.
 60                                                    60 
 61 Finally the driver programs the hardware with      61 Finally the driver programs the hardware with the actual cropping and
 62 image parameters. :ref:`VIDIOC_S_CROP <VIDIOC_     62 image parameters. :ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` is a write-only ioctl, it does not
 63 return the actual parameters. To query them ap     63 return the actual parameters. To query them applications must call
 64 :ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` and :ref:     64 :ref:`VIDIOC_G_CROP <VIDIOC_G_CROP>` and :ref:`VIDIOC_G_FMT`. When the
 65 parameters are unsuitable the application may      65 parameters are unsuitable the application may modify the cropping or
 66 image parameters and repeat the cycle until sa     66 image parameters and repeat the cycle until satisfactory parameters have
 67 been negotiated.                                   67 been negotiated.
 68                                                    68 
 69 When cropping is not supported then no paramet     69 When cropping is not supported then no parameters are changed and
 70 :ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` returns t     70 :ref:`VIDIOC_S_CROP <VIDIOC_G_CROP>` returns the ``EINVAL`` error code.
 71                                                    71 
 72 .. c:type:: v4l2_crop                              72 .. c:type:: v4l2_crop
 73                                                    73 
 74 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm     74 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
 75                                                    75 
 76 .. flat-table:: struct v4l2_crop                   76 .. flat-table:: struct v4l2_crop
 77     :header-rows:  0                               77     :header-rows:  0
 78     :stub-columns: 0                               78     :stub-columns: 0
 79     :widths:       1 1 2                           79     :widths:       1 1 2
 80                                                    80 
 81     * - __u32                                      81     * - __u32
 82       - ``type``                                   82       - ``type``
 83       - Type of the data stream, set by the ap     83       - Type of the data stream, set by the application. Only these types
 84         are valid here: ``V4L2_BUF_TYPE_VIDEO_     84         are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
 85         ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2     85         ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
 86         ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :     86         ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type` and the note below.
 87     * - struct :c:type:`v4l2_rect`                 87     * - struct :c:type:`v4l2_rect`
 88       - ``c``                                      88       - ``c``
 89       - Cropping rectangle. The same co-ordina     89       - Cropping rectangle. The same co-ordinate system as for struct
 90         :c:type:`v4l2_cropcap` ``bounds`` is u     90         :c:type:`v4l2_cropcap` ``bounds`` is used.
 91                                                    91 
 92 .. note::                                          92 .. note::
 93    Unfortunately in the case of multiplanar bu     93    Unfortunately in the case of multiplanar buffer types
 94    (``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` and     94    (``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` and ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``)
 95    this API was messed up with regards to how      95    this API was messed up with regards to how the :c:type:`v4l2_crop` ``type`` field
 96    should be filled in. Some drivers only acce     96    should be filled in. Some drivers only accepted the ``_MPLANE`` buffer type while
 97    other drivers only accepted a non-multiplan     97    other drivers only accepted a non-multiplanar buffer type (i.e. without the
 98    ``_MPLANE`` at the end).                        98    ``_MPLANE`` at the end).
 99                                                    99 
100    Starting with kernel 4.13 both variations a    100    Starting with kernel 4.13 both variations are allowed.
101                                                   101 
102 Return Value                                      102 Return Value
103 ============                                      103 ============
104                                                   104 
105 On success 0 is returned, on error -1 and the     105 On success 0 is returned, on error -1 and the ``errno`` variable is set
106 appropriately. The generic error codes are des    106 appropriately. The generic error codes are described at the
107 :ref:`Generic Error Codes <gen-errors>` chapte    107 :ref:`Generic Error Codes <gen-errors>` chapter.
108                                                   108 
109 ENODATA                                           109 ENODATA
110     Cropping is not supported for this input o    110     Cropping is not supported for this input or output.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php