← Documents Documentation/userspace-api/media/v4l/vidioc-g-dv-timings.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_DV_TIMINGS·VIDIOC_S_DV_TIMINGS ioctl

V4L2 input·output과 sub-device의 DV timing을 조회·설정하고 BT.656/1120 구조체, 표준, sync·porch, CE 영상 및 감소 frame-rate 플래그를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-g-dv-timings.rst:1-317

V4L2 input·output과 sub-device의 DV timing을 조회·설정하고 BT.656/1120 구조체, 표준, sync·porch, CE 영상 및 감소 frame-rate 플래그를 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_G_DV_TIMINGS:
5
6 **********************************************
7 ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS
8 **********************************************
9
10 Name
11 ====
12
13 VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_SUBDEV_S_DV_TIMINGS - Get or set DV timings for input or output
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_G_DV_TIMINGS
19
20 ``int ioctl(int fd, VIDIOC_G_DV_TIMINGS, struct v4l2_dv_timings *argp)``
21
22 .. c:macro:: VIDIOC_S_DV_TIMINGS
23
24 ``int ioctl(int fd, VIDIOC_S_DV_TIMINGS, struct v4l2_dv_timings *argp)``
25
26 .. c:macro:: VIDIOC_SUBDEV_G_DV_TIMINGS
27
28 ``int ioctl(int fd, VIDIOC_SUBDEV_G_DV_TIMINGS, struct v4l2_dv_timings *argp)``
29
30 .. c:macro:: VIDIOC_SUBDEV_S_DV_TIMINGS
31
32 ``int ioctl(int fd, VIDIOC_SUBDEV_S_DV_TIMINGS, struct v4l2_dv_timings *argp)``
33
34 Arguments
35 =========
36
37 ``fd``
38 File descriptor returned by :c:func:`open()`.
39
40 ``argp``
41 Pointer to struct :c:type:`v4l2_dv_timings`.
42
43 Description
44 ===========
45
46 To set DV timings for the input or output, applications use the
47 :ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get the current timings,
48 applications use the :ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. The detailed timing
49 information is filled in using the structure struct
50 :c:type:`v4l2_dv_timings`. These ioctls take a
51 pointer to the struct :c:type:`v4l2_dv_timings`
52 structure as argument. If the ioctl is not supported or the timing
53 values are not correct, the driver returns ``EINVAL`` error code.
54
55 Calling ``VIDIOC_SUBDEV_S_DV_TIMINGS`` on a subdev device node that has been
56 registered in read-only mode is not allowed. An error is returned and the errno
57 variable is set to ``-EPERM``.
58
59 The ``linux/v4l2-dv-timings.h`` header can be used to get the timings of
60 the formats in the :ref:`cea861` and :ref:`vesadmt` standards. If
61 the current input or output does not support DV timings (e.g. if
62 :ref:`VIDIOC_ENUMINPUT` does not set the
63 ``V4L2_IN_CAP_DV_TIMINGS`` flag), then ``ENODATA`` error code is returned.
64
65 Return Value
66 ============
67
68 On success 0 is returned, on error -1 and the ``errno`` variable is set
69 appropriately. The generic error codes are described at the
70 :ref:`Generic Error Codes <gen-errors>` chapter.
71
72 EINVAL
73 This ioctl is not supported, or the :ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>`
74 parameter was unsuitable.
75
76 ENODATA
77 Digital video timings are not supported for this input or output.
78
79 EBUSY
80 The device is busy and therefore can not change the timings.
81
82 EPERM
83 ``VIDIOC_SUBDEV_S_DV_TIMINGS`` has been called on a read-only subdevice.
84
85 .. c:type:: v4l2_bt_timings
86
87 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
88
89 .. cssclass:: longtable
90
91 .. flat-table:: struct v4l2_bt_timings
92 :header-rows: 0
93 :stub-columns: 0
94 :widths: 1 1 2
95
96 * - __u32
97 - ``width``
98 - Width of the active video in pixels.
99 * - __u32
100 - ``height``
101 - Height of the active video frame in lines. So for interlaced
102 formats the height of the active video in each field is
103 ``height``/2.
104 * - __u32
105 - ``interlaced``
106 - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``).
107 * - __u32
108 - ``polarities``
109 - This is a bit mask that defines polarities of sync signals. bit 0
110 (``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit
111 1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If
112 the bit is set (1) it is positive polarity and if is cleared (0),
113 it is negative polarity.
114 * - __u64
115 - ``pixelclock``
116 - Pixel clock in Hz. Ex. 74.25MHz->74250000
117 * - __u32
118 - ``hfrontporch``
119 - Horizontal front porch in pixels
120 * - __u32
121 - ``hsync``
122 - Horizontal sync length in pixels
123 * - __u32
124 - ``hbackporch``
125 - Horizontal back porch in pixels
126 * - __u32
127 - ``vfrontporch``
128 - Vertical front porch in lines. For interlaced formats this refers
129 to the odd field (aka field 1).
130 * - __u32
131 - ``vsync``
132 - Vertical sync length in lines. For interlaced formats this refers
133 to the odd field (aka field 1).
134 * - __u32
135 - ``vbackporch``
136 - Vertical back porch in lines. For interlaced formats this refers
137 to the odd field (aka field 1).
138 * - __u32
139 - ``il_vfrontporch``
140 - Vertical front porch in lines for the even field (aka field 2) of
141 interlaced field formats. Must be 0 for progressive formats.
142 * - __u32
143 - ``il_vsync``
144 - Vertical sync length in lines for the even field (aka field 2) of
145 interlaced field formats. Must be 0 for progressive formats.
146 * - __u32
147 - ``il_vbackporch``
148 - Vertical back porch in lines for the even field (aka field 2) of
149 interlaced field formats. Must be 0 for progressive formats.
150 * - __u32
151 - ``standards``
152 - The video standard(s) this format belongs to. This will be filled
153 in by the driver. Applications must set this to 0. See
154 :ref:`dv-bt-standards` for a list of standards.
155 * - __u32
156 - ``flags``
157 - Several flags giving more information about the format. See
158 :ref:`dv-bt-flags` for a description of the flags.
159 * - struct :c:type:`v4l2_fract`
160 - ``picture_aspect``
161 - The picture aspect if the pixels are not square. Only valid if the
162 ``V4L2_DV_FL_HAS_PICTURE_ASPECT`` flag is set.
163 * - __u8
164 - ``cea861_vic``
165 - The Video Identification Code according to the CEA-861 standard.
166 Only valid if the ``V4L2_DV_FL_HAS_CEA861_VIC`` flag is set.
167 * - __u8
168 - ``hdmi_vic``
169 - The Video Identification Code according to the HDMI standard.
170 Only valid if the ``V4L2_DV_FL_HAS_HDMI_VIC`` flag is set.
171 * - __u8
172 - ``reserved[46]``
173 - Reserved for future extensions. Drivers and applications must set
174 the array to zero.
175
176 .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.1cm}|
177
178 .. c:type:: v4l2_dv_timings
179
180 .. flat-table:: struct v4l2_dv_timings
181 :header-rows: 0
182 :stub-columns: 0
183 :widths: 1 1 2
184
185 * - __u32
186 - ``type``
187 - Type of DV timings as listed in :ref:`dv-timing-types`.
188 * - union {
189 - (anonymous)
190 * - struct :c:type:`v4l2_bt_timings`
191 - ``bt``
192 - Timings defined by BT.656/1120 specifications
193 * - __u32
194 - ``reserved``\ [32]
195 -
196 * - }
197 -
198
199 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
200
201 .. _dv-timing-types:
202
203 .. flat-table:: DV Timing types
204 :header-rows: 0
205 :stub-columns: 0
206 :widths: 1 1 2
207
208 * - Timing type
209 - value
210 - Description
211 * -
212 -
213 -
214 * - ``V4L2_DV_BT_656_1120``
215 - 0
216 - BT.656/1120 timings
217
218 .. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
219
220 .. cssclass:: longtable
221
222 .. _dv-bt-standards:
223
224 .. flat-table:: DV BT Timing standards
225 :header-rows: 0
226 :stub-columns: 0
227
228 * - Timing standard
229 - Description
230 * - ``V4L2_DV_BT_STD_CEA861``
231 - The timings follow the CEA-861 Digital TV Profile standard
232 * - ``V4L2_DV_BT_STD_DMT``
233 - The timings follow the VESA Discrete Monitor Timings standard
234 * - ``V4L2_DV_BT_STD_CVT``
235 - The timings follow the VESA Coordinated Video Timings standard
236 * - ``V4L2_DV_BT_STD_GTF``
237 - The timings follow the VESA Generalized Timings Formula standard
238 * - ``V4L2_DV_BT_STD_SDI``
239 - The timings follow the SDI Timings standard.
240 There are no horizontal syncs/porches at all in this format.
241 Total blanking timings must be set in hsync or vsync fields only.
242
243 .. tabularcolumns:: |p{7.7cm}|p{9.8cm}|
244
245 .. cssclass:: longtable
246
247 .. _dv-bt-flags:
248
249 .. flat-table:: DV BT Timing flags
250 :header-rows: 0
251 :stub-columns: 0
252
253 * - Flag
254 - Description
255 * - ``V4L2_DV_FL_REDUCED_BLANKING``
256 - CVT/GTF specific: the timings use reduced blanking (CVT) or the
257 'Secondary GTF' curve (GTF). In both cases the horizontal and/or
258 vertical blanking intervals are reduced, allowing a higher
259 resolution over the same bandwidth. This is a read-only flag,
260 applications must not set this.
261 * - ``V4L2_DV_FL_CAN_REDUCE_FPS``
262 - CEA-861 specific: set for CEA-861 formats with a framerate that is
263 a multiple of six. These formats can be optionally played at 1 /
264 1.001 speed to be compatible with 60 Hz based standards such as
265 NTSC and PAL-M that use a framerate of 29.97 frames per second. If
266 the transmitter can't generate such frequencies, then the flag
267 will also be cleared. This is a read-only flag, applications must
268 not set this.
269 * - ``V4L2_DV_FL_REDUCED_FPS``
270 - CEA-861 specific: only valid for video transmitters or video
271 receivers that have the ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
272 set. This flag is cleared otherwise. It is also only valid for
273 formats with the ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other
274 formats the flag will be cleared by the driver.
275
276 If the application sets this flag for a transmitter, then the
277 pixelclock used to set up the transmitter is divided by 1.001 to
278 make it compatible with NTSC framerates. If the transmitter can't
279 generate such frequencies, then the flag will be cleared.
280
281 If a video receiver detects that the format uses a reduced framerate,
282 then it will set this flag to signal this to the application.
283 * - ``V4L2_DV_FL_HALF_LINE``
284 - Specific to interlaced formats: if set, then the vertical
285 frontporch of field 1 (aka the odd field) is really one half-line
286 longer and the vertical backporch of field 2 (aka the even field)
287 is really one half-line shorter, so each field has exactly the
288 same number of half-lines. Whether half-lines can be detected or
289 used depends on the hardware.
290 * - ``V4L2_DV_FL_IS_CE_VIDEO``
291 - If set, then this is a Consumer Electronics (CE) video format.
292 Such formats differ from other formats (commonly called IT
293 formats) in that if R'G'B' encoding is used then by default the
294 R'G'B' values use limited range (i.e. 16-235) as opposed to full
295 range (i.e. 0-255). All formats defined in CEA-861 except for the
296 640x480p59.94 format are CE formats.
297 * - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE``
298 - Some formats like SMPTE-125M have an interlaced signal with a odd
299 total height. For these formats, if this flag is set, the first
300 field has the extra line. Else, it is the second field.
301 * - ``V4L2_DV_FL_HAS_PICTURE_ASPECT``
302 - If set, then the picture_aspect field is valid. Otherwise assume that
303 the pixels are square, so the picture aspect ratio is the same as the
304 width to height ratio.
305 * - ``V4L2_DV_FL_HAS_CEA861_VIC``
306 - If set, then the cea861_vic field is valid and contains the Video
307 Identification Code as per the CEA-861 standard.
308 * - ``V4L2_DV_FL_HAS_HDMI_VIC``
309 - If set, then the hdmi_vic field is valid and contains the Video
310 Identification Code as per the HDMI standard (HDMI Vendor Specific
311 InfoFrame).
312 * - ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
313 - CEA-861 specific: only valid for video receivers, the flag is
314 cleared by transmitters.
315 If set, then the hardware can detect the difference between
316 regular framerates and framerates reduced by 1000/1001. E.g.:
317 60 vs 59.94 Hz, 30 vs 29.97 Hz or 24 vs 23.976 Hz.
318

3. 한국어 전문 번역

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

목적, 네 호출 형식과 인자

1-42

`VIDIOC_G_DV_TIMINGS`와 `VIDIOC_S_DV_TIMINGS`는 input 또는 output의 DV timing을 조회·설정합니다. sub-device에는 대응하는 `VIDIOC_SUBDEV_G_DV_TIMINGS`와 `VIDIOC_SUBDEV_S_DV_TIMINGS`를 사용합니다.

네 ioctl 모두 `struct v4l2_dv_timings *argp`를 받습니다. `fd`는 `open()`이 반환한 파일 디스크립터이고, 구조체에는 timing type과 BT.656/1120 상세값이 담깁니다.

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

.. _VIDIOC_G_DV_TIMINGS:

**********************************************
ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS
**********************************************

Name
====

VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_SUBDEV_S_DV_TIMINGS - Get or set DV timings for input or output

Synopsis
========

.. c:macro:: VIDIOC_G_DV_TIMINGS

``int ioctl(int fd, VIDIOC_G_DV_TIMINGS, struct v4l2_dv_timings *argp)``

.. c:macro:: VIDIOC_S_DV_TIMINGS

``int ioctl(int fd, VIDIOC_S_DV_TIMINGS, struct v4l2_dv_timings *argp)``

.. c:macro:: VIDIOC_SUBDEV_G_DV_TIMINGS

``int ioctl(int fd, VIDIOC_SUBDEV_G_DV_TIMINGS, struct v4l2_dv_timings *argp)``

.. c:macro:: VIDIOC_SUBDEV_S_DV_TIMINGS

``int ioctl(int fd, VIDIOC_SUBDEV_S_DV_TIMINGS, struct v4l2_dv_timings *argp)``

Arguments
=========

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

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

DV timing 조회·설정과 지원 판별

43-64

input 또는 output timing을 설정할 때는 `VIDIOC_S_DV_TIMINGS`, 현재 timing을 얻을 때는 `VIDIOC_G_DV_TIMINGS`를 사용합니다. 상세 timing 정보는 `v4l2_dv_timings`에 채웁니다.

ioctl 자체를 지원하지 않거나 설정 timing 값이 올바르지 않으면 `EINVAL`입니다. device가 busy라 timing을 바꿀 수 없으면 `EBUSY`입니다.

read-only mode로 등록된 subdev node에서 `VIDIOC_SUBDEV_S_DV_TIMINGS`를 호출할 수 없습니다. 원문 본문은 errno가 `-EPERM`으로 설정된다고 쓰고 Return Value 절은 `EPERM` 항목으로 설명합니다.

`linux/v4l2-dv-timings.h`는 CEA-861 및 VESA DMT 표준 format의 timing을 구하는 데 사용할 수 있습니다. 현재 input/output이 DV timing capability를 제공하지 않으면, 예를 들어 `VIDIOC_ENUMINPUT`의 `V4L2_IN_CAP_DV_TIMINGS`가 없으면 `ENODATA`입니다.

DV timing 조회·설정
DV_TIMINGS capability 확인v4l2_dv_timings 준비G_DV_TIMINGS로 현재값 조회필요한 BT timing 구성writable node에서 S_DV_TIMINGS 호출적용 결과 또는 errno 처리

지원 capability와 node 권한을 확인해 timing을 적용하거나 조회합니다.

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

To set DV timings for the input or output, applications use the
:ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get the current timings,
applications use the :ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. The detailed timing
information is filled in using the structure struct
:c:type:`v4l2_dv_timings`. These ioctls take a
pointer to the struct :c:type:`v4l2_dv_timings`
structure as argument. If the ioctl is not supported or the timing
values are not correct, the driver returns ``EINVAL`` error code.

Calling ``VIDIOC_SUBDEV_S_DV_TIMINGS`` on a subdev device node that has been
registered in read-only mode is not allowed. An error is returned and the errno
variable is set to ``-EPERM``.

The ``linux/v4l2-dv-timings.h`` header can be used to get the timings of
the formats in the :ref:`cea861` and :ref:`vesadmt` standards. If
the current input or output does not support DV timings (e.g. if
:ref:`VIDIOC_ENUMINPUT` does not set the
``V4L2_IN_CAP_DV_TIMINGS`` flag), then ``ENODATA`` error code is returned.

반환값과 오류

65-84

성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 설정하며, 공통 오류 코드는 Generic Error Codes 장을 따릅니다.

DV_TIMINGS 오류
errno조건
`EINVAL`ioctl을 지원하지 않거나 `VIDIOC_S_DV_TIMINGS` parameter가 부적절함
`ENODATA`현재 input 또는 output이 digital video timing을 지원하지 않음
`EBUSY`device가 busy여서 timing을 변경할 수 없음
`EPERM`read-only subdevice에서 `VIDIOC_SUBDEV_S_DV_TIMINGS` 호출

지원 여부, parameter, 장치 상태와 sub-device 권한에 따른 오류입니다.

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
    This ioctl is not supported, or the :ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>`
    parameter was unsuitable.

