^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_ENUM_FMT:
^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_ENUM_FMT
^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_ENUM_FMT - Enumerate image formats
^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_ENUM_FMT
^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_ENUM_FMT, struct v4l2_fmtdesc *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_fmtdesc`.
^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) To enumerate image formats applications initialize the ``type``, ``mbus_code``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) and ``index`` fields of struct :c:type:`v4l2_fmtdesc` and call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) fill the rest of the structure or return an ``EINVAL`` error code. All
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) formats are enumerable by beginning at index zero and incrementing by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) one until ``EINVAL`` is returned. If applicable, drivers shall return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) formats in preference order, where preferred formats are returned before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) (that is, with lower ``index`` value) less-preferred formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) Depending on the ``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) the ``mbus_code`` field is handled differently:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 1) ``V4L2_CAP_IO_MC`` is not set (also known as a 'video-node-centric' driver)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Applications shall initialize the ``mbus_code`` field to zero and drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) shall ignore the value of the field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) Drivers shall enumerate all image formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) After switching the input or output the list of enumerated image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) formats may be different.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 2) ``V4L2_CAP_IO_MC`` is set (also known as an 'MC-centric' driver)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) If the ``mbus_code`` field is zero, then all image formats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) shall be enumerated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) If the ``mbus_code`` field is initialized to a valid (non-zero)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) :ref:`media bus format code <v4l2-mbus-pixelcode>`, then drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) shall restrict enumeration to only the image formats that can produce
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) (for video output devices) or be produced from (for video capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) devices) that media bus code. If the ``mbus_code`` is unsupported by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) the driver, then ``EINVAL`` shall be returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) Regardless of the value of the ``mbus_code`` field, the enumerated image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) formats shall not depend on the active configuration of the video device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) or device pipeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .. c:type:: v4l2_fmtdesc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) .. flat-table:: struct v4l2_fmtdesc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) :widths: 1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) - ``index``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) - Number of the format in the enumeration, set by the application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) This is in no way related to the ``pixelformat`` field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) - ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) - Type of the data stream, set by the application. Only these types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ``V4L2_BUF_TYPE_VIDEO_OVERLAY``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) ``V4L2_BUF_TYPE_SDR_CAPTURE``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) ``V4L2_BUF_TYPE_SDR_OUTPUT``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) ``V4L2_BUF_TYPE_META_CAPTURE`` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) ``V4L2_BUF_TYPE_META_OUTPUT``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) See :c:type:`v4l2_buf_type`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) - ``flags``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) - See :ref:`fmtdesc-flags`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * - __u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) - ``description``\ [32]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) - Description of the format, a NUL-terminated ASCII string. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) information is intended for the user, for example: "YUV 4:2:2".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) - ``pixelformat``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) - The image format identifier. This is a four character code as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) computed by the v4l2_fourcc() macro:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * - :cspan:`2`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .. _v4l2-fourcc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) ``#define v4l2_fourcc(a,b,c,d)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Several image formats are already defined by this specification in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) :ref:`pixfmt`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) .. attention::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) These codes are not the same as those used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) in the Windows world.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) - ``mbus_code``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) - Media bus code restricting the enumerated formats, set by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) application. Only applicable to drivers that advertise the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) ``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`, shall be 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) - ``reserved``\ [3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) - Reserved for future extensions. Drivers must set the array to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) .. _fmtdesc-flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) .. flat-table:: Image Format Description Flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) :widths: 3 1 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * - ``V4L2_FMT_FLAG_COMPRESSED``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) - 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) - This is a compressed format.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * - ``V4L2_FMT_FLAG_EMULATED``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) - 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) - This format is not native to the device but emulated through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) software (usually libv4l2), where possible try to use a native
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) format instead for better performance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * - ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) - 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) - The hardware decoder for this compressed bytestream format (aka coded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) format) is capable of parsing a continuous bytestream. Applications do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) not need to parse the bytestream themselves to find the boundaries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) between frames/fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) This flag can only be used in combination with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to compressed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) formats only. This flag is valid for stateful decoders only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * - ``V4L2_FMT_FLAG_DYN_RESOLUTION``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) - 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) - Dynamic resolution switching is supported by the device for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) compressed bytestream format (aka coded format). It will notify the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) via the event ``V4L2_EVENT_SOURCE_CHANGE`` when changes in the video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) parameters are detected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) This flag can only be used in combination with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) ``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) compressed formats only. This flag is valid for stateful codecs only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * - ``V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) - 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) - The hardware encoder supports setting the ``CAPTURE`` coded frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) interval separately from the ``OUTPUT`` raw frame interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) Setting the ``OUTPUT`` raw frame interval with :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) also sets the ``CAPTURE`` coded frame interval to the same value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) If this flag is set, then the ``CAPTURE`` coded frame interval can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) set to a different value afterwards. This is typically used for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) offline encoding where the ``OUTPUT`` raw frame interval is used as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) a hint for reserving hardware encoder resources and the ``CAPTURE`` coded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) frame interval is the actual frame rate embedded in the encoded video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) stream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) This flag can only be used in combination with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) ``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) compressed formats only. This flag is valid for stateful encoders only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * - ``V4L2_FMT_FLAG_CSC_COLORSPACE``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) - 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) - The driver allows the application to try to change the default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) colorspace. This flag is relevant only for capture devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) The application can ask to configure the colorspace of the capture device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * - ``V4L2_FMT_FLAG_CSC_XFER_FUNC``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) - 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) - The driver allows the application to try to change the default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) transfer function. This flag is relevant only for capture devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) The application can ask to configure the transfer function of the capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * - ``V4L2_FMT_FLAG_CSC_YCBCR_ENC``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) - 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) - The driver allows the application to try to change the default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) Y'CbCr encoding. This flag is relevant only for capture devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) The application can ask to configure the Y'CbCr encoding of the capture device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * - ``V4L2_FMT_FLAG_CSC_HSV_ENC``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) - 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) - The driver allows the application to try to change the default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) HSV encoding. This flag is relevant only for capture devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) The application can ask to configure the HSV encoding of the capture device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) * - ``V4L2_FMT_FLAG_CSC_QUANTIZATION``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) - 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) - The driver allows the application to try to change the default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) quantization. This flag is relevant only for capture devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) The application can ask to configure the quantization of the capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) :ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) The struct :c:type:`v4l2_fmtdesc` ``type`` is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) supported or the ``index`` is out of bounds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) If ``V4L2_CAP_IO_MC`` is set and the specified ``mbus_code``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) is unsupported, then also return this error code.