← Documents Documentation/userspace-api/media/v4l/vidioc-subdev-g-frame-interval.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_SUBDEV_G_FRAME_INTERVAL 및 VIDIOC_SUBDEV_S_FRAME_INTERVAL ioctl

서브디바이스 프레임 간격의 조회·설정, TRY·ACTIVE 상태와 형식 변경 간 영향 관계를 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/vidioc-subdev-g-frame-interval.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

vidioc-subdev-g-frame-interval.rst:1-126

프레임 간격을 바꿔도 형식은 유지되어야 하지만 형식을 바꾸면 간격은 달라질 수 있다는 단방향 규칙이 재구성 순서를 결정합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_SUBDEV_G_FRAME_INTERVAL:
5
6 ********************************************************************
7 ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
8 ********************************************************************
9
10 Name
11 ====
12
13 VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_SUBDEV_G_FRAME_INTERVAL
19
20 ``int ioctl(int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
21
22 .. c:macro:: VIDIOC_SUBDEV_S_FRAME_INTERVAL
23
24 ``int ioctl(int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp)``
25
26 Arguments
27 =========
28
29 ``fd``
30 File descriptor returned by :c:func:`open()`.
31
32 ``argp``
33 Pointer to struct :c:type:`v4l2_subdev_frame_interval`.
34
35 Description
36 ===========
37
38 These ioctls are used to get and set the frame interval at specific
39 subdev pads in the image pipeline. The frame interval only makes sense
40 for sub-devices that can control the frame period on their own. This
41 includes, for instance, image sensors and TV tuners. Sub-devices that
42 don't support frame intervals must not implement these ioctls.
43
44 To retrieve the current frame interval applications set the ``pad``
45 field of a struct
46 :c:type:`v4l2_subdev_frame_interval` to
47 the desired pad number as reported by the media controller API. When
48 they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to
49 this structure the driver fills the members of the ``interval`` field.
50
51 To change the current frame interval applications set both the ``pad``
52 field and all members of the ``interval`` field. When they call the
53 ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this
54 structure the driver verifies the requested interval, adjusts it based
55 on the hardware capabilities and configures the device. Upon return the
56 struct
57 :c:type:`v4l2_subdev_frame_interval`
58 contains the current frame interval as would be returned by a
59 ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call.
60
61 If the subdev device node has been registered in read-only mode, calls to
62 ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` are only valid if the ``which`` field is set
63 to ``V4L2_SUBDEV_FORMAT_TRY``, otherwise an error is returned and the errno
64 variable is set to ``-EPERM``.
65
66 Drivers must not return an error solely because the requested interval
67 doesn't match the device capabilities. They must instead modify the
68 interval to match what the hardware can provide. The modified interval
69 should be as close as possible to the original request.
70
71 Changing the frame interval shall never change the format. Changing the
72 format, on the other hand, may change the frame interval.
73
74 Sub-devices that support the frame interval ioctls should implement them
75 on a single pad only. Their behaviour when supported on multiple pads of
76 the same sub-device is not defined.
77
78 .. c:type:: v4l2_subdev_frame_interval
79
80 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
81
82 .. flat-table:: struct v4l2_subdev_frame_interval
83 :header-rows: 0
84 :stub-columns: 0
85 :widths: 1 1 2
86
87 * - __u32
88 - ``pad``
89 - Pad number as reported by the media controller API.
90 * - struct :c:type:`v4l2_fract`
91 - ``interval``
92 - Period, in seconds, between consecutive video frames.
93 * - __u32
94 - ``stream``
95 - Stream identifier.
96 * - __u32
97 - ``which``
98 - Active or try frame interval, from enum
99 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
100 * - __u32
101 - ``reserved``\ [7]
102 - Reserved for future extensions. Applications and drivers must set
103 the array to zero.
104
105 Return Value
106 ============
107
108 On success 0 is returned, on error -1 and the ``errno`` variable is set
109 appropriately. The generic error codes are described at the
110 :ref:`Generic Error Codes <gen-errors>` chapter.
111
112 EBUSY
113 The frame interval can't be changed because the pad is currently
114 busy. This can be caused, for instance, by an active video stream on
115 the pad. The ioctl must not be retried without performing another
116 action to fix the problem first. Only returned by
117 ``VIDIOC_SUBDEV_S_FRAME_INTERVAL``
118
119 EINVAL
120 The struct :c:type:`v4l2_subdev_frame_interval` ``pad`` references a
121 non-existing pad, the ``which`` field has an unsupported value, or the pad
122 doesn't support frame intervals.
123
124 EPERM
125 The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only
126 subdevice and the ``which`` field is set to ``V4L2_SUBDEV_FORMAT_ACTIVE``.
127

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에서 지원할 때의 동작은 정의되어 있지 않습니다.

형식과 프레임 간격의 영향 방향
S_FRAME_INTERVAL로 간격 변경드라이버가 지원 간격으로 조정프레임 형식은 그대로 유지S_FMT로 형식 변경 시에는 간격이 바뀔 수 있음필요하면 G_FRAME_INTERVAL로 현재 값 재조회

두 속성의 변경 관계는 대칭이 아닙니다.

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-103
서브디바이스 프레임 간격 구조체
형식필드의미
`__u32``pad`Media Controller API가 보고한 pad 번호
`struct v4l2_fract``interval`연속 비디오 프레임 사이의 초 단위 주기
`__u32``stream`스트림 식별자
`__u32``which``v4l2_subdev_format_whence`에 따른 ACTIVE 또는 TRY 간격
`__u32[7]``reserved[7]`향후 확장용이며 응용 프로그램과 드라이버가 모두 0으로 설정

pad, 주기, 스트림과 상태를 지정합니다.

`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`를 설정합니다.

Frame interval ioctl 오류
errno조건
`EBUSY`활성 스트림 등으로 pad가 사용 중이라 간격을 바꿀 수 없음. 문제를 해결하는 다른 동작 전에는 재시도하지 않으며 S_FRAME_INTERVAL만 반환
`EINVAL`pad가 없거나 which가 미지원이거나 해당 pad가 프레임 간격을 지원하지 않음
`EPERM`읽기 전용 서브디바이스에서 S_FRAME_INTERVAL로 ACTIVE 간격을 변경하려 함

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``.