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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_ENUM_FRAMEINTERVALS ioctl

지정한 V4L2 pixel format과 frame size의 discrete, step-wise, continuous frame interval을 열거하고 구조체와 유형별 index 규칙을 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-enum-frameintervals.rst:1-186

지정한 V4L2 pixel format과 frame size의 discrete, step-wise, continuous frame interval을 열거하고 구조체와 유형별 index 규칙을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_ENUM_FRAMEINTERVALS:
5
6 ********************************
7 ioctl VIDIOC_ENUM_FRAMEINTERVALS
8 ********************************
9
10 Name
11 ====
12
13 VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS
19
20 ``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *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_frmivalenum`
30 that contains a pixel format and size and receives a frame interval.
31
32 Description
33 ===========
34
35 This ioctl allows applications to enumerate all frame intervals that the
36 device supports for the given pixel format and frame size.
37
38 The supported pixel formats and frame sizes can be obtained by using the
39 :ref:`VIDIOC_ENUM_FMT` and
40 :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
41
42 The return value and the content of the ``v4l2_frmivalenum.type`` field
43 depend on the type of frame intervals the device supports. Here are the
44 semantics of the function for the different cases:
45
46 - **Discrete:** The function returns success if the given index value
47 (zero-based) is valid. The application should increase the index by
48 one for each call until ``EINVAL`` is returned. The
49 `v4l2_frmivalenum.type` field is set to
50 `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
51 the `discrete` member is valid.
52
53 - **Step-wise:** The function returns success if the given index value
54 is zero and ``EINVAL`` for any other index value. The
55 ``v4l2_frmivalenum.type`` field is set to
56 ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
57 ``stepwise`` member is valid.
58
59 - **Continuous:** This is a special case of the step-wise type above.
60 The function returns success if the given index value is zero and
61 ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
62 field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
63 the union only the ``stepwise`` member is valid and the ``step``
64 value is set to 1.
65
66 When the application calls the function with index zero, it must check
67 the ``type`` field to determine the type of frame interval enumeration
68 the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
69 does it make sense to increase the index value to receive more frame
70 intervals.
71
72 .. note::
73
74 The order in which the frame intervals are returned has no
75 special meaning. In particular does it not say anything about potential
76 default frame intervals.
77
78 Applications can assume that the enumeration data does not change
79 without any interaction from the application itself. This means that the
80 enumeration data is consistent if the application does not perform any
81 other ioctl calls while it runs the frame interval enumeration.
82
83 .. note::
84
85 **Frame intervals and frame rates:** The V4L2 API uses frame
86 intervals instead of frame rates. Given the frame interval the frame
87 rate can be computed as follows:
88
89 ::
90
91 frame_rate = 1 / frame_interval
92
93 Structs
94 =======
95
96 In the structs below, *IN* denotes a value that has to be filled in by
97 the application, *OUT* denotes values that the driver fills in. The
98 application should zero out all members except for the *IN* fields.
99
100 .. c:type:: v4l2_frmival_stepwise
101
102 .. flat-table:: struct v4l2_frmival_stepwise
103 :header-rows: 0
104 :stub-columns: 0
105 :widths: 1 1 2
106
107 * - struct :c:type:`v4l2_fract`
108 - ``min``
109 - Minimum frame interval [s].
110 * - struct :c:type:`v4l2_fract`
111 - ``max``
112 - Maximum frame interval [s].
113 * - struct :c:type:`v4l2_fract`
114 - ``step``
115 - Frame interval step size [s].
116
117
118 .. c:type:: v4l2_frmivalenum
119
120 .. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}|
121
122 .. flat-table:: struct v4l2_frmivalenum
123 :header-rows: 0
124 :stub-columns: 0
125
126 * - __u32
127 - ``index``
128 - IN: Index of the given frame interval in the enumeration.
129 * - __u32
130 - ``pixel_format``
131 - IN: Pixel format for which the frame intervals are enumerated.
132 * - __u32
133 - ``width``
134 - IN: Frame width for which the frame intervals are enumerated.
135 * - __u32
136 - ``height``
137 - IN: Frame height for which the frame intervals are enumerated.
138 * - __u32
139 - ``type``
140 - OUT: Frame interval type the device supports.
141 * - union {
142 - (anonymous)
143 - OUT: Frame interval with the given index.
144 * - struct :c:type:`v4l2_fract`
145 - ``discrete``
146 - Frame interval [s].
147 * - struct :c:type:`v4l2_frmival_stepwise`
148 - ``stepwise``
149 -
150 * - }
151 -
152 -
153 * - __u32
154 - ``reserved[2]``
155 - Reserved space for future use. Must be zeroed by drivers and
156 applications.
157
158
159 Enums
160 =====
161
162 .. c:type:: v4l2_frmivaltypes
163
164 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
165
166 .. flat-table:: enum v4l2_frmivaltypes
167 :header-rows: 0
168 :stub-columns: 0
169 :widths: 3 1 4
170
171 * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
172 - 1
173 - Discrete frame interval.
174 * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
175 - 2
176 - Continuous frame interval.
177 * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
178 - 3
179 - Step-wise defined frame interval.
180
181 Return Value
182 ============
183
184 On success 0 is returned, on error -1 and the ``errno`` variable is set
185 appropriately. The generic error codes are described at the
186 :ref:`Generic Error Codes <gen-errors>` chapter.
187

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-31

