1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_G_MODULATOR:
5 ********************************************
6 ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
7 ********************************************
12 VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_modulator *argp )
20 .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_modulator *argp )
27 File descriptor returned by :ref:`open() <func-open>`.
30 VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
38 To query the attributes of a modulator applications initialize the
39 ``index`` field and zero out the ``reserved`` array of a struct
40 :ref:`v4l2_modulator <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
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
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
60 To change the radio frequency the
61 :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.
66 .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}|
68 .. flat-table:: struct v4l2_modulator
80 - Identifies the modulator, set by the application.
88 - Name of the modulator, a NUL-terminated ASCII string. This
89 information is intended for the user.
97 - Modulator capability flags. No flags are defined for this field,
98 the tuner flags in struct :ref:`v4l2_tuner <v4l2-tuner>` are
99 used accordingly. The audio flags indicate the ability to encode
100 audio subprograms. They will *not* change for example with the
101 current video standard.
109 - The lowest tunable frequency in units of 62.5 KHz, or if the
110 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
111 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
112 set, in units of 1 Hz.
120 - The highest tunable frequency in units of 62.5 KHz, or if the
121 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
122 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
123 set, in units of 1 Hz.
131 - With this field applications can determine how audio sub-carriers
132 shall be modulated. It contains a set of flags as defined in
133 :ref:`modulator-txsubchans`.
137 The tuner ``rxsubchans`` flags are reused, but the
138 semantics are different. Video output devices
139 are assumed to have an analog or PCM audio input with 1-3
140 channels. The ``txsubchans`` flags select one or more channels
141 for modulation, together with some audio subprogram indicator,
142 for example, a stereo pilot tone.
150 - :cspan:`2` Type of the modulator, see :ref:`v4l2-tuner-type`.
158 - Reserved for future extensions. Drivers and applications must set
163 .. _modulator-txsubchans:
165 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
167 .. flat-table:: Modulator Audio Transmission Flags
175 - ``V4L2_TUNER_SUB_MONO``
179 - Modulate channel 1 as mono audio, when the input has more
180 channels, a down-mix of channel 1 and 2. This flag does not
181 combine with ``V4L2_TUNER_SUB_STEREO`` or
182 ``V4L2_TUNER_SUB_LANG1``.
186 - ``V4L2_TUNER_SUB_STEREO``
190 - Modulate channel 1 and 2 as left and right channel of a stereo
191 audio signal. When the input has only one channel or two channels
192 and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as
193 left and right channel. This flag does not combine with
194 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the
195 driver does not support stereo audio it shall fall back to mono.
199 - ``V4L2_TUNER_SUB_LANG1``
203 - Modulate channel 1 and 2 as primary and secondary language of a
204 bilingual audio signal. When the input has only one channel it is
205 used for both languages. It is not possible to encode the primary
206 or secondary language only. This flag does not combine with
207 ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or
208 ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the
209 respective audio matrix, or the current video standard does not
210 permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall
211 return an ``EINVAL`` error code and the driver shall fall back to mono
216 - ``V4L2_TUNER_SUB_LANG2``
220 - Same effect as ``V4L2_TUNER_SUB_SAP``.
224 - ``V4L2_TUNER_SUB_SAP``
228 - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is
229 encoded as mono audio, the last channel as Second Audio Program.
230 When the input has only one channel it is used for both audio
231 tracks. When the input has three channels the mono track is a
232 down-mix of channel 1 and 2. When combined with
233 ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and
234 right stereo audio, channel 3 as Second Audio Program. When the
235 input has only two channels, the first is encoded as left and
236 right channel and the second as SAP. When the input has only one
237 channel it is used for all audio tracks. It is not possible to
238 encode a Second Audio Program only. This flag must combine with
239 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the
240 hardware does not support the respective audio matrix, or the
241 current video standard does not permit SAP the
242 :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and
243 driver shall fall back to mono or stereo mode.
247 - ``V4L2_TUNER_SUB_RDS``
251 - Enable the RDS encoder for a radio FM transmitter.
257 On success 0 is returned, on error -1 and the ``errno`` variable is set
258 appropriately. The generic error codes are described at the
259 :ref:`Generic Error Codes <gen-errors>` chapter.
262 The struct :ref:`v4l2_modulator <v4l2-modulator>` ``index`` is