ENODATA
    Digital video timings are not supported for this input or output.

EBUSY
    The device is busy and therefore can not change the timings.

EPERM
    ``VIDIOC_SUBDEV_S_DV_TIMINGS`` has been called on a read-only subdevice.

v4l2_bt_timings 구조체

85-175
struct v4l2_bt_timings
형식필드의미
`__u32``width`active video의 pixel 너비
`__u32``height`active frame의 line 높이. interlaced이면 field별 active 높이는 `height / 2`
`__u32``interlaced``V4L2_DV_PROGRESSIVE` 또는 `V4L2_DV_INTERLACED`
`__u32``polarities`bit 0은 `V4L2_DV_VSYNC_POS_POL`, bit 1은 `V4L2_DV_HSYNC_POS_POL`; 1은 positive, 0은 negative polarity
`__u64``pixelclock`Hz 단위 pixel clock. 74.25 MHz는 `74250000`
`__u32``hfrontporch`pixel 단위 horizontal front porch
`__u32``hsync`pixel 단위 horizontal sync 길이
`__u32``hbackporch`pixel 단위 horizontal back porch
`__u32``vfrontporch`line 단위 odd field(field 1) vertical front porch
`__u32``vsync`line 단위 odd field(field 1) vertical sync 길이
`__u32``vbackporch`line 단위 odd field(field 1) vertical back porch
`__u32``il_vfrontporch`interlaced even field(field 2)의 vertical front porch. progressive이면 0
`__u32``il_vsync`interlaced even field(field 2)의 vertical sync 길이. progressive이면 0
`__u32``il_vbackporch`interlaced even field(field 2)의 vertical back porch. progressive이면 0
`__u32``standards`format이 속한 video standard 비트. 드라이버가 채우며 응용 프로그램은 0으로 설정
`__u32``flags`format 부가 정보를 나타내는 DV BT Timing flags
`struct v4l2_fract``picture_aspect`pixel이 square가 아닐 때 picture aspect. `V4L2_DV_FL_HAS_PICTURE_ASPECT`에서만 유효
`__u8``cea861_vic`CEA-861 Video Identification Code. `V4L2_DV_FL_HAS_CEA861_VIC`에서만 유효
`__u8``hdmi_vic`HDMI Video Identification Code. `V4L2_DV_FL_HAS_HDMI_VIC`에서만 유효
`__u8[46]``reserved`미래 확장용. 드라이버와 응용 프로그램 모두 0으로 설정

