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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_AUDOUT·VIDIOC_S_AUDOUT ioctl

현재 V4L2 audio output을 조회·선택하고 writable 속성 부재, 0 초기화 규칙과 loop-back connector 제외 조건을 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-g-audioout.rst:1-99

현재 V4L2 audio output을 조회·선택하고 writable 속성 부재, 0 초기화 규칙과 loop-back connector 제외 조건을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_G_AUDOUT:
5
6 **************************************
7 ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
8 **************************************
9
10 Name
11 ====
12
13 VIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_G_AUDOUT
19
20 ``int ioctl(int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp)``
21
22 .. c:macro:: VIDIOC_S_AUDOUT
23
24 ``int ioctl(int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp)``
25
26 Arguments
27 =========
28
29 ``fd``
30 File descriptor returned by :c:func:`open()`.
31
32 ``argp``
33 Pointer to struct :c:type:`v4l2_audioout`.
34
35 Description
36 ===========
37
38 To query the current audio output applications zero out the ``reserved``
39 array of a struct :c:type:`v4l2_audioout` and call the
40 ``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill
41 the rest of the structure or return an ``EINVAL`` error code when the device
42 has no audio inputs, or none which combine with the current video
43 output.
44
45 Audio outputs have no writable properties. Nevertheless, to select the
46 current audio output applications can initialize the ``index`` field and
47 ``reserved`` array (which in the future may contain writable properties)
48 of a struct :c:type:`v4l2_audioout` structure and call the
49 ``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or
50 return the ``EINVAL`` error code when the index is out of bounds. This is a
51 write-only ioctl, it does not return the current audio output attributes
52 as ``VIDIOC_G_AUDOUT`` does.
53
54 .. note::
55
56 Connectors on a TV card to loop back the received audio signal
57 to a sound card are not audio outputs in this sense.
58
59 .. c:type:: v4l2_audioout
60
61 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
62
63 .. flat-table:: struct v4l2_audioout
64 :header-rows: 0
65 :stub-columns: 0
66 :widths: 1 1 2
67
68 * - __u32
69 - ``index``
70 - Identifies the audio output, set by the driver or application.
71 * - __u8
72 - ``name``\ [32]
73 - Name of the audio output, a NUL-terminated ASCII string, for
74 example: "Line Out". This information is intended for the user,
75 preferably the connector label on the device itself.
76 * - __u32
77 - ``capability``
78 - Audio capability flags, none defined yet. Drivers must set this
79 field to zero.
80 * - __u32
81 - ``mode``
82 - Audio mode, none defined yet. Drivers and applications (on
83 ``VIDIOC_S_AUDOUT``) must set this field to zero.
84 * - __u32
85 - ``reserved``\ [2]
86 - Reserved for future extensions. Drivers and applications must set
87 the array to zero.
88
89 Return Value
90 ============
91
92 On success 0 is returned, on error -1 and the ``errno`` variable is set
93 appropriately. The generic error codes are described at the
94 :ref:`Generic Error Codes <gen-errors>` chapter.
95
96 EINVAL
97 No audio outputs combine with the current video output, or the
98 number of the selected audio output is out of bounds or it does not
99 combine.
100

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-34

`VIDIOC_G_AUDOUT`은 현재 audio output을 조회하고, `VIDIOC_S_AUDOUT`은 현재 audio output을 선택하는 ioctl입니다.

조회 형식은 `int ioctl(int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp)`, 선택 형식은 `int ioctl(int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp)`입니다.

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

.. _VIDIOC_G_AUDOUT:

**************************************
ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
**************************************

Name
====

VIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output

Synopsis
========

.. c:macro:: VIDIOC_G_AUDOUT

``int ioctl(int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp)``

.. c:macro:: VIDIOC_S_AUDOUT

``int ioctl(int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp)``

Arguments
=========

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

``argp``
    Pointer to struct :c:type:`v4l2_audioout`.

현재 출력 조회와 선택

35-58

현재 audio output을 조회할 때 응용 프로그램은 `v4l2_audioout.reserved` 배열을 0으로 만들고 `VIDIOC_G_AUDOUT`을 호출합니다. 드라이버가 나머지 구조체를 채웁니다.

