요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_ENUM_FMT:
*********************
ioctl VIDIOC_ENUM_FMT
*********************
Name
====
VIDIOC_ENUM_FMT - Enumerate image formats
Synopsis
========
.. c:macro:: VIDIOC_ENUM_FMT
``int ioctl(int fd, VIDIOC_ENUM_FMT, struct v4l2_fmtdesc *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_fmtdesc`.
Description
===========
To enumerate image formats applications initialize the ``type``, ``mbus_code``
and ``index`` fields of struct :c:type:`v4l2_fmtdesc` and call
the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
fill the rest of the structure or return an ``EINVAL`` error code. All
formats are enumerable by beginning at index zero and incrementing by
one until ``EINVAL`` is returned. If applicable, drivers shall return
formats in preference order, where preferred formats are returned before
(that is, with lower ``index`` value) less-preferred formats.
Depending on the ``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`,
the ``mbus_code`` field is handled differently:
1) ``V4L2_CAP_IO_MC`` is not set (also known as a 'video-node-centric' driver)
Applications shall initialize the ``mbus_code`` field to zero and drivers
shall ignore the value of the field.
Drivers shall enumerate all image formats.
.. note::
After switching the input or output the list of enumerated image
formats may be different.
2) ``V4L2_CAP_IO_MC`` is set (also known as an 'MC-centric' driver)
If the ``mbus_code`` field is zero, then all image formats
shall be enumerated.
If the ``mbus_code`` field is initialized to a valid (non-zero)
:ref:`media bus format code <v4l2-mbus-pixelcode>`, then drivers
shall restrict enumeration to only the image formats that can produce
(for video output devices) or be produced from (for video capture
devices) that media bus code. If the ``mbus_code`` is unsupported by
the driver, then ``EINVAL`` shall be returned.
Regardless of the value of the ``mbus_code`` field, the enumerated image
formats shall not depend on the active configuration of the video device
or device pipeline.
.. c:type:: v4l2_fmtdesc
.. cssclass:: longtable
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_fmtdesc
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``index``
- Number of the format in the enumeration, set by the application.
This is in no way related to the ``pixelformat`` field.
When the index is ORed with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` the
driver clears the flag and enumerates all the possible formats,
ignoring any limitations from the current configuration. Drivers
which do not support this flag always return an ``EINVAL``
error code without clearing this flag.
Formats enumerated when using ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag
shouldn't be used when calling :c:func:`VIDIOC_ENUM_FRAMESIZES`
or :c:func:`VIDIOC_ENUM_FRAMEINTERVALS`.
``V4L2_FMTDESC_FLAG_ENUM_ALL`` should only be used by drivers that
can return different format list depending on this flag.
* - __u32
- ``type``
- Type of the data stream, set by the application. Only these types
are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``,
``V4L2_BUF_TYPE_VIDEO_OVERLAY``,
``V4L2_BUF_TYPE_SDR_CAPTURE``,
``V4L2_BUF_TYPE_SDR_OUTPUT``,
``V4L2_BUF_TYPE_META_CAPTURE`` and
``V4L2_BUF_TYPE_META_OUTPUT``.
See :c:type:`v4l2_buf_type`.
* - __u32
- ``flags``
- See :ref:`fmtdesc-flags`
* - __u8
- ``description``\ [32]
- Description of the format, a NUL-terminated ASCII string. This
information is intended for the user, for example: "YUV 4:2:2".
* - __u32
- ``pixelformat``
- The image format identifier. This is a four character code as
computed by the v4l2_fourcc() macro:
* - :cspan:`2`
.. _v4l2-fourcc:
``#define v4l2_fourcc(a,b,c,d)``
``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))``
Several image formats are already defined by this specification in
:ref:`pixfmt`.
.. attention::
These codes are not the same as those used
in the Windows world.
* - __u32
- ``mbus_code``
- Media bus code restricting the enumerated formats, set by the
application. Only applicable to drivers that advertise the
``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`, shall be 0
otherwise.
* - __u32
- ``reserved``\ [3]
- Reserved for future extensions. Drivers must set the array to
zero.
.. tabularcolumns:: |p{8.4cm}|p{1.8cm}|p{7.1cm}|
.. cssclass:: longtable
.. _fmtdesc-flags:
.. flat-table:: Image Format Description Flags
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
* - ``V4L2_FMT_FLAG_COMPRESSED``
- 0x0001
- This is a compressed format.
* - ``V4L2_FMT_FLAG_EMULATED``
- 0x0002
- This format is not native to the device but emulated through
software (usually libv4l2), where possible try to use a native
format instead for better performance.
* - ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
- 0x0004
- The hardware decoder for this compressed bytestream format (aka coded
format) is capable of parsing a continuous bytestream. Applications do
not need to parse the bytestream themselves to find the boundaries
between frames/fields.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to compressed
formats only. This flag is valid for stateful decoders only.
* - ``V4L2_FMT_FLAG_DYN_RESOLUTION``
- 0x0008
- Dynamic resolution switching is supported by the device for this
compressed bytestream format (aka coded format). It will notify the user
via the event ``V4L2_EVENT_SOURCE_CHANGE`` when changes in the video
parameters are detected.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
compressed formats only. This flag is valid for stateful codecs only.
* - ``V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL``
- 0x0010
- The hardware encoder supports setting the ``CAPTURE`` coded frame
interval separately from the ``OUTPUT`` raw frame interval.
Setting the ``OUTPUT`` raw frame interval with :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>`
also sets the ``CAPTURE`` coded frame interval to the same value.
If this flag is set, then the ``CAPTURE`` coded frame interval can be
set to a different value afterwards. This is typically used for
offline encoding where the ``OUTPUT`` raw frame interval is used as
a hint for reserving hardware encoder resources and the ``CAPTURE`` coded
frame interval is the actual frame rate embedded in the encoded video
stream.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
compressed formats only. This flag is valid for stateful encoders only.
* - ``V4L2_FMT_FLAG_CSC_COLORSPACE``
- 0x0020
- The driver allows the application to try to change the default
colorspace. This flag is relevant only for capture devices.
The application can ask to configure the colorspace of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_XFER_FUNC``
- 0x0040
- The driver allows the application to try to change the default
transfer function. This flag is relevant only for capture devices.
The application can ask to configure the transfer function of the capture
device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_YCBCR_ENC``
- 0x0080
- The driver allows the application to try to change the default
Y'CbCr encoding. This flag is relevant only for capture devices.
The application can ask to configure the Y'CbCr encoding of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_HSV_ENC``
- 0x0080
- The driver allows the application to try to change the default
HSV encoding. This flag is relevant only for capture devices.
The application can ask to configure the HSV encoding of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_QUANTIZATION``
- 0x0100
- The driver allows the application to try to change the default
quantization. This flag is relevant only for capture devices.
The application can ask to configure the quantization of the capture
device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_META_LINE_BASED``
- 0x0200
- The metadata format is line-based. In this case the ``width``,
``height`` and ``bytesperline`` fields of :c:type:`v4l2_meta_format` are
valid. The buffer consists of ``height`` lines, each having ``width``
Data Units of data and the offset (in bytes) between the beginning of
each two consecutive lines is ``bytesperline``.
* - ``V4L2_FMTDESC_FLAG_ENUM_ALL``
- 0x80000000
- When the applications ORs ``index`` with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag
the driver enumerates all the possible pixel formats without taking care
of any already set configuration. Drivers which do not support this flag,
always return ``EINVAL`` without clearing this flag.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
EINVAL
The struct :c:type:`v4l2_fmtdesc` ``type`` is not
supported or the ``index`` is out of bounds.
If ``V4L2_CAP_IO_MC`` is set and the specified ``mbus_code``
is unsupported, then also return this error code.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 인자
1-33`VIDIOC_ENUM_FMT`는 비디오 장치가 지원하는 이미지 형식을 열거하는 ioctl입니다. 호출 형식은 `int ioctl(int fd, VIDIOC_ENUM_FMT, struct v4l2_fmtdesc *argp)`이며, 성공할 때마다 요청한 순번의 형식 설명을 `v4l2_fmtdesc`에 돌려줍니다.
`fd`는 `open()`이 반환한 파일 디스크립터이고, `argp`는 응용 프로그램이 조회 조건을 채운 `struct v4l2_fmtdesc`를 가리킵니다. 형식 열거는 스트림 유형별로 수행되므로 호출 전에 `type`을 반드시 지정해야 합니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_ENUM_FMT:
*********************
ioctl VIDIOC_ENUM_FMT
*********************
Name
====
VIDIOC_ENUM_FMT - Enumerate image formats
Synopsis
========
.. c:macro:: VIDIOC_ENUM_FMT
``int ioctl(int fd, VIDIOC_ENUM_FMT, struct v4l2_fmtdesc *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_fmtdesc`.
Description
===========
형식 열거 절차와 media-controller 조건
34-75응용 프로그램은 `type`, `mbus_code`, `index`를 초기화한 뒤 `VIDIOC_ENUM_FMT`를 호출합니다. 드라이버는 나머지 필드를 채우거나 `EINVAL`을 반환합니다. 모든 형식은 `index` 0부터 시작해 한 번에 1씩 증가시키며, `EINVAL`이 반환될 때까지 조회합니다.
드라이버가 선호도를 제공할 수 있다면 더 선호하는 형식을 더 낮은 `index`로 먼저 반환해야 합니다. 다만 `index`는 단순한 열거 순번이며 `pixelformat` 값과는 아무 관계가 없습니다.
`V4L2_CAP_IO_MC`가 설정되지 않은 video-node-centric 드라이버에서는 응용 프로그램이 `mbus_code`를 0으로 설정해야 하고 드라이버는 그 값을 무시합니다. 드라이버는 모든 이미지 형식을 열거하며, 입력이나 출력을 전환한 뒤에는 목록이 달라질 수 있습니다.
`V4L2_CAP_IO_MC`가 설정된 MC-centric 드라이버에서 `mbus_code`가 0이면 모든 이미지 형식을 열거합니다. 유효한 0이 아닌 media bus 형식 코드를 지정하면, 출력 장치에서는 해당 bus 코드를 생성할 수 있는 이미지 형식만, 캡처 장치에서는 해당 bus 코드로부터 생성될 수 있는 이미지 형식만 반환합니다. 지원하지 않는 코드는 `EINVAL`입니다.
MC-centric 드라이버의 열거 결과는 `mbus_code` 값과 무관하게 비디오 장치나 장치 파이프라인의 현재 활성 구성에 의존해서는 안 됩니다. 이는 토폴로지 협상 전에 가능한 형식 집합을 안정적으로 조사할 수 있게 하는 규칙입니다.
일반 열거와 media bus 코드 제한을 포함한 호출 순서입니다.
To enumerate image formats applications initialize the ``type``, ``mbus_code``
and ``index`` fields of struct :c:type:`v4l2_fmtdesc` and call
the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
fill the rest of the structure or return an ``EINVAL`` error code. All
formats are enumerable by beginning at index zero and incrementing by
one until ``EINVAL`` is returned. If applicable, drivers shall return
formats in preference order, where preferred formats are returned before
(that is, with lower ``index`` value) less-preferred formats.
Depending on the ``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`,
the ``mbus_code`` field is handled differently:
1) ``V4L2_CAP_IO_MC`` is not set (also known as a 'video-node-centric' driver)
Applications shall initialize the ``mbus_code`` field to zero and drivers
shall ignore the value of the field.
Drivers shall enumerate all image formats.
.. note::
After switching the input or output the list of enumerated image
formats may be different.
2) ``V4L2_CAP_IO_MC`` is set (also known as an 'MC-centric' driver)
If the ``mbus_code`` field is zero, then all image formats
shall be enumerated.
If the ``mbus_code`` field is initialized to a valid (non-zero)
:ref:`media bus format code <v4l2-mbus-pixelcode>`, then drivers
shall restrict enumeration to only the image formats that can produce
(for video output devices) or be produced from (for video capture
devices) that media bus code. If the ``mbus_code`` is unsupported by
the driver, then ``EINVAL`` shall be returned.
Regardless of the value of the ``mbus_code`` field, the enumerated image
formats shall not depend on the active configuration of the video device
or device pipeline.
.. c:type:: v4l2_fmtdesc
v4l2_fmtdesc 구조체와 FOURCC
76-159응용 프로그램 입력 필드와 드라이버 반환 필드를 원문 순서대로 정리합니다.
`type`에 허용되는 값은 `V4L2_BUF_TYPE_VIDEO_CAPTURE`, `V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`, `V4L2_BUF_TYPE_VIDEO_OUTPUT`, `V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`, `V4L2_BUF_TYPE_VIDEO_OVERLAY`, `V4L2_BUF_TYPE_SDR_CAPTURE`, `V4L2_BUF_TYPE_SDR_OUTPUT`, `V4L2_BUF_TYPE_META_CAPTURE`, `V4L2_BUF_TYPE_META_OUTPUT`입니다.
`index`에 `V4L2_FMTDESC_FLAG_ENUM_ALL`을 OR하면 드라이버는 비트를 지우고 현재 구성의 제약을 무시한 모든 가능한 형식을 열거합니다. 이 기능을 지원하지 않는 드라이버는 플래그를 지우지 않은 채 항상 `EINVAL`을 반환합니다. 이 플래그로 얻은 형식은 `VIDIOC_ENUM_FRAMESIZES`나 `VIDIOC_ENUM_FRAMEINTERVALS` 호출에 사용하면 안 됩니다.
`pixelformat`는 `v4l2_fourcc(a,b,c,d)`가 각 문자를 0, 8, 16, 24비트 위치에 배치해 만드는 32비트 FOURCC입니다. 사양에 이미 정의된 형식은 pixel format 장에서 확인할 수 있으며, 이 코드 체계는 Windows에서 사용하는 코드와 같지 않다는 점에 주의해야 합니다.
.. cssclass:: longtable
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_fmtdesc
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``index``
- Number of the format in the enumeration, set by the application.
This is in no way related to the ``pixelformat`` field.
When the index is ORed with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` the
driver clears the flag and enumerates all the possible formats,
ignoring any limitations from the current configuration. Drivers
which do not support this flag always return an ``EINVAL``
error code without clearing this flag.
Formats enumerated when using ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag
shouldn't be used when calling :c:func:`VIDIOC_ENUM_FRAMESIZES`
or :c:func:`VIDIOC_ENUM_FRAMEINTERVALS`.
``V4L2_FMTDESC_FLAG_ENUM_ALL`` should only be used by drivers that
can return different format list depending on this flag.
* - __u32
- ``type``
- Type of the data stream, set by the application. Only these types
are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``,
``V4L2_BUF_TYPE_VIDEO_OVERLAY``,
``V4L2_BUF_TYPE_SDR_CAPTURE``,
``V4L2_BUF_TYPE_SDR_OUTPUT``,
``V4L2_BUF_TYPE_META_CAPTURE`` and
``V4L2_BUF_TYPE_META_OUTPUT``.
See :c:type:`v4l2_buf_type`.
* - __u32
- ``flags``
- See :ref:`fmtdesc-flags`
* - __u8
- ``description``\ [32]
- Description of the format, a NUL-terminated ASCII string. This
information is intended for the user, for example: "YUV 4:2:2".
* - __u32
- ``pixelformat``
- The image format identifier. This is a four character code as
computed by the v4l2_fourcc() macro:
* - :cspan:`2`
.. _v4l2-fourcc:
``#define v4l2_fourcc(a,b,c,d)``
``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))``
Several image formats are already defined by this specification in
:ref:`pixfmt`.
.. attention::
These codes are not the same as those used
in the Windows world.
* - __u32
- ``mbus_code``
- Media bus code restricting the enumerated formats, set by the
application. Only applicable to drivers that advertise the
``V4L2_CAP_IO_MC`` :ref:`capability <device-capabilities>`, shall be 0
otherwise.
* - __u32
- ``reserved``\ [3]
- Reserved for future extensions. Drivers must set the array to
zero.
.. tabularcolumns:: |p{8.4cm}|p{1.8cm}|p{7.1cm}|
.. cssclass:: longtable
.. _fmtdesc-flags:
.. flat-table:: Image Format Description Flags
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
이미지 형식 설명 플래그
160-251`flags`가 나타내는 압축, 코덱, 색 공간, 메타데이터 및 열거 특성입니다.
`V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM`과 `V4L2_FMT_FLAG_DYN_RESOLUTION`은 압축 형식에만 적용되므로 `V4L2_FMT_FLAG_COMPRESSED`와 함께 사용하며, 전자는 stateful decoder에만, 후자는 stateful codec에만 유효합니다.
`V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL`도 압축 형식의 stateful encoder에만 유효합니다. `VIDIOC_S_PARM`으로 OUTPUT raw frame interval을 설정하면 CAPTURE coded frame interval도 같은 값이 되지만, 이 플래그가 있으면 이후 CAPTURE 값을 다르게 설정할 수 있습니다. 오프라인 인코딩에서는 OUTPUT 값이 하드웨어 자원 예약 힌트이고 CAPTURE 값이 인코딩 스트림에 기록되는 실제 frame rate가 됩니다.
색 변환 관련 네 플래그는 캡처 장치에서만 의미가 있습니다. 응용 프로그램은 `V4L2_PIX_FMT_FLAG_SET_CSC`를 설정한 `VIDIOC_S_FMT` 호출로 colorspace, transfer function, Y'CbCr 또는 HSV encoding, quantization의 기본값 변경을 요청할 수 있으며, 플래그는 드라이버가 그 시도를 허용함을 나타냅니다.
`V4L2_FMT_FLAG_META_LINE_BASED`가 있으면 버퍼는 `height`개의 줄로 구성되고 각 줄에는 `width`개의 Data Unit이 있습니다. 연속한 두 줄 시작점 사이의 바이트 오프셋은 `bytesperline`입니다.
`V4L2_FMTDESC_FLAG_ENUM_ALL`을 지원하지 않는 드라이버는 이 비트를 지우지 않고 `EINVAL`을 반환합니다. 이 플래그는 플래그 유무에 따라 서로 다른 형식 목록을 실제로 반환할 수 있는 드라이버에서만 사용해야 합니다.
* - ``V4L2_FMT_FLAG_COMPRESSED``
- 0x0001
- This is a compressed format.
* - ``V4L2_FMT_FLAG_EMULATED``
- 0x0002
- This format is not native to the device but emulated through
software (usually libv4l2), where possible try to use a native
format instead for better performance.
* - ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
- 0x0004
- The hardware decoder for this compressed bytestream format (aka coded
format) is capable of parsing a continuous bytestream. Applications do
not need to parse the bytestream themselves to find the boundaries
between frames/fields.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to compressed
formats only. This flag is valid for stateful decoders only.
* - ``V4L2_FMT_FLAG_DYN_RESOLUTION``
- 0x0008
- Dynamic resolution switching is supported by the device for this
compressed bytestream format (aka coded format). It will notify the user
via the event ``V4L2_EVENT_SOURCE_CHANGE`` when changes in the video
parameters are detected.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
compressed formats only. This flag is valid for stateful codecs only.
* - ``V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL``
- 0x0010
- The hardware encoder supports setting the ``CAPTURE`` coded frame
interval separately from the ``OUTPUT`` raw frame interval.
Setting the ``OUTPUT`` raw frame interval with :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>`
also sets the ``CAPTURE`` coded frame interval to the same value.
If this flag is set, then the ``CAPTURE`` coded frame interval can be
set to a different value afterwards. This is typically used for
offline encoding where the ``OUTPUT`` raw frame interval is used as
a hint for reserving hardware encoder resources and the ``CAPTURE`` coded
frame interval is the actual frame rate embedded in the encoded video
stream.
This flag can only be used in combination with the
``V4L2_FMT_FLAG_COMPRESSED`` flag, since this applies to
compressed formats only. This flag is valid for stateful encoders only.
* - ``V4L2_FMT_FLAG_CSC_COLORSPACE``
- 0x0020
- The driver allows the application to try to change the default
colorspace. This flag is relevant only for capture devices.
The application can ask to configure the colorspace of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_XFER_FUNC``
- 0x0040
- The driver allows the application to try to change the default
transfer function. This flag is relevant only for capture devices.
The application can ask to configure the transfer function of the capture
device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_YCBCR_ENC``
- 0x0080
- The driver allows the application to try to change the default
Y'CbCr encoding. This flag is relevant only for capture devices.
The application can ask to configure the Y'CbCr encoding of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_HSV_ENC``
- 0x0080
- The driver allows the application to try to change the default
HSV encoding. This flag is relevant only for capture devices.
The application can ask to configure the HSV encoding of the capture device
when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_CSC_QUANTIZATION``
- 0x0100
- The driver allows the application to try to change the default
quantization. This flag is relevant only for capture devices.
The application can ask to configure the quantization of the capture
device when calling the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with
:ref:`V4L2_PIX_FMT_FLAG_SET_CSC <v4l2-pix-fmt-flag-set-csc>` set.
* - ``V4L2_FMT_FLAG_META_LINE_BASED``
- 0x0200
- The metadata format is line-based. In this case the ``width``,
``height`` and ``bytesperline`` fields of :c:type:`v4l2_meta_format` are
valid. The buffer consists of ``height`` lines, each having ``width``
Data Units of data and the offset (in bytes) between the beginning of
each two consecutive lines is ``bytesperline``.
* - ``V4L2_FMTDESC_FLAG_ENUM_ALL``
- 0x80000000
- When the applications ORs ``index`` with ``V4L2_FMTDESC_FLAG_ENUM_ALL`` flag
the driver enumerates all the possible pixel formats without taking care
of any already set configuration. Drivers which do not support this flag,
반환값과 EINVAL 조건
252-266성공하면 0을 반환합니다. 실패하면 -1을 반환하고 `errno`를 적절한 값으로 설정하며, 공통 오류는 Generic Error Codes 장의 정의를 따릅니다.
열거가 끝났거나 요청 조건을 지원하지 않을 때의 오류입니다.
always return ``EINVAL`` without clearing this flag.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
EINVAL
The struct :c:type:`v4l2_fmtdesc` ``type`` is not
supported or the ``index`` is out of bounds.
If ``V4L2_CAP_IO_MC`` is set and the specified ``mbus_code``
is unsupported, then also return this error code.
요약·해설
vidioc-enum-fmt.rst:1-266V4L2 이미지 형식을 순서대로 열거하는 방법과 media-controller 기반 mbus_code 필터, v4l2_fmtdesc 필드, 형식 플래그와 오류 조건을 설명합니다.