active video, sync·porch, interlaced field, 표준과 부가 식별 정보를 원문 순서대로 정리합니다.

horizontal timing은 active `width` 뒤의 `hfrontporch`, `hsync`, `hbackporch`로 구성됩니다. vertical timing도 odd field에서 `height`, `vfrontporch`, `vsync`, `vbackporch`를 사용합니다.

interlaced format의 even field timing은 `il_vfrontporch`, `il_vsync`, `il_vbackporch`에 따로 기록합니다. progressive format에서는 이 세 필드가 모두 0이어야 합니다.

`polarities`는 vertical·horizontal sync의 positive polarity를 각각 bit 0과 bit 1로 나타냅니다. 비트가 clear이면 해당 sync는 negative polarity입니다.

`standards`는 driver output이므로 응용 프로그램이 설정할 때 0이어야 합니다. `reserved[46]`도 양쪽 모두 0으로 유지해야 합니다.

`picture_aspect`, `cea861_vic`, `hdmi_vic`는 대응하는 `HAS_*` flag가 있을 때만 읽어야 합니다. flag가 없다면 값의 의미를 가정해서는 안 됩니다.

BT timing 구성
width·height active 영역horizontal front porchhorizontal synchorizontal back porchodd-field vertical porch·syncinterlaced이면 even-field 값 추가pixelclock·polarity·flags 결합