로컬 원문은 조회 실패 조건을 장치에 `audio inputs`가 없거나 현재 video output과 조합되는 항목이 없는 경우라고 표현합니다. 명령과 구조체 문맥은 audio output을 다루지만, 이 원문 표현은 임의로 바꾸지 않고 그대로 주의 대상으로 남깁니다.

audio output에는 현재 정의된 writable 속성이 없습니다. 그래도 `index`와 미래 writable 속성용 `reserved`를 초기화해 `VIDIOC_S_AUDOUT`을 호출하면 현재 audio output을 선택할 수 있습니다.

요청 index가 범위를 벗어나면 드라이버는 `EINVAL`을 반환합니다. `VIDIOC_S_AUDOUT`도 write-only이므로 `VIDIOC_G_AUDOUT`처럼 현재 출력 속성을 반환하지 않습니다.

TV 카드에서 수신한 audio 신호를 sound card로 되돌려 보내는 loop-back connector는 이 API의 audio output이 아닙니다.

Audio output 조회·선택
reserved=0G_AUDOUT으로 현재 출력 조회선택할 index 설정S_AUDOUT 호출필요하면 G_AUDOUT으로 속성 조회

속성이 없는 현재 출력 선택과 재조회를 구분합니다.

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

To query the current audio output applications zero out the ``reserved``
array of a struct :c:type:`v4l2_audioout` and call the
``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill
the rest of the structure or return an ``EINVAL`` error code when the device
has no audio inputs, or none which combine with the current video
output.

Audio outputs have no writable properties. Nevertheless, to select the
current audio output applications can initialize the ``index`` field and
``reserved`` array (which in the future may contain writable properties)
of a struct :c:type:`v4l2_audioout` structure and call the
``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or
return the ``EINVAL`` error code when the index is out of bounds. This is a
write-only ioctl, it does not return the current audio output attributes
as ``VIDIOC_G_AUDOUT`` does.

.. note::

   Connectors on a TV card to loop back the received audio signal
   to a sound card are not audio outputs in this sense.

v4l2_audioout 구조체

59-88
struct v4l2_audioout
형식필드의미
`__u32``index`audio output 식별 순번. 드라이버 또는 응용 프로그램이 설정
`__u8[32]``name``Line Out` 같은 NUL 종료 ASCII 출력 이름. 장치 커넥터 라벨이 바람직함
`__u32``capability`아직 정의된 플래그가 없으므로 드라이버가 0으로 설정
`__u32``mode`아직 정의된 mode가 없으므로 드라이버와 `VIDIOC_S_AUDOUT` 호출 응용 프로그램 모두 0으로 설정
`__u32[2]``reserved`미래 확장용. 드라이버와 응용 프로그램 모두 0으로 설정

현재 또는 선택할 audio output의 필드입니다.

`index`는 조회에서는 드라이버의 출력값이고 선택에서는 응용 프로그램의 입력값입니다. `name`은 사용자가 실제 단자를 식별할 수 있는 문자열이어야 합니다.

현재 `capability`, `mode`, `reserved`에는 정의된 출력 속성이 없으므로 모두 0이어야 합니다. 특히 미래 확장용 공간에 임의 값을 넣어서는 안 됩니다.

.. c:type:: v4l2_audioout

.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|

.. flat-table:: struct v4l2_audioout
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``index``
      - Identifies the audio output, set by the driver or application.
    * - __u8
      - ``name``\ [32]
      - Name of the audio output, a NUL-terminated ASCII string, for
	example: "Line Out". This information is intended for the user,
	preferably the connector label on the device itself.
    * - __u32
      - ``capability``
      - Audio capability flags, none defined yet. Drivers must set this
	field to zero.
    * - __u32
      - ``mode``
      - Audio mode, none defined yet. Drivers and applications (on
	``VIDIOC_S_AUDOUT``) must set this field to zero.
    * - __u32
      - ``reserved``\ [2]
      - Reserved for future extensions. Drivers and applications must set
	the array to zero.

반환값과 EINVAL

89-99

성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 설정하며, 공통 오류 코드는 Generic Error Codes 장을 따릅니다.

G_AUDOUT·S_AUDOUT 오류
errno조건
`EINVAL`현재 video output과 조합되는 audio output이 없거나 선택 번호가 범위를 벗어나거나 현재 video output과 조합되지 않음

현재 video output과 결합 가능한 audio 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
    No audio outputs combine with the current video output, or the
    number of the selected audio output is out of bounds or it does not
    combine.