← Documents Documentation/userspace-api/media/v4l/vidioc-subdev-enum-mbus-code.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl

서브디바이스 pad의 media-bus 형식 코드와 색 공간 변환 관련 flags를 열거하는 절차를 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/vidioc-subdev-enum-mbus-code.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

vidioc-subdev-enum-mbus-code.rst:1-163

형식 code 목록은 pad마다 고유하며 파이프라인의 try format과 활성 링크에 따라 달라질 수 있으므로 구성 시점의 결과를 사용해야 합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_SUBDEV_ENUM_MBUS_CODE:
5
6 **********************************
7 ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
8 **********************************
9
10 Name
11 ====
12
13 VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
19
20 ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by :c:func:`open()`.
27
28 ``argp``
29 Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`.
30
31 Description
32 ===========
33
34 This call is used by the application to access the enumeration
35 of media bus formats for the selected pad.
36
37 The enumerations are defined by the driver, and indexed using the ``index`` field
38 of struct :c:type:`v4l2_subdev_mbus_code_enum`.
39 Each enumeration starts with the ``index`` of 0, and
40 the lowest invalid index marks the end of enumeration.
41
42 Therefore, to enumerate media bus formats available at a given sub-device pad,
43 initialize the ``pad``, and ``which`` fields to desired values,
44 and set ``index`` to 0.
45 Then call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl
46 with a pointer to this structure.
47
48 A successful call will return with the ``code`` field filled in
49 with a mbus code value.
50 Repeat with increasing ``index`` until ``EINVAL`` is received.
51 ``EINVAL`` means that either ``pad`` is invalid,
52 or that there are no more codes available at this pad.
53
54 The driver must not return the same value of ``code`` for different indices
55 at the same pad.
56
57 Available media bus formats may depend on the current 'try' formats at
58 other pads of the sub-device, as well as on the current active links.
59 See :ref:`VIDIOC_SUBDEV_G_FMT` for more
60 information about the try formats.
61
62 .. c:type:: v4l2_subdev_mbus_code_enum
63
64 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
65
66 .. flat-table:: struct v4l2_subdev_mbus_code_enum
67 :header-rows: 0
68 :stub-columns: 0
69 :widths: 1 1 2
70
71 * - __u32
72 - ``pad``
73 - Pad number as reported by the media controller API. Filled in by the
74 application.
75 * - __u32
76 - ``index``
77 - Index of the mbus code in the enumeration belonging to the given pad.
78 Filled in by the application.
79 * - __u32
80 - ``code``
81 - The media bus format code, as defined in
82 :ref:`v4l2-mbus-format`. Filled in by the driver.
83 * - __u32
84 - ``which``
85 - Media bus format codes to be enumerated, from enum
86 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
87 * - __u32
88 - ``flags``
89 - See :ref:`v4l2-subdev-mbus-code-flags`
90 * - __u32
91 - ``stream``
92 - Stream identifier.
93 * - __u32
94 - ``reserved``\ [6]
95 - Reserved for future extensions. Applications and drivers must set
96 the array to zero.
97
98
99
100 .. raw:: latex
101
102 \footnotesize
103
104 .. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|
105
106 .. _v4l2-subdev-mbus-code-flags:
107
108 .. flat-table:: Subdev Media Bus Code Enumerate Flags
109 :header-rows: 0
110 :stub-columns: 0
111 :widths: 1 1 2
112
113 * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
114 - 0x00000001
115 - The driver allows the application to try to change the default colorspace
116 encoding. The application can ask to configure the colorspace of the
117 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
118 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
119 See :ref:`v4l2-mbus-format` on how to do this.
120 * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
121 - 0x00000002
122 - The driver allows the application to try to change the default transform function.
123 The application can ask to configure the transform function of
124 the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
125 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
126 See :ref:`v4l2-mbus-format` on how to do this.
127 * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
128 - 0x00000004
129 - The driver allows the application to try to change the default Y'CbCr
130 encoding. The application can ask to configure the Y'CbCr encoding of the
131 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
132 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
133 See :ref:`v4l2-mbus-format` on how to do this.
134 * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
135 - 0x00000004
136 - The driver allows the application to try to change the default HSV
137 encoding. The application can ask to configure the HSV encoding of the
138 subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
139 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
140 See :ref:`v4l2-mbus-format` on how to do this.
141 * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
142 - 0x00000008
143 - The driver allows the application to try to change the default
144 quantization. The application can ask to configure the quantization of
145 the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
146 ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
147 See :ref:`v4l2-mbus-format` on how to do this.
148
149 .. raw:: latex
150
151 \normalsize
152
153 Return Value
154 ============
155
156 On success 0 is returned, on error -1 and the ``errno`` variable is set
157 appropriately. The generic error codes are described at the
158 :ref:`Generic Error Codes <gen-errors>` chapter.
159
160 EINVAL
161 The struct :c:type:`v4l2_subdev_mbus_code_enum` ``pad`` references a
162 non-existing pad, the ``which`` field has an unsupported value, or the
163 ``index`` field is out of bounds.
164

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

목적, 호출 형식과 인자

1-30

`VIDIOC_SUBDEV_ENUM_MBUS_CODE`는 선택한 서브디바이스 pad에서 사용할 수 있는 media-bus 형식 코드를 열거합니다. `argp`는 `struct v4l2_subdev_mbus_code_enum`을 가리킵니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L

.. _VIDIOC_SUBDEV_ENUM_MBUS_CODE:

**********************************
ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
**********************************

Name
====

VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats

Synopsis
========

.. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE

``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`.