`VIDIOC_ENUM_FRAMEINTERVALS`는 지정한 pixel format과 frame size에 대해 장치가 지원하는 모든 frame interval을 열거하는 ioctl입니다. 호출 형식은 `int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)`입니다.

`fd`는 `open()`이 반환한 파일 디스크립터입니다. `argp`는 응용 프로그램이 pixel format과 크기를 넣고 드라이버로부터 frame interval을 돌려받는 `struct v4l2_frmivalenum`을 가리킵니다.

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

.. _VIDIOC_ENUM_FRAMEINTERVALS:

********************************
ioctl VIDIOC_ENUM_FRAMEINTERVALS
********************************

Name
====

VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals

Synopsis
========

.. c:macro:: VIDIOC_ENUM_FRAMEINTERVALS

``int ioctl(int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp)``

Arguments
=========

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

``argp``
    Pointer to struct :c:type:`v4l2_frmivalenum`
    that contains a pixel format and size and receives a frame interval.

열거 방식과 일관성

32-92

지원 pixel format은 `VIDIOC_ENUM_FMT`로, 지원 frame size는 `VIDIOC_ENUM_FRAMESIZES`로 먼저 얻습니다. 이 ioctl의 반환 방식과 `v4l2_frmivalenum.type`의 내용은 장치가 제공하는 frame interval 유형에 따라 달라집니다.

Frame interval 열거 방식
유형typeindex와 유효 union 멤버
Discrete`V4L2_FRMIVAL_TYPE_DISCRETE`0부터 시작해 호출마다 1씩 증가하고 `EINVAL`까지 반복; `discrete`만 유효
Step-wise`V4L2_FRMIVAL_TYPE_STEPWISE`index 0에서만 성공하고 다른 값은 `EINVAL`; `stepwise`만 유효
Continuous`V4L2_FRMIVAL_TYPE_CONTINUOUS`step-wise의 특수 사례로 index 0에서만 성공; `stepwise`만 유효하고 `step`은 1

첫 호출의 type과 index 처리 규칙을 비교합니다.

응용 프로그램은 `index` 0으로 처음 호출한 뒤 반드시 `type`을 검사해야 합니다. 더 많은 interval을 얻기 위해 `index`를 증가시키는 방식은 `V4L2_FRMIVAL_TYPE_DISCRETE`일 때만 의미가 있습니다.

frame interval이 반환되는 순서에는 특별한 의미가 없으며 기본 interval의 우선순위를 나타내지도 않습니다. 응용 프로그램이 열거 도중 다른 ioctl을 호출하지 않는다면 열거 데이터는 스스로 바뀌지 않고 일관되다고 가정할 수 있습니다.

V4L2 API는 frame rate가 아니라 frame interval을 사용합니다. frame rate는 `frame_rate = 1 / frame_interval`로 계산하므로 interval이 짧을수록 초당 frame 수가 많습니다.

Frame interval 조회
pixel_format, width, height 설정index=0, 나머지 필드=0VIDIOC_ENUM_FRAMEINTERVALS 호출type 확인Discrete면 index 증가 반복Step-wise/Continuous면 min, max, step 처리

유형을 판별한 뒤 discrete 목록 또는 범위 정보를 처리하는 흐름입니다.

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

This ioctl allows applications to enumerate all frame intervals that the
device supports for the given pixel format and frame size.

The supported pixel formats and frame sizes can be obtained by using the
:ref:`VIDIOC_ENUM_FMT` and
:ref:`VIDIOC_ENUM_FRAMESIZES` functions.

The return value and the content of the ``v4l2_frmivalenum.type`` field
depend on the type of frame intervals the device supports. Here are the
semantics of the function for the different cases:

-  **Discrete:** The function returns success if the given index value
   (zero-based) is valid. The application should increase the index by
   one for each call until ``EINVAL`` is returned. The
   `v4l2_frmivalenum.type` field is set to
   `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
   the `discrete` member is valid.

-  **Step-wise:** The function returns success if the given index value
   is zero and ``EINVAL`` for any other index value. The
   ``v4l2_frmivalenum.type`` field is set to
   ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
   ``stepwise`` member is valid.

-  **Continuous:** This is a special case of the step-wise type above.
   The function returns success if the given index value is zero and
   ``EINVAL`` for any other index value. The ``v4l2_frmivalenum.type``
   field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
   the union only the ``stepwise`` member is valid and the ``step``
   value is set to 1.

When the application calls the function with index zero, it must check
the ``type`` field to determine the type of frame interval enumeration
the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
does it make sense to increase the index value to receive more frame
intervals.

.. note::

   The order in which the frame intervals are returned has no
   special meaning. In particular does it not say anything about potential
   default frame intervals.

Applications can assume that the enumeration data does not change
without any interaction from the application itself. This means that the
enumeration data is consistent if the application does not perform any
other ioctl calls while it runs the frame interval enumeration.

.. note::

   **Frame intervals and frame rates:** The V4L2 API uses frame
   intervals instead of frame rates. Given the frame interval the frame
   rate can be computed as follows:

   ::

       frame_rate = 1 / frame_interval

v4l2_frmival_stepwise 구조체

93-117

아래 구조체에서 응용 프로그램은 IN 필드만 채우고 나머지 멤버는 모두 0으로 초기화해야 합니다. OUT 필드는 드라이버가 채웁니다. `v4l2_frmival_stepwise`는 지원 interval 범위를 초 단위의 `v4l2_fract` 값으로 표현합니다.

struct v4l2_frmival_stepwise
형식필드의미
`struct v4l2_fract``min`최소 frame interval [s]
`struct v4l2_fract``max`최대 frame interval [s]
`struct v4l2_fract``step`frame interval 증가 간격 [s]

step-wise 또는 continuous interval 범위의 세 요소입니다.

Structs
=======

In the structs below, *IN* denotes a value that has to be filled in by
the application, *OUT* denotes values that the driver fills in. The
application should zero out all members except for the *IN* fields.

.. c:type:: v4l2_frmival_stepwise

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

    * - struct :c:type:`v4l2_fract`
      - ``min``
      - Minimum frame interval [s].
    * - struct :c:type:`v4l2_fract`
      - ``max``
      - Maximum frame interval [s].
    * - struct :c:type:`v4l2_fract`
      - ``step``
      - Frame interval step size [s].

v4l2_frmivalenum 구조체

118-158
struct v4l2_frmivalenum
형식필드방향과 의미
`__u32``index`IN: 열거할 frame interval의 순번
`__u32``pixel_format`IN: interval을 열거할 pixel format
`__u32``width`IN: interval을 열거할 frame 너비
`__u32``height`IN: interval을 열거할 frame 높이
`__u32``type`OUT: 장치가 지원하는 frame interval 유형
union익명 unionOUT: 지정한 index 또는 범위의 frame interval
`struct v4l2_fract``discrete`Discrete 유형의 frame interval [s]
`struct v4l2_frmival_stepwise``stepwise`Step-wise 또는 Continuous 유형의 min, max, step
`__u32[2]``reserved`미래 사용을 위한 공간이며 드라이버와 응용 프로그램 모두 0으로 설정

조회 조건과 반환되는 interval 정보를 원문 필드 순서대로 정리합니다.

`type`이 결정한 union 멤버만 읽어야 합니다. Discrete에서는 `discrete`, Step-wise와 Continuous에서는 `stepwise`가 유효하며, 다른 union 해석은 정의되지 않습니다.

.. c:type:: v4l2_frmivalenum

.. tabularcolumns:: |p{4.9cm}|p{3.3cm}|p{9.1cm}|

.. flat-table:: struct v4l2_frmivalenum
    :header-rows:  0
    :stub-columns: 0

    * - __u32
      - ``index``
      - IN: Index of the given frame interval in the enumeration.
    * - __u32
      - ``pixel_format``
      - IN: Pixel format for which the frame intervals are enumerated.
    * - __u32
      - ``width``
      - IN: Frame width for which the frame intervals are enumerated.
    * - __u32
      - ``height``
      - IN: Frame height for which the frame intervals are enumerated.
    * - __u32
      - ``type``
      - OUT: Frame interval type the device supports.
    * - union {
      - (anonymous)
      - OUT: Frame interval with the given index.
    * - struct :c:type:`v4l2_fract`
      - ``discrete``
      - Frame interval [s].
    * - struct :c:type:`v4l2_frmival_stepwise`
      - ``stepwise``
      -
    * - }
      -
      -
    * - __u32
      - ``reserved[2]``
      - Reserved space for future use. Must be zeroed by drivers and
	applications.

v4l2_frmivaltypes 열거형

159-180
enum v4l2_frmivaltypes
상수의미
`V4L2_FRMIVAL_TYPE_DISCRETE`1개별적으로 나열되는 frame interval
`V4L2_FRMIVAL_TYPE_CONTINUOUS`2연속적인 frame interval 범위
`V4L2_FRMIVAL_TYPE_STEPWISE`3일정 step으로 정의되는 frame interval 범위

장치가 반환하는 frame interval 표현 유형입니다.

Enums
=====

.. c:type:: v4l2_frmivaltypes

.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|

.. flat-table:: enum v4l2_frmivaltypes
    :header-rows:  0
    :stub-columns: 0
    :widths:       3 1 4

    * - ``V4L2_FRMIVAL_TYPE_DISCRETE``
      - 1
      - Discrete frame interval.
    * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
      - 2
      - Continuous frame interval.
    * - ``V4L2_FRMIVAL_TYPE_STEPWISE``
      - 3
      - Step-wise defined frame interval.

반환값

181-186

성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 적절한 값으로 설정하며, 공통 오류 코드는 Generic Error Codes 장의 정의를 따릅니다. 열거에서는 지원하지 않는 조건이나 끝을 나타내는 `EINVAL`을 유형별 규칙에 맞춰 처리해야 합니다.

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.