194 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_G_MODULATOR:5 6********************************************7ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR8********************************************9 10Name11====12 13VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes14 15Synopsis16========17 18.. c:macro:: VIDIOC_G_MODULATOR19 20``int ioctl(int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp)``21 22.. c:macro:: VIDIOC_S_MODULATOR23 24``int ioctl(int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *argp)``25 26Arguments27=========28 29``fd``30 File descriptor returned by :c:func:`open()`.31 32``argp``33 Pointer to struct :c:type:`v4l2_modulator`.34 35Description36===========37 38To query the attributes of a modulator applications initialize the39``index`` field and zero out the ``reserved`` array of a struct40:c:type:`v4l2_modulator` and call the41:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` ioctl with a pointer to this structure. Drivers42fill the rest of the structure or return an ``EINVAL`` error code when the43index is out of bounds. To enumerate all modulators applications shall44begin at index zero, incrementing by one until the driver returns45EINVAL.46 47Modulators have two writable properties, an audio modulation set and the48radio frequency. To change the modulated audio subprograms, applications49initialize the ``index`` and ``txsubchans`` fields and the ``reserved``50array and call the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Drivers may choose a51different audio modulation if the request cannot be satisfied. However52this is a write-only ioctl, it does not return the actual audio53modulation selected.54 55:ref:`SDR <sdr>` specific modulator types are ``V4L2_TUNER_SDR`` and56``V4L2_TUNER_RF``. For SDR devices ``txsubchans`` field must be57initialized to zero. The term 'modulator' means SDR transmitter in this58context.59 60To change the radio frequency the61: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_modulator66 67.. flat-table:: struct v4l2_modulator68 :header-rows: 069 :stub-columns: 070 :widths: 1 1 2 1 171 72 * - __u3273 - ``index``74 - Identifies the modulator, set by the application.75 * - __u876 - ``name``\ [32]77 - Name of the modulator, a NUL-terminated ASCII string.78 79 This information is intended for the user.80 * - __u3281 - ``capability``82 - Modulator capability flags. No flags are defined for this field,83 the tuner flags in struct :c:type:`v4l2_tuner` are84 used accordingly. The audio flags indicate the ability to encode85 audio subprograms. They will *not* change for example with the86 current video standard.87 * - __u3288 - ``rangelow``89 - The lowest tunable frequency in units of 62.5 KHz, or if the90 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of91 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is92 set, in units of 1 Hz.93 * - __u3294 - ``rangehigh``95 - The highest tunable frequency in units of 62.5 KHz, or if the96 ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of97 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is98 set, in units of 1 Hz.99 * - __u32100 - ``txsubchans``101 - With this field applications can determine how audio sub-carriers102 shall be modulated. It contains a set of flags as defined in103 :ref:`modulator-txsubchans`.104 105 .. note::106 107 The tuner ``rxsubchans`` flags are reused, but the108 semantics are different. Video output devices109 are assumed to have an analog or PCM audio input with 1-3110 channels. The ``txsubchans`` flags select one or more channels111 for modulation, together with some audio subprogram indicator,112 for example, a stereo pilot tone.113 * - __u32114 - ``type``115 - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`.116 * - __u32117 - ``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:: longtable125 126.. _modulator-txsubchans:127 128.. flat-table:: Modulator Audio Transmission Flags129 :header-rows: 0130 :stub-columns: 0131 :widths: 3 1 4132 133 * - ``V4L2_TUNER_SUB_MONO``134 - 0x0001135 - Modulate channel 1 as mono audio, when the input has more136 channels, a down-mix of channel 1 and 2. This flag does not137 combine with ``V4L2_TUNER_SUB_STEREO`` or138 ``V4L2_TUNER_SUB_LANG1``.139 * - ``V4L2_TUNER_SUB_STEREO``140 - 0x0002141 - Modulate channel 1 and 2 as left and right channel of a stereo142 audio signal. When the input has only one channel or two channels143 and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as144 left and right channel. This flag does not combine with145 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the146 driver does not support stereo audio it shall fall back to mono.147 * - ``V4L2_TUNER_SUB_LANG1``148 - 0x0008149 - Modulate channel 1 and 2 as primary and secondary language of a150 bilingual audio signal. When the input has only one channel it is151 used for both languages. It is not possible to encode the primary152 or secondary language only. This flag does not combine with153 ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or154 ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the155 respective audio matrix, or the current video standard does not156 permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall157 return an ``EINVAL`` error code and the driver shall fall back to mono158 or stereo mode.159 * - ``V4L2_TUNER_SUB_LANG2``160 - 0x0004161 - Same effect as ``V4L2_TUNER_SUB_SAP``.162 * - ``V4L2_TUNER_SUB_SAP``163 - 0x0004164 - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is165 encoded as mono audio, the last channel as Second Audio Program.166 When the input has only one channel it is used for both audio167 tracks. When the input has three channels the mono track is a168 down-mix of channel 1 and 2. When combined with169 ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and170 right stereo audio, channel 3 as Second Audio Program. When the171 input has only two channels, the first is encoded as left and172 right channel and the second as SAP. When the input has only one173 channel it is used for all audio tracks. It is not possible to174 encode a Second Audio Program only. This flag must combine with175 ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the176 hardware does not support the respective audio matrix, or the177 current video standard does not permit SAP the178 :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and179 driver shall fall back to mono or stereo mode.180 * - ``V4L2_TUNER_SUB_RDS``181 - 0x0010182 - Enable the RDS encoder for a radio FM transmitter.183 184Return Value185============186 187On success 0 is returned, on error -1 and the ``errno`` variable is set188appropriately. The generic error codes are described at the189:ref:`Generic Error Codes <gen-errors>` chapter.190 191EINVAL192 The struct :c:type:`v4l2_modulator` ``index`` is193 out of bounds.194