Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) .. _VIDIOC_CROPCAP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) ********************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) ioctl VIDIOC_CROPCAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) ********************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) VIDIOC_CROPCAP - Information about the video cropping and scaling abilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) .. c:macro:: VIDIOC_CROPCAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) ``int ioctl(int fd, VIDIOC_CROPCAP, struct v4l2_cropcap *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)     File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)     Pointer to struct :c:type:`v4l2_cropcap`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) Applications use this function to query the cropping limits, the pixel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) aspect of images and to calculate scale factors. They set the ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) field of a v4l2_cropcap structure to the respective buffer (stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) type and call the :ref:`VIDIOC_CROPCAP` ioctl with a pointer to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) structure. Drivers fill the rest of the structure. The results are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) constant except when switching the video standard. Remember this switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) can occur implicit when switching the video input or output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) This ioctl must be implemented for video capture or output devices that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) support cropping and/or scaling and/or have non-square pixels, and for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) overlay devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) .. c:type:: v4l2_cropcap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) .. flat-table:: struct v4l2_cropcap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)     :header-rows:  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)     :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)     :widths:       1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)       - ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)       - Type of the data stream, set by the application. Only these types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type` and the note below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)     * - struct :ref:`v4l2_rect <v4l2-rect-crop>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)       - ``bounds``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)       - Defines the window within capturing or output is possible, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	may exclude for example the horizontal and vertical blanking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	areas. The cropping rectangle cannot exceed these limits. Width
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	and height are defined in pixels, the driver writer is free to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	choose origin and units of the coordinate system in the analog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)     * - struct :ref:`v4l2_rect <v4l2-rect-crop>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)       - ``defrect``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)       - Default cropping rectangle, it shall cover the "whole picture".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	Assuming pixel aspect 1/1 this could be for example a 640 × 480
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	rectangle for NTSC, a 768 × 576 rectangle for PAL and SECAM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	centered over the active picture area. The same co-ordinate system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	as for ``bounds`` is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)     * - struct :c:type:`v4l2_fract`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)       - ``pixelaspect``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)       - This is the pixel aspect (y / x) when no scaling is applied, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	ratio of the actual sampling frequency and the frequency required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	to get square pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	When cropping coordinates refer to square pixels, the driver sets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	``pixelaspect`` to 1/1. Other common values are 54/59 for PAL and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	SECAM, 11/10 for NTSC sampled according to [:ref:`itu601`].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)    Unfortunately in the case of multiplanar buffer types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)    (``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` and ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)    this API was messed up with regards to how the :c:type:`v4l2_cropcap` ``type`` field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)    should be filled in. Some drivers only accepted the ``_MPLANE`` buffer type while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)    other drivers only accepted a non-multiplanar buffer type (i.e. without the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)    ``_MPLANE`` at the end).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)    Starting with kernel 4.13 both variations are allowed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) .. _v4l2-rect-crop:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) .. flat-table:: struct v4l2_rect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)     :header-rows:  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)     :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)     :widths:       1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)     * - __s32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)       - ``left``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)       - Horizontal offset of the top, left corner of the rectangle, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     * - __s32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)       - ``top``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)       - Vertical offset of the top, left corner of the rectangle, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)       - ``width``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)       - Width of the rectangle, in pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)       - ``height``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)       - Height of the rectangle, in pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)     The struct :c:type:`v4l2_cropcap` ``type`` is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)     invalid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) ENODATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)     Cropping is not supported for this input or output.