요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_G_STD:
**************************************************************************
ioctl VIDIOC_G_STD, VIDIOC_S_STD, VIDIOC_SUBDEV_G_STD, VIDIOC_SUBDEV_S_STD
**************************************************************************
Name
====
VIDIOC_G_STD - VIDIOC_S_STD - VIDIOC_SUBDEV_G_STD - VIDIOC_SUBDEV_S_STD - Query or select the video standard of the current input
Synopsis
========
.. c:macro:: VIDIOC_G_STD
``int ioctl(int fd, VIDIOC_G_STD, v4l2_std_id *argp)``
.. c:macro:: VIDIOC_S_STD
``int ioctl(int fd, VIDIOC_S_STD, const v4l2_std_id *argp)``
.. c:macro:: VIDIOC_SUBDEV_G_STD
``int ioctl(int fd, VIDIOC_SUBDEV_G_STD, v4l2_std_id *argp)``
.. c:macro:: VIDIOC_SUBDEV_S_STD
``int ioctl(int fd, VIDIOC_SUBDEV_S_STD, const v4l2_std_id *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to :c:type:`v4l2_std_id`.
Description
===========
To query and select the current video standard applications use the
:ref:`VIDIOC_G_STD <VIDIOC_G_STD>` and :ref:`VIDIOC_S_STD <VIDIOC_G_STD>` ioctls which take a pointer to a
:ref:`v4l2_std_id <v4l2-std-id>` type as argument. :ref:`VIDIOC_G_STD <VIDIOC_G_STD>`
can return a single flag or a set of flags as in struct
:c:type:`v4l2_standard` field ``id``. The flags must be
unambiguous such that they appear in only one enumerated
struct :c:type:`v4l2_standard` structure.
:ref:`VIDIOC_S_STD <VIDIOC_G_STD>` accepts one or more flags, being a write-only ioctl it
does not return the actual new standard as :ref:`VIDIOC_G_STD <VIDIOC_G_STD>` does. When
no flags are given or the current input does not support the requested
standard the driver returns an ``EINVAL`` error code. When the standard set
is ambiguous drivers may return ``EINVAL`` or choose any of the requested
standards. If the current input or output does not support standard
video timings (e.g. if :ref:`VIDIOC_ENUMINPUT`
does not set the ``V4L2_IN_CAP_STD`` flag), then ``ENODATA`` error code is
returned.
Calling ``VIDIOC_SUBDEV_S_STD`` 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``.
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
The :ref:`VIDIOC_S_STD <VIDIOC_G_STD>` parameter was unsuitable.
ENODATA
Standard video timings are not supported for this input or output.
EPERM
``VIDIOC_SUBDEV_S_STD`` has been called on a read-only subdevice.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
영상 표준 조회·선택 인터페이스
1-43`VIDIOC_G_STD`와 `VIDIOC_S_STD`는 현재 입력의 아날로그 영상 표준을 조회하거나 선택합니다. `VIDIOC_SUBDEV_G_STD`와 `VIDIOC_SUBDEV_S_STD`는 같은 작업을 V4L2 서브디바이스 노드에 적용합니다.
모든 명령은 `v4l2_std_id` 포인터를 사용하지만 읽기·쓰기 방향이 다릅니다.
`fd`는 `open()`이 반환한 파일 디스크립터이고, `argp`는 `v4l2_std_id`를 가리킵니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_G_STD:
**************************************************************************
ioctl VIDIOC_G_STD, VIDIOC_S_STD, VIDIOC_SUBDEV_G_STD, VIDIOC_SUBDEV_S_STD
**************************************************************************
Name
====
VIDIOC_G_STD - VIDIOC_S_STD - VIDIOC_SUBDEV_G_STD - VIDIOC_SUBDEV_S_STD - Query or select the video standard of the current input
Synopsis
========
.. c:macro:: VIDIOC_G_STD
``int ioctl(int fd, VIDIOC_G_STD, v4l2_std_id *argp)``
.. c:macro:: VIDIOC_S_STD
``int ioctl(int fd, VIDIOC_S_STD, const v4l2_std_id *argp)``
.. c:macro:: VIDIOC_SUBDEV_G_STD
``int ioctl(int fd, VIDIOC_SUBDEV_G_STD, v4l2_std_id *argp)``
.. c:macro:: VIDIOC_SUBDEV_S_STD
``int ioctl(int fd, VIDIOC_SUBDEV_S_STD, const v4l2_std_id *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to :c:type:`v4l2_std_id`.
Description
표준 플래그와 선택 규칙
44-67`VIDIOC_G_STD`는 `struct v4l2_standard`의 `id` 필드와 마찬가지로 플래그 하나 또는 플래그 집합을 반환할 수 있습니다. 반환된 집합은 열거된 `v4l2_standard` 구조체 하나에만 나타나도록 모호하지 않아야 합니다.
쓰기 전용인 `VIDIOC_S_STD`는 하나 이상의 표준 플래그를 받지만, 실제로 선택된 새 표준을 인자에 되돌려 주지 않습니다. 적용 결과를 확인하려면 별도로 `VIDIOC_G_STD`를 호출해야 합니다.
플래그가 비어 있거나 현재 입력이 요청 표준을 지원하지 않으면 `EINVAL`입니다. 표준 집합이 모호하면 드라이버는 `EINVAL`을 반환하거나 요청된 표준 가운데 하나를 선택할 수 있습니다.
현재 입력 또는 출력이 표준 영상 타이밍을 지원하지 않으면 `ENODATA`입니다. 예를 들어 `VIDIOC_ENUMINPUT` 결과에 `V4L2_IN_CAP_STD`가 설정되지 않은 경우가 이에 해당합니다.
읽기 전용으로 등록된 서브디바이스 노드에서 `VIDIOC_SUBDEV_S_STD`를 호출하는 것은 허용되지 않으며 `EPERM` 오류가 발생합니다.
===========
To query and select the current video standard applications use the
:ref:`VIDIOC_G_STD <VIDIOC_G_STD>` and :ref:`VIDIOC_S_STD <VIDIOC_G_STD>` ioctls which take a pointer to a
:ref:`v4l2_std_id <v4l2-std-id>` type as argument. :ref:`VIDIOC_G_STD <VIDIOC_G_STD>`
can return a single flag or a set of flags as in struct
:c:type:`v4l2_standard` field ``id``. The flags must be
unambiguous such that they appear in only one enumerated
struct :c:type:`v4l2_standard` structure.
:ref:`VIDIOC_S_STD <VIDIOC_G_STD>` accepts one or more flags, being a write-only ioctl it
does not return the actual new standard as :ref:`VIDIOC_G_STD <VIDIOC_G_STD>` does. When
no flags are given or the current input does not support the requested
standard the driver returns an ``EINVAL`` error code. When the standard set
is ambiguous drivers may return ``EINVAL`` or choose any of the requested
standards. If the current input or output does not support standard
video timings (e.g. if :ref:`VIDIOC_ENUMINPUT`
does not set the ``V4L2_IN_CAP_STD`` flag), then ``ENODATA`` error code is
returned.
Calling ``VIDIOC_SUBDEV_S_STD`` 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``.
반환값과 오류
68-82성공하면 0을 반환하고, 오류가 발생하면 -1을 반환한 뒤 `errno`를 설정합니다. 공통 오류는 Generic Error Codes 절을 따릅니다.
요청 내용, 장치 기능, 노드 권한에 따라 구분됩니다.
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
The :ref:`VIDIOC_S_STD <VIDIOC_G_STD>` parameter was unsuitable.
ENODATA
Standard video timings are not supported for this input or output.
EPERM
``VIDIOC_SUBDEV_S_STD`` has been called on a read-only subdevice.
요약·해설
vidioc-g-std.rst:1-82조회 결과의 표준 플래그는 하나의 열거 항목으로 판별 가능해야 하며, 설정 결과는 별도 조회로 확인합니다.