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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_INPUT·VIDIOC_S_INPUT ioctl

현재 video input을 조회·선택하고 입력 변경의 video standard 부작용 때문에 다른 매개변수보다 먼저 선택해야 하는 순서를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-g-input.rst:1-63

현재 video input index를 조회하거나 선택하고 선택에 따른 매개변수 부작용을 관리합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_G_INPUT:
5
6 ************************************
7 ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
8 ************************************
9
10 Name
11 ====
12
13 VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_G_INPUT
19
20 ``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
21
22 .. c:macro:: VIDIOC_S_INPUT
23
24 ``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
25
26 Arguments
27 =========
28
29 ``fd``
30 File descriptor returned by :c:func:`open()`.
31
32 ``argp``
33 Pointer an integer with input index.
34
35 Description
36 ===========
37
38 To query the current video input applications call the
39 :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
40 stores the number of the input, as in the struct
41 :c:type:`v4l2_input` ``index`` field. This ioctl will fail
42 only when there are no video inputs, returning ``EINVAL``.
43
44 To select a video input applications store the number of the desired
45 input in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
46 to this integer. Side effects are possible. For example inputs may
47 support different video standards, so the driver may implicitly switch
48 the current standard. Because of these possible side effects
49 applications must select an input before querying or negotiating any
50 other parameters.
51
52 Information about video inputs is available using the
53 :ref:`VIDIOC_ENUMINPUT` ioctl.
54
55 Return Value
56 ============
57
58 On success 0 is returned, on error -1 and the ``errno`` variable is set
59 appropriately. The generic error codes are described at the
60 :ref:`Generic Error Codes <gen-errors>` chapter.
61
62 EINVAL
63 The number of the video input is out of bounds.
64

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 등 입력 종속 값을 다시 확인해야 합니다.

video input 선택 순서
VIDIOC_ENUMINPUT으로 input 목록 확인원하는 index로 VIDIOC_S_INPUT 호출필요하면 현재 standard 재조회format과 기타 입력 종속 매개변수 협상VIDIOC_G_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.

반환값과 오류

55-63

성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 설정하며 Generic Error Codes 장의 공통 오류도 적용됩니다.

input 오류
errno조건
`EINVAL`video input 번호가 범위를 벗어남. G_INPUT에서는 input이 전혀 없는 경우 포함

유일한 전용 오류 조건입니다.

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.