active 영역과 blanking 구간을 field별로 배치합니다.

.. c:type:: v4l2_bt_timings

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

.. cssclass:: longtable

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

    * - __u32
      - ``width``
      - Width of the active video in pixels.
    * - __u32
      - ``height``
      - Height of the active video frame in lines. So for interlaced
	formats the height of the active video in each field is
	``height``/2.
    * - __u32
      - ``interlaced``
      - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``).
    * - __u32
      - ``polarities``
      - This is a bit mask that defines polarities of sync signals. bit 0
	(``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit
	1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If
	the bit is set (1) it is positive polarity and if is cleared (0),
	it is negative polarity.
    * - __u64
      - ``pixelclock``
      - Pixel clock in Hz. Ex. 74.25MHz->74250000
    * - __u32
      - ``hfrontporch``
      - Horizontal front porch in pixels
    * - __u32
      - ``hsync``
      - Horizontal sync length in pixels
    * - __u32
      - ``hbackporch``
      - Horizontal back porch in pixels
    * - __u32
      - ``vfrontporch``
      - Vertical front porch in lines. For interlaced formats this refers
	to the odd field (aka field 1).
    * - __u32
      - ``vsync``
      - Vertical sync length in lines. For interlaced formats this refers
	to the odd field (aka field 1).
    * - __u32
      - ``vbackporch``
      - Vertical back porch in lines. For interlaced formats this refers
	to the odd field (aka field 1).
    * - __u32
      - ``il_vfrontporch``
      - Vertical front porch in lines for the even field (aka field 2) of
	interlaced field formats. Must be 0 for progressive formats.
    * - __u32
      - ``il_vsync``
      - Vertical sync length in lines for the even field (aka field 2) of
	interlaced field formats. Must be 0 for progressive formats.
    * - __u32
      - ``il_vbackporch``
      - Vertical back porch in lines for the even field (aka field 2) of
	interlaced field formats. Must be 0 for progressive formats.
    * - __u32
      - ``standards``
      - The video standard(s) this format belongs to. This will be filled
	in by the driver. Applications must set this to 0. See
	:ref:`dv-bt-standards` for a list of standards.
    * - __u32
      - ``flags``
      - Several flags giving more information about the format. See
	:ref:`dv-bt-flags` for a description of the flags.
    * - struct :c:type:`v4l2_fract`
      - ``picture_aspect``
      - The picture aspect if the pixels are not square. Only valid if the
        ``V4L2_DV_FL_HAS_PICTURE_ASPECT`` flag is set.
    * - __u8
      - ``cea861_vic``
      - The Video Identification Code according to the CEA-861 standard.
        Only valid if the ``V4L2_DV_FL_HAS_CEA861_VIC`` flag is set.
    * - __u8
      - ``hdmi_vic``
      - The Video Identification Code according to the HDMI standard.
        Only valid if the ``V4L2_DV_FL_HAS_HDMI_VIC`` flag is set.
    * - __u8
      - ``reserved[46]``
      - Reserved for future extensions. Drivers and applications must set
	the array to zero.

v4l2_dv_timings와 timing type

176-217
struct v4l2_dv_timings
형식필드의미
`__u32``type`DV Timing types 표의 timing type
`union`anonymoustiming type에 따른 payload
`struct v4l2_bt_timings``bt`BT.656/1120 specification으로 정의한 timing
`__u32[32]``reserved`union의 예약 공간

DV timing type과 type별 payload union입니다.

DV Timing types
상수의미
`V4L2_DV_BT_656_1120``0`BT.656/1120 timing

현재 정의된 DV timing payload type입니다.

현재 문서가 정의하는 type은 값 0인 `V4L2_DV_BT_656_1120`이며, 상세값은 union의 `bt` 멤버에서 `v4l2_bt_timings`로 전달됩니다.

.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.1cm}|

