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