요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_INPUT:
************************************
ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
************************************
Name
====
VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
Synopsis
========
.. c:macro:: VIDIOC_G_INPUT
``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
.. c:macro:: VIDIOC_S_INPUT
``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer an integer with input index.
Description
===========
To query the current video input applications call the
:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
stores the number of the input, as in the struct
:c:type:`v4l2_input` ``index`` field. This ioctl will fail
only when there are no video inputs, returning ``EINVAL``.
To select a video input applications store the number of the desired
input in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
to this integer. Side effects are possible. For example inputs may
support different video standards, so the driver may implicitly switch
the current standard. Because of these possible side effects
applications must select an input before querying or negotiating any
other parameters.
Information about video inputs is available using the
:ref:`VIDIOC_ENUMINPUT` ioctl.
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 number of the video input is out of bounds.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 인자
1-34`VIDIOC_G_INPUT`과 `VIDIOC_S_INPUT`은 현재 video input을 조회하거나 선택합니다. 두 명령은 input index를 담는 `int *argp`를 받고, `fd`는 `open()`이 반환한 파일 디스크립터입니다.
index는 `struct v4l2_input.index`와 같은 번호 체계를 사용합니다. 사용 가능한 input 정보는 `VIDIOC_ENUMINPUT`으로 열거합니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_G_INPUT:
************************************
ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
************************************
Name
====
VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
Synopsis
========
.. c:macro:: VIDIOC_G_INPUT
``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
.. c:macro:: VIDIOC_S_INPUT
``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer an integer with input index.
현재 입력 조회와 선택 순서
35-54현재 video input을 조회하려면 정수 포인터로 `VIDIOC_G_INPUT`을 호출합니다. 드라이버가 현재 input 번호를 그 정수에 저장합니다. video input이 하나도 없는 경우에만 `EINVAL`로 실패합니다.
입력을 선택하려면 원하는 input 번호를 정수에 저장해 `VIDIOC_S_INPUT`을 호출합니다. 입력마다 지원하는 video standard가 다를 수 있으므로 드라이버가 현재 standard를 암묵적으로 바꾸는 등 부작용이 생길 수 있습니다.
이러한 부작용 때문에 애플리케이션은 다른 매개변수를 조회하거나 협상하기 전에 input부터 선택해야 합니다. 선택 뒤 format, standard, controls 등 입력 종속 값을 다시 확인해야 합니다.
입력 변경의 부작용이 뒤따르는 협상 값을 무효화하지 않도록 순서를 지킵니다.
Description
===========
To query the current video input applications call the
:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
stores the number of the input, as in the struct
:c:type:`v4l2_input` ``index`` field. This ioctl will fail
only when there are no video inputs, returning ``EINVAL``.
To select a video input applications store the number of the desired
input in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
to this integer. Side effects are possible. For example inputs may
support different video standards, so the driver may implicitly switch
the current standard. Because of these possible side effects
applications must select an input before querying or negotiating any
other parameters.
Information about video inputs is available using the
:ref:`VIDIOC_ENUMINPUT` ioctl.
반환값과 오류
55-63성공하면 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 number of the video input is out of bounds.
요약·해설
vidioc-g-input.rst:1-63현재 video input index를 조회하거나 선택하고 선택에 따른 매개변수 부작용을 관리합니다.