Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 1 | .. -*- coding: utf-8; mode: rst -*- |
| 2 | |
Mauro Carvalho Chehab | af4a4d0 | 2016-07-01 13:42:29 -0300 | [diff] [blame] | 3 | .. _VIDIOC_G_MODULATOR: |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 4 | |
| 5 | ******************************************** |
| 6 | ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR |
| 7 | ******************************************** |
| 8 | |
Mauro Carvalho Chehab | 15e7d61 | 2016-07-05 15:14:35 -0300 | [diff] [blame] | 9 | Name |
Mauro Carvalho Chehab | 586027c | 2016-07-05 07:58:48 -0300 | [diff] [blame] | 10 | ==== |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 11 | |
Mauro Carvalho Chehab | 586027c | 2016-07-05 07:58:48 -0300 | [diff] [blame] | 12 | VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 13 | |
Mauro Carvalho Chehab | 15e7d61 | 2016-07-05 15:14:35 -0300 | [diff] [blame] | 14 | |
| 15 | Synopsis |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 16 | ======== |
| 17 | |
Mauro Carvalho Chehab | 41d8046 | 2016-08-19 16:53:38 -0300 | [diff] [blame] | 18 | .. c:function:: int ioctl( int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp ) |
| 19 | :name: VIDIOC_G_MODULATOR |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 20 | |
Mauro Carvalho Chehab | 41d8046 | 2016-08-19 16:53:38 -0300 | [diff] [blame] | 21 | .. c:function:: int ioctl( int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *argp ) |
| 22 | :name: VIDIOC_S_MODULATOR |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 23 | |
Mauro Carvalho Chehab | 586027c | 2016-07-05 07:58:48 -0300 | [diff] [blame] | 24 | |
Mauro Carvalho Chehab | 15e7d61 | 2016-07-05 15:14:35 -0300 | [diff] [blame] | 25 | Arguments |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 26 | ========= |
| 27 | |
| 28 | ``fd`` |
| 29 | File descriptor returned by :ref:`open() <func-open>`. |
| 30 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 31 | ``argp`` |
| 32 | |
| 33 | |
Mauro Carvalho Chehab | 15e7d61 | 2016-07-05 15:14:35 -0300 | [diff] [blame] | 34 | Description |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 35 | =========== |
| 36 | |
| 37 | To query the attributes of a modulator applications initialize the |
| 38 | ``index`` field and zero out the ``reserved`` array of a struct |
Mauro Carvalho Chehab | e8be7e9 | 2016-08-29 17:37:59 -0300 | [diff] [blame] | 39 | :c:type:`v4l2_modulator` and call the |
Mauro Carvalho Chehab | 4e03cb7 | 2016-07-03 10:02:29 -0300 | [diff] [blame] | 40 | :ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` ioctl with a pointer to this structure. Drivers |
Mauro Carvalho Chehab | cdb4af0 | 2016-07-03 11:53:09 -0300 | [diff] [blame] | 41 | fill the rest of the structure or return an ``EINVAL`` error code when the |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 42 | index is out of bounds. To enumerate all modulators applications shall |
| 43 | begin at index zero, incrementing by one until the driver returns |
| 44 | EINVAL. |
| 45 | |
| 46 | Modulators have two writable properties, an audio modulation set and the |
| 47 | radio frequency. To change the modulated audio subprograms, applications |
| 48 | initialize the ``index`` and ``txsubchans`` fields and the ``reserved`` |
Mauro Carvalho Chehab | 2212ff2 | 2016-07-01 14:33:56 -0300 | [diff] [blame] | 49 | array and call the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Drivers may choose a |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 50 | different audio modulation if the request cannot be satisfied. However |
| 51 | this is a write-only ioctl, it does not return the actual audio |
| 52 | modulation selected. |
| 53 | |
| 54 | :ref:`SDR <sdr>` specific modulator types are ``V4L2_TUNER_SDR`` and |
| 55 | ``V4L2_TUNER_RF``. For SDR devices ``txsubchans`` field must be |
| 56 | initialized to zero. The term 'modulator' means SDR transmitter in this |
| 57 | context. |
| 58 | |
| 59 | To change the radio frequency the |
Mauro Carvalho Chehab | af4a4d0 | 2016-07-01 13:42:29 -0300 | [diff] [blame] | 60 | :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 61 | |
| 62 | |
Mauro Carvalho Chehab | 5bd4bb7 | 2016-08-17 08:14:19 -0300 | [diff] [blame] | 63 | .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| |
| 64 | |
Mauro Carvalho Chehab | e8be7e9 | 2016-08-29 17:37:59 -0300 | [diff] [blame] | 65 | .. c:type:: v4l2_modulator |
Mauro Carvalho Chehab | fa92b04d | 2016-08-19 11:14:23 -0300 | [diff] [blame] | 66 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 67 | .. flat-table:: struct v4l2_modulator |
| 68 | :header-rows: 0 |
| 69 | :stub-columns: 0 |
| 70 | :widths: 1 1 2 1 1 |
| 71 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 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. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 78 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 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`. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 104 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 105 | .. note:: |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 106 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 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. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 119 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 120 | Drivers and applications must set the array to zero. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 121 | |
| 122 | |
| 123 | |
Mauro Carvalho Chehab | 5bd4bb7 | 2016-08-17 08:14:19 -0300 | [diff] [blame] | 124 | .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| |
| 125 | |
Mauro Carvalho Chehab | fa92b04d | 2016-08-19 11:14:23 -0300 | [diff] [blame] | 126 | .. _modulator-txsubchans: |
| 127 | |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 128 | .. flat-table:: Modulator Audio Transmission Flags |
| 129 | :header-rows: 0 |
| 130 | :stub-columns: 0 |
| 131 | :widths: 3 1 4 |
| 132 | |
Laurent Pinchart | c2b66ca | 2016-09-05 08:44:34 -0300 | [diff] [blame] | 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. |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 183 | |
| 184 | |
Mauro Carvalho Chehab | 15e7d61 | 2016-07-05 15:14:35 -0300 | [diff] [blame] | 185 | Return Value |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 186 | ============ |
| 187 | |
| 188 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 189 | appropriately. The generic error codes are described at the |
| 190 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 191 | |
| 192 | EINVAL |
Mauro Carvalho Chehab | e8be7e9 | 2016-08-29 17:37:59 -0300 | [diff] [blame] | 193 | The struct :c:type:`v4l2_modulator` ``index`` is |
Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame] | 194 | out of bounds. |