열거 규칙과 파이프라인 의존성

31-60

드라이버가 pad별 열거 목록을 정의하며 `index = 0`에서 시작합니다. 응용 프로그램은 `pad`와 `which`를 설정한 뒤 인덱스를 1씩 늘려 호출합니다.

성공하면 드라이버가 `code`에 media-bus 형식 코드를 채웁니다. `EINVAL`은 pad가 잘못되었거나 해당 pad에서 더 이상 반환할 코드가 없음을 나타냅니다.

같은 pad의 서로 다른 인덱스에서 드라이버가 동일한 `code`를 중복 반환해서는 안 됩니다. 따라서 성공한 각 인덱스는 고유한 형식 항목입니다.

사용 가능한 형식은 다른 pad의 try format과 현재 활성 링크에 의존할 수 있습니다. `VIDIOC_SUBDEV_G_FMT`의 try format 규칙을 함께 적용해야 합니다.

media-bus 코드 열거
pad와 which 선택index를 0으로 초기화성공한 code와 flags 기록중복 없이 index를 증가EINVAL에서 열거 종료 또는 pad 오류 확인

pad와 which를 고정하고 인덱스를 증가시킵니다.

Description
===========

This call is used by the application to access the enumeration
of media bus formats for the selected pad.

The enumerations are defined by the driver, and indexed using the ``index`` field
of struct :c:type:`v4l2_subdev_mbus_code_enum`.
Each enumeration starts with the ``index`` of 0, and
the lowest invalid index marks the end of enumeration.

Therefore, to enumerate media bus formats available at a given sub-device pad,
initialize the ``pad``, and ``which`` fields to desired values,
and set ``index`` to 0.
Then call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl
with a pointer to this structure.

A successful call will return with the ``code`` field filled in
with a mbus code value.
Repeat with increasing ``index`` until ``EINVAL`` is received.
``EINVAL`` means that either ``pad`` is invalid,
or that there are no more codes available at this pad.

The driver must not return the same value of ``code`` for different indices
at the same pad.

Available media bus formats may depend on the current 'try' formats at
other pads of the sub-device, as well as on the current active links.
See :ref:`VIDIOC_SUBDEV_G_FMT` for more
information about the try formats.

struct v4l2_subdev_mbus_code_enum

61-97
media-bus 코드 열거 구조체
형식필드설정 주체와 의미
`__u32``pad`응용 프로그램: Media Controller API가 보고한 pad 번호
`__u32``index`응용 프로그램: 해당 pad 열거 목록의 인덱스
`__u32``code`드라이버: media-bus 형식 코드
`__u32``which`응용 프로그램: `v4l2_subdev_format_whence`에 따른 열거 상태
`__u32``flags`드라이버: 해당 code에서 허용하는 색 표현 변경 기능
`__u32``stream`스트림 식별자
`__u32[6]``reserved[6]`향후 확장용이며 응용 프로그램과 드라이버가 모두 0으로 설정