.. c:type:: v4l2_dv_timings

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

    * - __u32
      - ``type``
      - Type of DV timings as listed in :ref:`dv-timing-types`.
    * - union {
      - (anonymous)
    * - struct :c:type:`v4l2_bt_timings`
      - ``bt``
      - Timings defined by BT.656/1120 specifications
    * - __u32
      - ``reserved``\ [32]
      -
    * - }
      -

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

.. _dv-timing-types:

.. flat-table:: DV Timing types
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - Timing type
      - value
      - Description
    * -
      -
      -
    * - ``V4L2_DV_BT_656_1120``
      - 0
      - BT.656/1120 timings

DV BT timing 표준

218-242
DV BT Timing standards
상수표준
`V4L2_DV_BT_STD_CEA861`CEA-861 Digital TV Profile
`V4L2_DV_BT_STD_DMT`VESA Discrete Monitor Timings
`V4L2_DV_BT_STD_CVT`VESA Coordinated Video Timings
`V4L2_DV_BT_STD_GTF`VESA Generalized Timings Formula
`V4L2_DV_BT_STD_SDI`SDI Timings

`v4l2_bt_timings.standards`가 나타내는 timing 계열입니다.

CEA-861은 digital TV profile, DMT·CVT·GTF는 각각 VESA monitor timing 체계, SDI는 Serial Digital Interface timing을 나타냅니다.

