요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. _dv-timings:
**************************
Digital Video (DV) Timings
**************************
The video standards discussed so far have been dealing with Analog TV
and the corresponding video timings. Today there are many more different
hardware interfaces such as High Definition TV interfaces (HDMI), VGA,
DVI connectors etc., that carry video signals and there is a need to
extend the API to select the video timings for these interfaces. Since
it is not possible to extend the :ref:`v4l2_std_id <v4l2-std-id>`
due to the limited bits available, a new set of ioctls was added to
set/get video timings at the input and output.
These ioctls deal with the detailed digital video timings that define
each video format. This includes parameters such as the active video
width and height, signal polarities, frontporches, backporches, sync
widths etc. 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.
To enumerate and query the attributes of the DV timings supported by a
device applications use the
:ref:`VIDIOC_ENUM_DV_TIMINGS` and
:ref:`VIDIOC_DV_TIMINGS_CAP` ioctls. To set
DV timings for the device applications use the
:ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get
current DV timings they use the
:ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. To detect
the DV timings as seen by the video receiver applications use the
:ref:`VIDIOC_QUERY_DV_TIMINGS` ioctl.
When the hardware detects a video source change (e.g. the video
signal appears or disappears, or the video resolution changes), then
it will issue a `V4L2_EVENT_SOURCE_CHANGE` event. Use the
:ref:`ioctl VIDIOC_SUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` and the
:ref:`VIDIOC_DQEVENT` to check if this event was reported.
If the video signal changed, then the application has to stop
streaming, free all buffers, and call the :ref:`VIDIOC_QUERY_DV_TIMINGS`
to obtain the new video timings, and if they are valid, it can set
those by calling the :ref:`ioctl VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>`.
This will also update the format, so use the :ref:`ioctl VIDIOC_G_FMT <VIDIOC_G_FMT>`
to obtain the new format. Now the application can allocate new buffers
and start streaming again.
The :ref:`VIDIOC_QUERY_DV_TIMINGS` will just report what the
hardware detects, it will never change the configuration. If the
currently set timings and the actually detected timings differ, then
typically this will mean that you will not be able to capture any
video. The correct approach is to rely on the `V4L2_EVENT_SOURCE_CHANGE`
event so you know when something changed.
Applications can make use of the :ref:`input-capabilities` and
:ref:`output-capabilities` flags to determine whether the digital
video ioctls can be used with the given input or output.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Digital interface timing 모델
1-24기존 video standard는 Analog TV와 그 timing을 다뤘습니다. 오늘날에는 HDMI, VGA, DVI connector처럼 video signal을 전달하는 hardware interface가 훨씬 다양하므로 이 interface들의 video timing을 선택하도록 API를 확장해야 합니다.
사용 가능한 bit가 제한된 `v4l2_std_id`를 확장할 수 없기 때문에 input과 output의 video timing을 설정·조회하는 새 ioctl 집합이 추가됐습니다.
DV timing은 active video width·height, signal polarity, front porch, back porch, sync width 등 각 digital video format의 세부 timing parameter를 정의합니다.
`linux/v4l2-dv-timings.h` header에서 `CEA-861`과 `VESA DMT` standard format의 timing을 얻을 수 있습니다.
Digital video format을 식별하는 주요 parameter입니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. _dv-timings:
**************************
Digital Video (DV) Timings
**************************
The video standards discussed so far have been dealing with Analog TV
and the corresponding video timings. Today there are many more different
hardware interfaces such as High Definition TV interfaces (HDMI), VGA,
DVI connectors etc., that carry video signals and there is a need to
extend the API to select the video timings for these interfaces. Since
it is not possible to extend the :ref:`v4l2_std_id <v4l2-std-id>`
due to the limited bits available, a new set of ioctls was added to
set/get video timings at the input and output.
These ioctls deal with the detailed digital video timings that define
each video format. This includes parameters such as the active video
width and height, signal polarities, frontporches, backporches, sync
widths etc. 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.
DV timing 열거·설정·탐지
25-35장치가 지원하는 DV timing과 attribute는 `VIDIOC_ENUM_DV_TIMINGS`, `VIDIOC_DV_TIMINGS_CAP`으로 열거·조회합니다.
장치 timing 설정은 `VIDIOC_S_DV_TIMINGS`, 현재 설정 조회는 `VIDIOC_G_DV_TIMINGS`, video receiver가 실제로 보고 있는 timing 탐지는 `VIDIOC_QUERY_DV_TIMINGS`를 사용합니다.
지원 범위, 설정 상태와 실제 signal 탐지를 구분합니다.
To enumerate and query the attributes of the DV timings supported by a
device applications use the
:ref:`VIDIOC_ENUM_DV_TIMINGS` and
:ref:`VIDIOC_DV_TIMINGS_CAP` ioctls. To set
DV timings for the device applications use the
:ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get
current DV timings they use the
:ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. To detect
the DV timings as seen by the video receiver applications use the
:ref:`VIDIOC_QUERY_DV_TIMINGS` ioctl.
Source-change event와 재협상
36-59Hardware가 video signal의 출현·소멸 또는 resolution 변경 같은 source change를 탐지하면 `V4L2_EVENT_SOURCE_CHANGE` event를 발행합니다. `VIDIOC_SUBSCRIBE_EVENT`로 구독하고 `VIDIOC_DQEVENT`로 보고 여부를 확인합니다.
Video signal이 바뀌면 application은 streaming을 중지하고 모든 buffer를 해제한 뒤 `VIDIOC_QUERY_DV_TIMINGS`로 새 timing을 얻습니다. Timing이 valid하면 `VIDIOC_S_DV_TIMINGS`로 적용합니다.
S_DV_TIMINGS는 format도 갱신하므로 `VIDIOC_G_FMT`로 새 format을 얻어야 합니다. 그 다음 새 buffer를 할당하고 streaming을 다시 시작할 수 있습니다.
`VIDIOC_QUERY_DV_TIMINGS`는 hardware가 탐지한 내용을 보고만 하며 configuration을 절대 변경하지 않습니다. 현재 설정 timing과 실제 탐지 timing이 다르면 보통 video capture가 불가능합니다. 따라서 change detection은 `V4L2_EVENT_SOURCE_CHANGE`에 의존해야 합니다.
Application은 `input-capabilities`와 `output-capabilities` flag로 선택한 input 또는 output에서 digital video ioctl을 사용할 수 있는지 판단합니다.
Signal timing이 바뀐 뒤 format과 buffer를 안전하게 다시 구성합니다.
두 상태의 역할을 혼동하면 capture가 실패할 수 있습니다.
When the hardware detects a video source change (e.g. the video
signal appears or disappears, or the video resolution changes), then
it will issue a `V4L2_EVENT_SOURCE_CHANGE` event. Use the
:ref:`ioctl VIDIOC_SUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` and the
:ref:`VIDIOC_DQEVENT` to check if this event was reported.
If the video signal changed, then the application has to stop
streaming, free all buffers, and call the :ref:`VIDIOC_QUERY_DV_TIMINGS`
to obtain the new video timings, and if they are valid, it can set
those by calling the :ref:`ioctl VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>`.
This will also update the format, so use the :ref:`ioctl VIDIOC_G_FMT <VIDIOC_G_FMT>`
to obtain the new format. Now the application can allocate new buffers
and start streaming again.
The :ref:`VIDIOC_QUERY_DV_TIMINGS` will just report what the
hardware detects, it will never change the configuration. If the
currently set timings and the actually detected timings differ, then
typically this will mean that you will not be able to capture any
video. The correct approach is to rely on the `V4L2_EVENT_SOURCE_CHANGE`
event so you know when something changed.
Applications can make use of the :ref:`input-capabilities` and
:ref:`output-capabilities` flags to determine whether the digital
video ioctls can be used with the given input or output.
요약·해설
dv-timings.rst:1-59DV timing API는 설정된 timing과 receiver가 실제 탐지한 timing을 분리합니다. QUERY_DV_TIMINGS는 상태를 바꾸지 않으며, source-change event를 받은 application이 명시적으로 새 timing과 format을 적용해야 합니다.
Signal 변경 뒤에는 streaming 중지, buffer 해제, timing 탐지·설정, G_FMT, 새 buffer 할당, streaming 재시작 순서를 지켜야 합니다.