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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_MODULATOR·VIDIOC_S_MODULATOR ioctl

V4L2 modulator를 열거하고 audio subchannel 조합, SDR transmitter type과 capability별 주파수 범위를 조회·설정하는 규칙을 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-g-modulator.rst:1-193

modulator 속성과 audio transmission flag 조합 및 주파수 범위를 다룹니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_G_MODULATOR:
5
6 ********************************************
7 ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
8 ********************************************
9
10 Name
11 ====
12
13 VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_G_MODULATOR
19
20 ``int ioctl(int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp)``
21
22 .. c:macro:: VIDIOC_S_MODULATOR
23
24 ``int ioctl(int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *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_modulator`.
34
35 Description
36 ===========
37
38 To query the attributes of a modulator applications initialize the
39 ``index`` field and zero out the ``reserved`` array of a struct
40 :c:type:`v4l2_modulator` and call the
41 :ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` ioctl with a pointer to this structure. Drivers
42 fill the rest of the structure or return an ``EINVAL`` error code when the
43 index is out of bounds. To enumerate all modulators applications shall
44 begin at index zero, incrementing by one until the driver returns
45 EINVAL.
46
47 Modulators have two writable properties, an audio modulation set and the
48 radio frequency. To change the modulated audio subprograms, applications
49 initialize the ``index`` and ``txsubchans`` fields and the ``reserved``
50 array and call the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Drivers may choose a
51 different audio modulation if the request cannot be satisfied. However
52 this is a write-only ioctl, it does not return the actual audio
53 modulation selected.
54
55 :ref:`SDR <sdr>` specific modulator types are ``V4L2_TUNER_SDR`` and
56 ``V4L2_TUNER_RF``. For SDR devices ``txsubchans`` field must be
57 initialized to zero. The term 'modulator' means SDR transmitter in this
58 context.
59
60 To change the radio frequency the
61 :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.
62
63 .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{2.4cm}|
64
65 .. c:type:: v4l2_modulator
66
67 .. flat-table:: struct v4l2_modulator
68 :header-rows: 0
69 :stub-columns: 0
70 :widths: 1 1 2 1 1
71
72 * - __u32
73 - ``index``
74 - Identifies the modulator, set by the application.
75 * - __u8
76 - ``name``\ [32]
77 - Name of the modulator, a NUL-terminated ASCII string.
78
79 This information is intended for the user.
80 * - __u32
81 - ``capability``
82 - Modulator capability flags. No flags are defined for this field,
83 the tuner flags in struct :c:type:`v4l2_tuner` are
84 used accordingly. The audio flags indicate the ability to encode
85 audio subprograms. They will *not* change for example with the
86 current video standard.
87 * - __u32
88 - ``rangelow``
89 - The lowest tunable frequency in units of 62.5 KHz, or if the
90 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
91 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
92 set, in units of 1 Hz.
93 * - __u32
94 - ``rangehigh``
95 - The highest tunable frequency in units of 62.5 KHz, or if the
96 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
97 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
98 set, in units of 1 Hz.
99 * - __u32
100 - ``txsubchans``
101 - With this field applications can determine how audio sub-carriers
102 shall be modulated. It contains a set of flags as defined in
103 :ref:`modulator-txsubchans`.
104
105 .. note::
106
107 The tuner ``rxsubchans`` flags are reused, but the
108 semantics are different. Video output devices
109 are assumed to have an analog or PCM audio input with 1-3
110 channels. The ``txsubchans`` flags select one or more channels
111 for modulation, together with some audio subprogram indicator,
112 for example, a stereo pilot tone.
113 * - __u32
114 - ``type``
115 - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`.
116 * - __u32
117 - ``reserved``\ [3]
118 - Reserved for future extensions.
119
120 Drivers and applications must set the array to zero.
121
122 .. tabularcolumns:: |p{6.0cm}|p{2.0cm}|p{9.3cm}|
123
124 .. cssclass:: longtable
125
126 .. _modulator-txsubchans:
127
128 .. flat-table:: Modulator Audio Transmission Flags
129 :header-rows: 0
130 :stub-columns: 0
131 :widths: 3 1 4
132
133 * - ``V4L2_TUNER_SUB_MONO``
134 - 0x0001
135 - Modulate channel 1 as mono audio, when the input has more
136 channels, a down-mix of channel 1 and 2. This flag does not
137 combine with ``V4L2_TUNER_SUB_STEREO`` or
138 ``V4L2_TUNER_SUB_LANG1``.
139 * - ``V4L2_TUNER_SUB_STEREO``
140 - 0x0002
141 - Modulate channel 1 and 2 as left and right channel of a stereo
142 audio signal. When the input has only one channel or two channels
143 and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as
144 left and right channel. This flag does not combine with
145 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the
146 driver does not support stereo audio it shall fall back to mono.
147 * - ``V4L2_TUNER_SUB_LANG1``
148 - 0x0008
149 - Modulate channel 1 and 2 as primary and secondary language of a
150 bilingual audio signal. When the input has only one channel it is
151 used for both languages. It is not possible to encode the primary
152 or secondary language only. This flag does not combine with
153 ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or
154 ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the
155 respective audio matrix, or the current video standard does not
156 permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall
157 return an ``EINVAL`` error code and the driver shall fall back to mono
158 or stereo mode.
159 * - ``V4L2_TUNER_SUB_LANG2``
160 - 0x0004
161 - Same effect as ``V4L2_TUNER_SUB_SAP``.
162 * - ``V4L2_TUNER_SUB_SAP``
163 - 0x0004
164 - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is
165 encoded as mono audio, the last channel as Second Audio Program.
166 When the input has only one channel it is used for both audio
167 tracks. When the input has three channels the mono track is a
168 down-mix of channel 1 and 2. When combined with
169 ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and
170 right stereo audio, channel 3 as Second Audio Program. When the
171 input has only two channels, the first is encoded as left and
172 right channel and the second as SAP. When the input has only one
173 channel it is used for all audio tracks. It is not possible to
174 encode a Second Audio Program only. This flag must combine with
175 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the
176 hardware does not support the respective audio matrix, or the
177 current video standard does not permit SAP the
178 :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and
179 driver shall fall back to mono or stereo mode.
180 * - ``V4L2_TUNER_SUB_RDS``
181 - 0x0010
182 - Enable the RDS encoder for a radio FM transmitter.
183
184 Return Value
185 ============
186
187 On success 0 is returned, on error -1 and the ``errno`` variable is set
188 appropriately. The generic error codes are described at the
189 :ref:`Generic Error Codes <gen-errors>` chapter.
190
191 EINVAL
192 The struct :c:type:`v4l2_modulator` ``index`` is
193 out of bounds.
194

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-34

`VIDIOC_G_MODULATOR`와 `VIDIOC_S_MODULATOR`는 modulator 속성을 조회하거나 설정합니다. 두 명령은 `struct v4l2_modulator`를 사용하며 조회는 수정 가능한 포인터, 설정은 const 포인터를 받습니다.

`fd`는 `open()`이 반환한 파일 디스크립터이고 `argp`는 대상 modulator의 index와 속성을 담은 구조체를 가리킵니다.

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

.. _VIDIOC_G_MODULATOR:

********************************************
ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
********************************************

Name
====

VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes

Synopsis
========

.. c:macro:: VIDIOC_G_MODULATOR

``int ioctl(int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp)``

.. c:macro:: VIDIOC_S_MODULATOR

``int ioctl(int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *argp)``

Arguments
=========

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

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

열거, audio 설정과 SDR

35-62

속성을 조회하려면 `index`를 초기화하고 `reserved`를 0으로 만든 뒤 G_MODULATOR를 호출합니다. 드라이버가 나머지를 채우며 index가 범위를 벗어나면 `EINVAL`입니다. 모든 modulator는 index 0부터 하나씩 늘려 `EINVAL`이 나올 때까지 열거합니다.

modulator의 쓰기 가능한 속성은 audio modulation 집합과 radio frequency입니다. audio subprogram은 `index`, `txsubchans`, `reserved`를 채워 S_MODULATOR로 설정합니다.

요청을 만족할 수 없으면 드라이버가 다른 audio modulation을 선택할 수 있습니다. 하지만 S_MODULATOR는 write-only여서 실제 선택된 modulation을 반환하지 않으므로 G_MODULATOR로 다시 조회해야 합니다.

SDR 전용 modulator type은 `V4L2_TUNER_SDR`과 `V4L2_TUNER_RF`입니다. SDR 장치에서는 `txsubchans = 0`이어야 하며 여기서 modulator는 SDR transmitter를 뜻합니다.

radio frequency를 바꾸는 작업은 이 ioctl이 아니라 `VIDIOC_S_FREQUENCY`를 사용합니다.

modulator 열거와 설정
index=0부터 G_MODULATOR 반복EINVAL에서 열거 종료audio는 txsubchans로 S_MODULATOR 설정실제 audio modulation은 G_MODULATOR로 재조회주파수는 VIDIOC_S_FREQUENCY로 별도 설정

속성 조회, audio subchannel 설정과 주파수 설정을 분리합니다.

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

To query the attributes of a modulator applications initialize the
``index`` field and zero out the ``reserved`` array of a struct
:c:type:`v4l2_modulator` and call the
:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` ioctl with a pointer to this structure. Drivers
fill the rest of the structure or return an ``EINVAL`` error code when the
index is out of bounds. To enumerate all modulators applications shall
begin at index zero, incrementing by one until the driver returns
EINVAL.

Modulators have two writable properties, an audio modulation set and the
radio frequency. To change the modulated audio subprograms, applications
initialize the ``index`` and ``txsubchans`` fields and the ``reserved``
array and call the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Drivers may choose a
different audio modulation if the request cannot be satisfied. However
this is a write-only ioctl, it does not return the actual audio
modulation selected.

:ref:`SDR <sdr>` specific modulator types are ``V4L2_TUNER_SDR`` and
``V4L2_TUNER_RF``. For SDR devices ``txsubchans`` field must be
initialized to zero. The term 'modulator' means SDR transmitter in this
context.

To change the radio frequency the
:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.

struct v4l2_modulator

63-121
v4l2_modulator 필드
형식필드의미
`__u32``index`애플리케이션이 설정하는 modulator 식별자
`__u8[32]``name[32]`사용자 표시용 NUL 종료 ASCII 이름
`__u32``capability`별도 modulator flag 없이 `v4l2_tuner` capability flag를 재사용. audio flag는 audio subprogram 인코딩 능력
`__u32``rangelow`capability 단위로 표현한 최저 조정 주파수
`__u32``rangehigh`capability 단위로 표현한 최고 조정 주파수
`__u32``txsubchans`변조할 audio sub-carrier와 subprogram indicator flag 집합
`__u32``type``enum v4l2_tuner_type`의 modulator type
`__u32[3]``reserved[3]`미래 확장용. 드라이버와 애플리케이션 모두 0

modulator 식별, 조정 범위와 송신 audio subchannel을 나타냅니다.

주파수 범위 단위
capability단위
기본62.5 kHz
`V4L2_TUNER_CAP_LOW`62.5 Hz
`V4L2_TUNER_CAP_1HZ`1 Hz

`rangelow`와 `rangehigh`에 공통으로 적용됩니다.

audio capability flag는 현재 video standard가 바뀌어도 달라지지 않습니다. `txsubchans`는 tuner의 `rxsubchans` bit를 재사용하지만 의미는 다릅니다.

video output 장치는 1~3 channel의 analog 또는 PCM audio 입력을 가진다고 가정합니다. `txsubchans`는 변조할 channel과 stereo pilot tone 같은 audio subprogram indicator를 함께 선택합니다.

.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{2.4cm}|

.. c:type:: v4l2_modulator

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

    * - __u32
      - ``index``
      - Identifies the modulator, set by the application.
    * - __u8
      - ``name``\ [32]
      - Name of the modulator, a NUL-terminated ASCII string.

	This information is intended for the user.
    * - __u32
      - ``capability``
      - Modulator capability flags. No flags are defined for this field,
	the tuner flags in struct :c:type:`v4l2_tuner` are
	used accordingly. The audio flags indicate the ability to encode
	audio subprograms. They will *not* change for example with the
	current video standard.
    * - __u32
      - ``rangelow``
      - The lowest tunable frequency in units of 62.5 KHz, or if the
	``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
	62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
	set, in units of 1 Hz.
    * - __u32
      - ``rangehigh``
      - The highest tunable frequency in units of 62.5 KHz, or if the
	``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
	62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
	set, in units of 1 Hz.
    * - __u32
      - ``txsubchans``
      - With this field applications can determine how audio sub-carriers
	shall be modulated. It contains a set of flags as defined in
	:ref:`modulator-txsubchans`.

	.. note::

	   The tuner ``rxsubchans`` flags  are reused, but the
	   semantics are different. Video output devices
	   are assumed to have an analog or PCM audio input with 1-3
	   channels. The ``txsubchans`` flags select one or more channels
	   for modulation, together with some audio subprogram indicator,
	   for example, a stereo pilot tone.
    * - __u32
      - ``type``
      - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`.
    * - __u32
      - ``reserved``\ [3]
      - Reserved for future extensions.

	Drivers and applications must set the array to zero.

Modulator Audio Transmission Flags

122-183
Audio Transmission Flags
상수동작과 조합
`V4L2_TUNER_SUB_MONO``0x0001`channel 1을 mono로 변조. 다채널이면 channel 1·2 down-mix. STEREO·LANG1과 조합 불가
`V4L2_TUNER_SUB_STEREO``0x0002`channel 1·2를 좌·우 stereo로 변조. MONO·LANG1과 조합 불가, stereo 미지원이면 mono로 fallback
`V4L2_TUNER_SUB_LANG1``0x0008`channel 1·2를 bilingual primary·secondary language로 변조. MONO·STEREO·SAP와 조합 불가
`V4L2_TUNER_SUB_LANG2``0x0004``V4L2_TUNER_SUB_SAP`과 같은 효과
`V4L2_TUNER_SUB_SAP``0x0004`MONO 또는 STEREO와 결합해 Second Audio Program 추가. SAP만 단독 인코딩 불가
`V4L2_TUNER_SUB_RDS``0x0010`radio FM transmitter의 RDS encoder 활성화

입력 channel을 mono·stereo·bilingual·SAP·RDS로 배치합니다.

STEREO에서 입력이 한 channel이거나 두 channel이면서 SAP도 설정되면 channel 1을 좌·우 모두에 사용합니다. 드라이버가 stereo를 지원하지 않으면 mono로 fallback해야 합니다.

LANG1은 channel 1·2를 primary·secondary language로 사용하고 한 channel만 있으면 양쪽 language에 같은 channel을 씁니다. 한쪽 language만 인코딩할 수는 없습니다. audio matrix 또는 현재 standard가 bilingual audio를 지원하지 않으면 `EINVAL`을 반환하고 mono 또는 stereo로 fallback합니다.

MONO+SAP에서는 첫 channel이 mono, 마지막 channel이 SAP입니다. 1 channel이면 두 track에 같이 쓰고 3 channel이면 mono track은 channel 1·2의 down-mix입니다.

STEREO+SAP에서는 channel 1·2가 좌·우이고 channel 3이 SAP입니다. 2 channel이면 첫 channel을 좌·우에, 둘째를 SAP에 쓰며 1 channel이면 모든 track에 같은 channel을 씁니다.

SAP는 MONO 또는 STEREO와 반드시 결합해야 합니다. audio matrix나 video standard가 SAP를 허용하지 않으면 S_MODULATOR가 `EINVAL`을 반환하고 드라이버는 mono 또는 stereo로 fallback합니다.

.. tabularcolumns:: |p{6.0cm}|p{2.0cm}|p{9.3cm}|

.. cssclass:: longtable

.. _modulator-txsubchans:

.. flat-table:: Modulator Audio Transmission Flags
    :header-rows:  0
    :stub-columns: 0
    :widths:       3 1 4

    * - ``V4L2_TUNER_SUB_MONO``
      - 0x0001
      - Modulate channel 1 as mono audio, when the input has more
	channels, a down-mix of channel 1 and 2. This flag does not
	combine with ``V4L2_TUNER_SUB_STEREO`` or
	``V4L2_TUNER_SUB_LANG1``.
    * - ``V4L2_TUNER_SUB_STEREO``
      - 0x0002
      - Modulate channel 1 and 2 as left and right channel of a stereo
	audio signal. When the input has only one channel or two channels
	and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as
	left and right channel. This flag does not combine with
	``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the
	driver does not support stereo audio it shall fall back to mono.
    * - ``V4L2_TUNER_SUB_LANG1``
      - 0x0008
      - Modulate channel 1 and 2 as primary and secondary language of a
	bilingual audio signal. When the input has only one channel it is
	used for both languages. It is not possible to encode the primary
	or secondary language only. This flag does not combine with
	``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or
	``V4L2_TUNER_SUB_SAP``. If the hardware does not support the
	respective audio matrix, or the current video standard does not
	permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall
	return an ``EINVAL`` error code and the driver shall fall back to mono
	or stereo mode.
    * - ``V4L2_TUNER_SUB_LANG2``
      - 0x0004
      - Same effect as ``V4L2_TUNER_SUB_SAP``.
    * - ``V4L2_TUNER_SUB_SAP``
      - 0x0004
      - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is
	encoded as mono audio, the last channel as Second Audio Program.
	When the input has only one channel it is used for both audio
	tracks. When the input has three channels the mono track is a
	down-mix of channel 1 and 2. When combined with
	``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and
	right stereo audio, channel 3 as Second Audio Program. When the
	input has only two channels, the first is encoded as left and
	right channel and the second as SAP. When the input has only one
	channel it is used for all audio tracks. It is not possible to
	encode a Second Audio Program only. This flag must combine with
	``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the
	hardware does not support the respective audio matrix, or the
	current video standard does not permit SAP the
	:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and
	driver shall fall back to mono or stereo mode.
    * - ``V4L2_TUNER_SUB_RDS``
      - 0x0010
      - Enable the RDS encoder for a radio FM transmitter.

반환값과 오류

184-193

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

modulator 오류
errno조건
`EINVAL``v4l2_modulator.index`가 범위를 벗어남. audio 조합이 하드웨어·표준에 맞지 않는 조건도 본문에서 EINVAL로 규정

열거와 조회·설정의 index 오류입니다.

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 struct :c:type:`v4l2_modulator` ``index`` is
    out of bounds.