SDI format에는 horizontal sync와 porch가 전혀 없습니다. 전체 blanking timing은 `hsync` 또는 `vsync` 필드에만 설정해야 합니다.

.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|

.. cssclass:: longtable

.. _dv-bt-standards:

.. flat-table:: DV BT Timing standards
    :header-rows:  0
    :stub-columns: 0

    * - Timing standard
      - Description
    * - ``V4L2_DV_BT_STD_CEA861``
      - The timings follow the CEA-861 Digital TV Profile standard
    * - ``V4L2_DV_BT_STD_DMT``
      - The timings follow the VESA Discrete Monitor Timings standard
    * - ``V4L2_DV_BT_STD_CVT``
      - The timings follow the VESA Coordinated Video Timings standard
    * - ``V4L2_DV_BT_STD_GTF``
      - The timings follow the VESA Generalized Timings Formula standard
    * - ``V4L2_DV_BT_STD_SDI``
      - The timings follow the SDI Timings standard.
	There are no horizontal syncs/porches at all in this format.
	Total blanking timings must be set in hsync or vsync fields only.

DV BT timing 플래그

243-317
DV BT Timing flags
상수의미
`V4L2_DV_FL_REDUCED_BLANKING`CVT reduced blanking 또는 GTF Secondary GTF curve를 사용해 blanking interval을 줄이고 같은 bandwidth에서 더 높은 resolution을 허용. read-only
`V4L2_DV_FL_CAN_REDUCE_FPS`framerate가 6의 배수인 CEA-861 format을 1/1.001 속도로 재생할 수 있음. transmitter가 해당 frequency를 만들 수 없으면 clear. read-only
`V4L2_DV_FL_REDUCED_FPS`1000/1001 감소 framerate를 실제 사용하거나 receiver가 감지했음을 표시. `CAN_DETECT_REDUCED_FPS`와 `CAN_REDUCE_FPS` 조건에서만 유효
`V4L2_DV_FL_HALF_LINE`interlaced에서 field 1 front porch가 half-line 길고 field 2 back porch가 half-line 짧아 두 field의 half-line 수를 같게 함
`V4L2_DV_FL_IS_CE_VIDEO`Consumer Electronics video format. RGB 기본 limited range 16~235 사용
`V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE`SMPTE-125M처럼 total height가 홀수인 interlaced format에서 first field가 extra line을 가짐
`V4L2_DV_FL_HAS_PICTURE_ASPECT``picture_aspect`가 유효함. 없으면 square pixel로 보고 width:height를 picture aspect로 사용
`V4L2_DV_FL_HAS_CEA861_VIC``cea861_vic`에 CEA-861 Video Identification Code가 있음
`V4L2_DV_FL_HAS_HDMI_VIC``hdmi_vic`에 HDMI Vendor Specific InfoFrame의 Video Identification Code가 있음
`V4L2_DV_FL_CAN_DETECT_REDUCED_FPS`receiver hardware가 regular framerate와 1000/1001 감소 framerate를 구별할 수 있음. transmitter에서는 clear

