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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_OUTPUT·VIDIOC_S_OUTPUT ioctl

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

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

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

1. 요약·해설

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

요약·해설

vidioc-g-output.rst:1-65

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

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-34

`VIDIOC_G_OUTPUT`과 `VIDIOC_S_OUTPUT`은 현재 video output을 조회하거나 선택합니다. 두 명령은 output index를 담는 `int *argp`를 받고, `fd`는 `open()`이 반환한 파일 디스크립터입니다.

output index는 `struct v4l2_output.index`와 같은 번호 체계를 사용합니다. 사용 가능한 output 정보는 `VIDIOC_ENUMOUTPUT`으로 열거합니다.

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

.. _VIDIOC_G_OUTPUT:

**************************************
ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT
**************************************

Name
====

VIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output

Synopsis
========

.. c:macro:: VIDIOC_G_OUTPUT

``int ioctl(int fd, VIDIOC_G_OUTPUT, int *argp)``

.. c:macro:: VIDIOC_S_OUTPUT

``int ioctl(int fd, VIDIOC_S_OUTPUT, int *argp)``

Arguments
=========

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

``argp``
    Pointer to an integer with output index.

현재 출력 조회와 선택 순서

35-55

현재 video output을 조회하려면 정수 포인터로 G_OUTPUT을 호출합니다. 드라이버가 현재 output 번호를 저장하며 video output이 하나도 없으면 `EINVAL`입니다.

출력을 선택하려면 원하는 번호를 정수에 저장해 S_OUTPUT을 호출합니다. output마다 지원하는 video standard가 다를 수 있어 드라이버가 현재 standard를 암묵적으로 전환하는 등 부작용이 생길 수 있습니다.

따라서 애플리케이션은 다른 매개변수를 조회하거나 협상하기 전에 output을 먼저 선택하고, 이후 format·standard·streaming parameter를 다시 확인해야 합니다.

video output 선택 순서
VIDIOC_ENUMOUTPUT으로 output 목록 확인원하는 index로 VIDIOC_S_OUTPUT 호출현재 video standard 재조회format과 streaming parameter 협상VIDIOC_G_OUTPUT으로 현재 index 확인

출력 변경으로 기존 협상 값이 무효화되는 일을 피합니다.

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

To query the current video output applications call the
:ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a pointer to an integer where the driver
stores the number of the output, as in the struct
:c:type:`v4l2_output` ``index`` field. This ioctl will
fail only when there are no video outputs, returning the ``EINVAL`` error
code.

To select a video output applications store the number of the desired
output in an integer and call the :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a
pointer to this integer. Side effects are possible. For example outputs
may support different video standards, so the driver may implicitly
switch the current standard. Because of these possible side
effects applications must select an output before querying or
negotiating any other parameters.

Information about video outputs is available using the
:ref:`VIDIOC_ENUMOUTPUT` ioctl.

반환값과 오류

56-65

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

output 오류
errno조건
`EINVAL`video output 번호가 범위를 벗어나거나 output이 하나도 없음

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

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 output is out of bounds, or there are no
    video outputs at all.