요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_SUBDEV_ENUM_FRAME_INTERVAL:
***************************************
ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
***************************************
Name
====
VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
Description
===========
This ioctl lets applications enumerate available frame intervals on a
given sub-device pad. Frame intervals only makes sense for sub-devices
that can control the frame period on their own. This includes, for
instance, image sensors and TV tuners.
For the common use case of image sensors, the frame intervals available
on the sub-device output pad depend on the frame format and size on the
same pad. Applications must thus specify the desired format and size
when enumerating frame intervals.
To enumerate frame intervals applications initialize the ``index``,
``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
:c:type:`v4l2_subdev_frame_interval_enum`
and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
to this structure. Drivers fill the rest of the structure or return an
EINVAL error code if one of the input fields is invalid. All frame
intervals are enumerable by beginning at index zero and incrementing by
one until ``EINVAL`` is returned.
Available frame intervals 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.
Sub-devices that support the frame interval enumeration ioctl should
implemented it on a single pad only. Its behaviour when supported on
multiple pads of the same sub-device is not defined.
.. c:type:: v4l2_subdev_frame_interval_enum
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_subdev_frame_interval_enum
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``index``
- Number of the format in the enumeration, set by the application.
* - __u32
- ``pad``
- Pad number as reported by the media controller API.
* - __u32
- ``code``
- The media bus format code, as defined in
:ref:`v4l2-mbus-format`.
* - __u32
- ``width``
- Frame width, in pixels.
* - __u32
- ``height``
- Frame height, in pixels.
* - struct :c:type:`v4l2_fract`
- ``interval``
- Period, in seconds, between consecutive video frames.
* - __u32
- ``which``
- Frame intervals to be enumerated, from enum
:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
* - __u32
- ``stream``
- Stream identifier.
* - __u32
- ``reserved``\ [7]
- Reserved for future extensions. Applications and drivers must set
the array to zero.
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_frame_interval_enum` ``pad`` references a
non-existing pad, the ``which`` field has an unsupported value, one of the
``code``, ``width`` or ``height`` fields are invalid for the given pad, or
the ``index`` field is out of bounds.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 인자
1-30`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL`은 지정한 서브디바이스 pad에서 사용할 수 있는 프레임 간격을 열거합니다. `argp`는 조건과 결과를 담는 `struct v4l2_subdev_frame_interval_enum`을 가리킵니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
***************************************
ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
***************************************
Name
====
VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_frame_interval_enum`.
열거 조건과 의존성
31-60프레임 간격은 이미지 센서나 TV 튜너처럼 자체적으로 프레임 주기를 제어할 수 있는 서브디바이스에만 의미가 있습니다.
이미지 센서의 출력 pad에서 가능한 간격은 같은 pad의 프레임 형식과 크기에 의존합니다. 따라서 응용 프로그램은 `index`, `pad`, `which`, `code`, `width`, `height`를 설정해 원하는 형식과 크기를 함께 지정해야 합니다.
열거는 `index = 0`에서 시작해 한 번에 1씩 증가시키며 호출합니다. 드라이버는 나머지 필드를 채우고, 입력 필드가 잘못되었거나 더 이상 항목이 없으면 `EINVAL`을 반환합니다.
가능한 간격은 다른 pad의 현재 try format과 활성 링크에도 달라질 수 있습니다. try format의 의미와 구성은 `VIDIOC_SUBDEV_G_FMT` 설명을 함께 확인해야 합니다.
이 ioctl을 지원하는 서브디바이스는 한 pad에서만 구현해야 합니다. 같은 서브디바이스의 여러 pad에서 지원할 때의 동작은 정의되어 있지 않습니다.
고정된 형식과 크기에 대해 인덱스를 순서대로 조회합니다.
Description
===========
This ioctl lets applications enumerate available frame intervals on a
given sub-device pad. Frame intervals only makes sense for sub-devices
that can control the frame period on their own. This includes, for
instance, image sensors and TV tuners.
For the common use case of image sensors, the frame intervals available
on the sub-device output pad depend on the frame format and size on the
same pad. Applications must thus specify the desired format and size
when enumerating frame intervals.
To enumerate frame intervals applications initialize the ``index``,
``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct
:c:type:`v4l2_subdev_frame_interval_enum`
and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer
to this structure. Drivers fill the rest of the structure or return an
EINVAL error code if one of the input fields is invalid. All frame
intervals are enumerable by beginning at index zero and incrementing by
one until ``EINVAL`` is returned.
Available frame intervals 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.
Sub-devices that support the frame interval enumeration ioctl should
implemented it on a single pad only. Its behaviour when supported on
multiple pads of the same sub-device is not defined.
struct v4l2_subdev_frame_interval_enum
61-100응용 프로그램이 설정할 선택 조건과 드라이버가 반환할 간격을 함께 담습니다.
`interval`은 `v4l2_fract`이므로 분자와 분모로 프레임 사이의 시간을 표현합니다. 프레임률을 비교할 때는 간격의 역수라는 점을 고려해야 합니다.
.. c:type:: v4l2_subdev_frame_interval_enum
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_subdev_frame_interval_enum
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``index``
- Number of the format in the enumeration, set by the application.
* - __u32
- ``pad``
- Pad number as reported by the media controller API.
* - __u32
- ``code``
- The media bus format code, as defined in
:ref:`v4l2-mbus-format`.
* - __u32
- ``width``
- Frame width, in pixels.
* - __u32
- ``height``
- Frame height, in pixels.
* - struct :c:type:`v4l2_fract`
- ``interval``
- Period, in seconds, between consecutive video frames.
* - __u32
- ``which``
- Frame intervals to be enumerated, from enum
:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
* - __u32
- ``stream``
- Stream identifier.
* - __u32
- ``reserved``\ [7]
- Reserved for future extensions. Applications and drivers must set
the array to zero.
반환값과 EINVAL
101-113성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다. `EINVAL`은 열거 종료 신호일 수도 있고 입력 조합 오류일 수도 있으므로 현재 인덱스와 필드를 함께 검사해야 합니다.
pad와 형식 조건 또는 인덱스가 유효하지 않을 때 반환됩니다.
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_frame_interval_enum` ``pad`` references a
non-existing pad, the ``which`` field has an unsupported value, one of the
``code``, ``width`` or ``height`` fields are invalid for the given pad, or
the ``index`` field is out of bounds.
요약·해설
vidioc-subdev-enum-frame-interval.rst:1-113열거 결과는 pad 하나만의 고정 목록이 아니라 형식, 크기, 다른 pad의 try format과 활성 링크에 의존하는 현재 파이프라인 조건의 결과입니다.