요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_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`.
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.
.. 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.
.. 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.
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.
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`를 사용합니다.
속성 조회, 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-121modulator 식별, 조정 범위와 송신 audio subchannel을 나타냅니다.
`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입력 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 장의 공통 오류도 적용됩니다.
열거와 조회·설정의 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.
요약·해설
vidioc-g-modulator.rst:1-193modulator 속성과 audio transmission flag 조합 및 주파수 범위를 다룹니다.