요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_G_FRAME_INTERVAL:
********************************************************************
ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
********************************************************************
Name
====
VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_G_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
.. c:macro:: VIDIOC_SUBDEV_S_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_frame_interval`.
Description
===========
These ioctls are used to get and set the frame interval at specific
subdev pads in the image pipeline. The frame interval only makes sense
for sub-devices that can control the frame period on their own. This
includes, for instance, image sensors and TV tuners. Sub-devices that
don't support frame intervals must not implement these ioctls.
To retrieve the current frame interval applications set the ``pad``
field of a struct
:c:type:`v4l2_subdev_frame_interval` to
the desired pad number as reported by the media controller API. When
they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to
this structure the driver fills the members of the ``interval`` field.
To change the current frame interval applications set both the ``pad``
field and all members of the ``interval`` field. When they call the
``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this
structure the driver verifies the requested interval, adjusts it based
on the hardware capabilities and configures the device. Upon return the
struct
:c:type:`v4l2_subdev_frame_interval`
contains the current frame interval as would be returned by a
``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call.
If the subdev device node has been registered in read-only mode, calls to
``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` are only valid if the ``which`` field is set
to ``V4L2_SUBDEV_FORMAT_TRY``, otherwise an error is returned and the errno
variable is set to ``-EPERM``.
Drivers must not return an error solely because the requested interval
doesn't match the device capabilities. They must instead modify the
interval to match what the hardware can provide. The modified interval
should be as close as possible to the original request.
Changing the frame interval shall never change the format. Changing the
format, on the other hand, may change the frame interval.
Sub-devices that support the frame interval ioctls should implement them
on a single pad only. Their behaviour when supported on multiple pads of
the same sub-device is not defined.
.. c:type:: v4l2_subdev_frame_interval
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_subdev_frame_interval
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``pad``
- Pad number as reported by the media controller API.
* - struct :c:type:`v4l2_fract`
- ``interval``
- Period, in seconds, between consecutive video frames.
* - __u32
- ``stream``
- Stream identifier.
* - __u32
- ``which``
- Active or try frame interval, from enum
:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
* - __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.
EBUSY
The frame interval can't be changed because the pad is currently
busy. This can be caused, for instance, by an active video stream on
the pad. The ioctl must not be retried without performing another
action to fix the problem first. Only returned by
``VIDIOC_SUBDEV_S_FRAME_INTERVAL``
EINVAL
The struct :c:type:`v4l2_subdev_frame_interval` ``pad`` references a
non-existing pad, the ``which`` field has an unsupported value, or the pad
doesn't support frame intervals.
EPERM
The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only
subdevice and the ``which`` field is set to ``V4L2_SUBDEV_FORMAT_ACTIVE``.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 적용 대상
1-43`VIDIOC_SUBDEV_G_FRAME_INTERVAL`과 `VIDIOC_SUBDEV_S_FRAME_INTERVAL`은 이미지 파이프라인의 특정 서브디바이스 pad에서 프레임 간격을 조회하거나 설정합니다. `argp`는 `struct v4l2_subdev_frame_interval`을 가리킵니다.
프레임 간격은 이미지 센서와 TV 튜너처럼 자체적으로 프레임 주기를 제어할 수 있는 서브디바이스에만 의미가 있습니다. 이를 지원하지 않는 서브디바이스는 이 ioctl을 구현해서는 안 됩니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_SUBDEV_G_FRAME_INTERVAL:
********************************************************************
ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
********************************************************************
Name
====
VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_G_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
.. c:macro:: VIDIOC_SUBDEV_S_FRAME_INTERVAL
``int ioctl(int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_frame_interval`.
Description
===========
These ioctls are used to get and set the frame interval at specific
subdev pads in the image pipeline. The frame interval only makes sense
for sub-devices that can control the frame period on their own. This
includes, for instance, image sensors and TV tuners. Sub-devices that
don't support frame intervals must not implement these ioctls.
간격 조회·설정과 형식 관계
44-77현재 간격을 조회하려면 `pad`를 설정하고 G_FRAME_INTERVAL을 호출합니다. 드라이버는 연속 프레임 사이의 주기를 나타내는 `interval`을 채웁니다.
간격을 바꾸려면 `pad`와 `interval`의 모든 멤버를 설정해 S_FRAME_INTERVAL을 호출합니다. 드라이버는 하드웨어가 지원하는 가장 가까운 값으로 조정해 적용하고 현재 간격을 구조체에 되돌려 줍니다.
읽기 전용 노드의 S_FRAME_INTERVAL은 `which = V4L2_SUBDEV_FORMAT_TRY`일 때만 허용됩니다. ACTIVE 간격을 바꾸려 하면 `EPERM`입니다.
간격 변경은 절대로 형식을 바꾸지 않아야 합니다. 반대로 형식을 변경하면 프레임 간격이 달라질 수 있으므로, 형식 설정 뒤에는 간격을 다시 조회해야 할 수 있습니다.
이 ioctl을 지원하는 서브디바이스는 한 pad에서만 구현해야 합니다. 같은 서브디바이스의 여러 pad에서 지원할 때의 동작은 정의되어 있지 않습니다.
두 속성의 변경 관계는 대칭이 아닙니다.
To retrieve the current frame interval applications set the ``pad``
field of a struct
:c:type:`v4l2_subdev_frame_interval` to
the desired pad number as reported by the media controller API. When
they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to
this structure the driver fills the members of the ``interval`` field.
To change the current frame interval applications set both the ``pad``
field and all members of the ``interval`` field. When they call the
``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this
structure the driver verifies the requested interval, adjusts it based
on the hardware capabilities and configures the device. Upon return the
struct
:c:type:`v4l2_subdev_frame_interval`
contains the current frame interval as would be returned by a
``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call.
If the subdev device node has been registered in read-only mode, calls to
``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` are only valid if the ``which`` field is set
to ``V4L2_SUBDEV_FORMAT_TRY``, otherwise an error is returned and the errno
variable is set to ``-EPERM``.
Drivers must not return an error solely because the requested interval
doesn't match the device capabilities. They must instead modify the
interval to match what the hardware can provide. The modified interval
should be as close as possible to the original request.
Changing the frame interval shall never change the format. Changing the
format, on the other hand, may change the frame interval.
Sub-devices that support the frame interval ioctls should implement them
on a single pad only. Their behaviour when supported on multiple pads of
the same sub-device is not defined.
struct v4l2_subdev_frame_interval
78-103pad, 주기, 스트림과 상태를 지정합니다.
`interval`은 프레임률이 아니라 프레임 사이의 시간입니다. `v4l2_fract`의 분자와 분모로 초 단위 주기를 나타내므로 프레임률은 그 역수로 계산합니다.
.. c:type:: v4l2_subdev_frame_interval
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. flat-table:: struct v4l2_subdev_frame_interval
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``pad``
- Pad number as reported by the media controller API.
* - struct :c:type:`v4l2_fract`
- ``interval``
- Period, in seconds, between consecutive video frames.
* - __u32
- ``stream``
- Stream identifier.
* - __u32
- ``which``
- Active or try frame interval, from enum
:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
* - __u32
- ``reserved``\ [7]
- Reserved for future extensions. Applications and drivers must set
the array to zero.
반환값과 오류
104-126성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다.
S_FRAME_INTERVAL 전용 상태 오류와 공통 입력 오류입니다.
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.
EBUSY
The frame interval can't be changed because the pad is currently
busy. This can be caused, for instance, by an active video stream on
the pad. The ioctl must not be retried without performing another
action to fix the problem first. Only returned by
``VIDIOC_SUBDEV_S_FRAME_INTERVAL``
EINVAL
The struct :c:type:`v4l2_subdev_frame_interval` ``pad`` references a
non-existing pad, the ``which`` field has an unsupported value, or the pad
doesn't support frame intervals.
EPERM
The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only
subdevice and the ``which`` field is set to ``V4L2_SUBDEV_FORMAT_ACTIVE``.
요약·해설
vidioc-subdev-g-frame-interval.rst:1-126프레임 간격을 바꿔도 형식은 유지되어야 하지만 형식을 바꾸면 간격은 달라질 수 있다는 단방향 규칙이 재구성 순서를 결정합니다.