응용 프로그램이 지정할 조건과 드라이버가 채울 결과입니다.


.. c:type:: v4l2_subdev_mbus_code_enum

.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|

.. flat-table:: struct v4l2_subdev_mbus_code_enum
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``pad``
      - Pad number as reported by the media controller API. Filled in by the
        application.
    * - __u32
      - ``index``
      - Index of the mbus code in the enumeration belonging to the given pad.
        Filled in by the application.
    * - __u32
      - ``code``
      - The media bus format code, as defined in
	:ref:`v4l2-mbus-format`. Filled in by the driver.
    * - __u32
      - ``which``
      - Media bus format codes to be enumerated, from enum
	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
    * - __u32
      - ``flags``
      - See :ref:`v4l2-subdev-mbus-code-flags`
    * - __u32
      - ``stream``
      - Stream identifier.
    * - __u32
      - ``reserved``\ [6]
      - Reserved for future extensions. Applications and drivers must set
	the array to zero.

색 공간 변환 관련 flags

98-151

다음 flags는 `VIDIOC_SUBDEV_S_FMT`를 호출할 때 `V4L2_MBUS_FRAMEFMT_SET_CSC`를 설정해 기본 색 표현의 특정 요소를 변경하도록 시도할 수 있음을 알립니다. 실제 구성 절차는 `v4l2-mbus-format` 규칙을 따릅니다.

Subdev Media Bus Code Enumerate Flags
flag허용되는 변경
`V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE``0x00000001`기본 colorspace encoding
`V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC``0x00000002`기본 transfer function
`V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC``0x00000004`기본 Y'CbCr encoding
`V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC``0x00000004`기본 HSV encoding
`V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION``0x00000008`기본 quantization

각 비트는 응용 프로그램이 변경을 요청할 수 있는 색 표현 요소를 나타냅니다.

Y'CbCr와 HSV encoding flag는 원문 정의상 모두 `0x00000004`를 사용합니다. 현재 code가 나타내는 색 표현에 따라 해당 의미를 해석해야 합니다.



.. raw:: latex

   \footnotesize

.. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|

.. _v4l2-subdev-mbus-code-flags:

.. flat-table:: Subdev Media Bus Code Enumerate Flags
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
      - 0x00000001
      - The driver allows the application to try to change the default colorspace
	encoding. The application can ask to configure the colorspace of the
	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
	See :ref:`v4l2-mbus-format` on how to do this.
    * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
      - 0x00000002
      - The driver allows the application to try to change the default transform function.
	The application can ask to configure the transform function of
	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
	See :ref:`v4l2-mbus-format` on how to do this.
    * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
      - 0x00000004
      - The driver allows the application to try to change the default Y'CbCr
	encoding. The application can ask to configure the Y'CbCr encoding of the
	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
	See :ref:`v4l2-mbus-format` on how to do this.
    * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
      - 0x00000004
      - The driver allows the application to try to change the default HSV
	encoding. The application can ask to configure the HSV encoding of the
	subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
	See :ref:`v4l2-mbus-format` on how to do this.
    * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
      - 0x00000008
      - The driver allows the application to try to change the default
	quantization. The application can ask to configure the quantization of
	the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
	ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
	See :ref:`v4l2-mbus-format` on how to do this.

.. raw:: latex

   \normalsize

반환값과 EINVAL

152-163

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다.

media-bus 코드 열거의 EINVAL
검사 대상오류 조건
`pad`존재하지 않는 pad를 참조함
`which`지원되지 않는 값을 사용함
`index`열거 범위를 벗어남

pad, which 또는 index가 유효하지 않을 때 반환됩니다.


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_subdev_mbus_code_enum` ``pad`` references a
    non-existing pad, the ``which`` field has an unsupported value, or the
    ``index`` field is out of bounds.