`v4l2_bt_timings.flags`의 format 특성과 조건을 정리합니다.

`REDUCED_BLANKING`과 `CAN_REDUCE_FPS`는 read-only이므로 응용 프로그램이 설정해서는 안 됩니다. 후자는 transmitter가 필요한 frequency를 생성할 수 없는 경우 driver가 clear합니다.

CEA-861에서 framerate가 6의 배수인 format은 NTSC·PAL-M 계열과 호환되도록 1/1.001 속도를 선택할 수 있습니다. 예를 들어 30 fps는 29.97 fps가 됩니다.

transmitter에서 `REDUCED_FPS`를 설정하면 설정에 사용하는 pixelclock을 1.001로 나눕니다. 해당 frequency를 만들 수 없으면 flag는 clear됩니다.

receiver는 감소 framerate를 감지하면 `REDUCED_FPS`를 설정합니다. 이 flag는 `CAN_DETECT_REDUCED_FPS`와 `CAN_REDUCE_FPS` 조건을 만족하지 않으면 driver가 clear합니다.

`HALF_LINE`의 실제 감지·사용 가능 여부는 hardware에 달려 있습니다. `FIRST_FIELD_EXTRA_LINE`이 없으면 홀수 total height의 extra line은 second field에 있습니다.

CE format은 IT format과 달리 RGB encoding의 기본 범위가 full 0~255가 아니라 limited 16~235입니다. CEA-861의 640x480p59.94를 제외한 모든 format이 CE format입니다.

