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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_QUERYSTD·VIDIOC_SUBDEV_QUERYSTD ioctl

현재 입력의 아날로그 영상 표준 후보를 감지하고 source change 뒤 streaming과 buffer를 재협상하는 절차를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-querystd.rst:1-69

감지값은 단일 표준이 아니라 후보 집합일 수 있으며 새 표준은 사용자 공간이 명시적으로 적용합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_QUERYSTD:
5
6 *********************************************
7 ioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
8 *********************************************
9
10 Name
11 ====
12
13 VIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_QUERYSTD
19
20 ``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)``
21
22 .. c:macro:: VIDIOC_SUBDEV_QUERYSTD
23
24 ``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)``
25
26 Arguments
27 =========
28
29 ``fd``
30 File descriptor returned by :c:func:`open()`.
31
32 ``argp``
33 Pointer to :c:type:`v4l2_std_id`.
34
35 Description
36 ===========
37
38 The hardware may be able to detect the current video standard
39 automatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
40 pointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
41 stores here a set of candidates, this can be a single flag or a set of
42 supported standards if for example the hardware can only distinguish
43 between 50 and 60 Hz systems. If no signal was detected, then the driver
44 will return V4L2_STD_UNKNOWN. When detection is not possible or fails,
45 the set must contain all standards supported by the current video input
46 or output.
47
48 .. note::
49
50 Drivers shall *not* switch the video standard
51 automatically if a new video standard is detected. Instead, drivers
52 should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
53 this) and expect that userspace will take action by calling
54 :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
55 different buffer sizes as well, and you cannot change buffer sizes on
56 the fly. In general, applications that receive the Source Change event
57 will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
58 standard is valid they will have to stop streaming, set the new
59 standard, allocate new buffers and start streaming again.
60
61 Return Value
62 ============
63
64 On success 0 is returned, on error -1 and the ``errno`` variable is set
65 appropriately. The generic error codes are described at the
66 :ref:`Generic Error Codes <gen-errors>` chapter.
67
68 ENODATA
69 Standard video timings are not supported for this input or output.
70

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-34

`VIDIOC_QUERYSTD`와 `VIDIOC_SUBDEV_QUERYSTD`는 현재 입력에서 수신하는 아날로그 영상 표준 후보를 `v4l2_std_id`에 감지합니다. 전자는 일반 장치, 후자는 subdevice node용입니다.

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

.. _VIDIOC_QUERYSTD:

*********************************************
ioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
*********************************************

Name
====

VIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input

Synopsis
========

.. c:macro:: VIDIOC_QUERYSTD

``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)``

.. c:macro:: VIDIOC_SUBDEV_QUERYSTD

``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)``

Arguments
=========

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

``argp``
    Pointer to :c:type:`v4l2_std_id`.

표준 감지와 source change 처리

35-60

드라이버는 감지한 표준 후보 집합을 반환합니다. 하드웨어가 정확히 식별하면 단일 flag이고, 50 Hz와 60 Hz 체계만 구분하는 정도라면 여러 지원 표준의 집합일 수 있습니다.

신호가 없으면 `V4L2_STD_UNKNOWN`을 반환합니다. 감지가 불가능하거나 실패하면 현재 input 또는 output이 지원하는 모든 표준을 후보 집합에 넣어야 합니다.

새 표준을 감지해도 드라이버가 자동 전환해서는 안 됩니다. 지원한다면 `V4L2_EVENT_SOURCE_CHANGE`를 보내고 사용자 공간이 QUERYSTD를 호출하도록 해야 합니다.

영상 표준 재협상
1. Source Change event 수신2. QUERYSTD로 후보 감지3. 유효하면 streaming 중지4. 새 표준 설정5. buffer 재할당6. streaming 재시작

표준 변경은 buffer 크기를 바꿀 수 있어 streaming 중 즉시 적용할 수 없습니다.

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

The hardware may be able to detect the current video standard
automatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
pointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
stores here a set of candidates, this can be a single flag or a set of
supported standards if for example the hardware can only distinguish
between 50 and 60 Hz systems. If no signal was detected, then the driver
will return V4L2_STD_UNKNOWN. When detection is not possible or fails,
the set must contain all standards supported by the current video input
or output.

.. note::

   Drivers shall *not* switch the video standard
   automatically if a new video standard is detected. Instead, drivers
   should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
   this) and expect that userspace will take action by calling
   :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
   different buffer sizes as well, and you cannot change buffer sizes on
   the fly. In general, applications that receive the Source Change event
   will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
   standard is valid they will have to stop streaming, set the new
   standard, allocate new buffers and start streaming again.

반환값과 오류

61-69

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다.

QUERYSTD 전용 오류
errno조건
`ENODATA`현재 input 또는 output이 standard video timing을 지원하지 않음

현재 입출력의 영상 timing 기능을 검사합니다.

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.

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