`CAN_DETECT_REDUCED_FPS`는 receiver 전용이며 60/59.94 Hz, 30/29.97 Hz, 24/23.976 Hz의 차이를 hardware가 감지할 수 있음을 뜻합니다.

.. tabularcolumns:: |p{7.7cm}|p{9.8cm}|

.. cssclass:: longtable

.. _dv-bt-flags:

.. flat-table:: DV BT Timing flags
    :header-rows:  0
    :stub-columns: 0

    * - Flag
      - Description
    * - ``V4L2_DV_FL_REDUCED_BLANKING``
      - CVT/GTF specific: the timings use reduced blanking (CVT) or the
	'Secondary GTF' curve (GTF). In both cases the horizontal and/or
	vertical blanking intervals are reduced, allowing a higher
	resolution over the same bandwidth. This is a read-only flag,
	applications must not set this.
    * - ``V4L2_DV_FL_CAN_REDUCE_FPS``
      - CEA-861 specific: set for CEA-861 formats with a framerate that is
	a multiple of six. These formats can be optionally played at 1 /
	1.001 speed to be compatible with 60 Hz based standards such as
	NTSC and PAL-M that use a framerate of 29.97 frames per second. If
	the transmitter can't generate such frequencies, then the flag
	will also be cleared. This is a read-only flag, applications must
	not set this.
    * - ``V4L2_DV_FL_REDUCED_FPS``
      - CEA-861 specific: only valid for video transmitters or video
        receivers that have the ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
	set. This flag is cleared otherwise. It is also only valid for
	formats with the ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other
	formats the flag will be cleared by the driver.

	If the application sets this flag for a transmitter, then the
	pixelclock used to set up the transmitter is divided by 1.001 to
	make it compatible with NTSC framerates. If the transmitter can't
	generate such frequencies, then the flag will be cleared.

	If a video receiver detects that the format uses a reduced framerate,
	then it will set this flag to signal this to the application.
    * - ``V4L2_DV_FL_HALF_LINE``
      - Specific to interlaced formats: if set, then the vertical
	frontporch of field 1 (aka the odd field) is really one half-line
	longer and the vertical backporch of field 2 (aka the even field)
	is really one half-line shorter, so each field has exactly the
	same number of half-lines. Whether half-lines can be detected or
	used depends on the hardware.
    * - ``V4L2_DV_FL_IS_CE_VIDEO``
      - If set, then this is a Consumer Electronics (CE) video format.
	Such formats differ from other formats (commonly called IT
	formats) in that if R'G'B' encoding is used then by default the
	R'G'B' values use limited range (i.e. 16-235) as opposed to full
	range (i.e. 0-255). All formats defined in CEA-861 except for the
	640x480p59.94 format are CE formats.
    * - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE``
      - Some formats like SMPTE-125M have an interlaced signal with a odd
	total height. For these formats, if this flag is set, the first
	field has the extra line. Else, it is the second field.
    * - ``V4L2_DV_FL_HAS_PICTURE_ASPECT``
      - If set, then the picture_aspect field is valid. Otherwise assume that
        the pixels are square, so the picture aspect ratio is the same as the
	width to height ratio.
    * - ``V4L2_DV_FL_HAS_CEA861_VIC``
      - If set, then the cea861_vic field is valid and contains the Video
        Identification Code as per the CEA-861 standard.
    * - ``V4L2_DV_FL_HAS_HDMI_VIC``
      - If set, then the hdmi_vic field is valid and contains the Video
        Identification Code as per the HDMI standard (HDMI Vendor Specific
	InfoFrame).
    * - ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
      - CEA-861 specific: only valid for video receivers, the flag is
        cleared by transmitters.
        If set, then the hardware can detect the difference between
	regular framerates and framerates reduced by 1000/1001. E.g.:
	60 vs 59.94 Hz, 30 vs 29.97 Hz or 24 vs 23.976 Hz.