Merge remote-tracking branch 'docs-next/docs-next' into devel/docs-next
[cascardo/linux.git] / Documentation / media / uapi / v4l / vidioc-g-modulator.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _VIDIOC_G_MODULATOR:
4
5 ********************************************
6 ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
7 ********************************************
8
9 Name
10 ====
11
12 VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_modulator *argp )
19
20 .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_modulator *argp )
21
22
23 Arguments
24 =========
25
26 ``fd``
27     File descriptor returned by :ref:`open() <func-open>`.
28
29 ``request``
30     VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
31
32 ``argp``
33
34
35 Description
36 ===========
37
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
45 EINVAL.
46
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
53 modulation selected.
54
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
58 context.
59
60 To change the radio frequency the
61 :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.
62
63
64 .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}|
65
66 .. _v4l2-modulator:
67
68 .. flat-table:: struct v4l2_modulator
69     :header-rows:  0
70     :stub-columns: 0
71     :widths:       1 1 2 1 1
72
73
74     -  .. row 1
75
76        -  __u32
77
78        -  ``index``
79
80        -  Identifies the modulator, set by the application.
81
82     -  .. row 2
83
84        -  __u8
85
86        -  ``name``\ [32]
87
88        -  Name of the modulator, a NUL-terminated ASCII string.
89
90           This information is intended for the user.
91
92     -  .. row 3
93
94        -  __u32
95
96        -  ``capability``
97
98        -  Modulator capability flags. No flags are defined for this field,
99           the tuner flags in struct :ref:`v4l2_tuner <v4l2-tuner>` are
100           used accordingly. The audio flags indicate the ability to encode
101           audio subprograms. They will *not* change for example with the
102           current video standard.
103
104     -  .. row 4
105
106        -  __u32
107
108        -  ``rangelow``
109
110        -  The lowest tunable frequency in units of 62.5 KHz, or if the
111           ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
112           62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
113           set, in units of 1 Hz.
114
115     -  .. row 5
116
117        -  __u32
118
119        -  ``rangehigh``
120
121        -  The highest tunable frequency in units of 62.5 KHz, or if the
122           ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
123           62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
124           set, in units of 1 Hz.
125
126     -  .. row 6
127
128        -  __u32
129
130        -  ``txsubchans``
131
132        -  With this field applications can determine how audio sub-carriers
133           shall be modulated. It contains a set of flags as defined in
134           :ref:`modulator-txsubchans`.
135
136           .. note::
137
138              The tuner ``rxsubchans`` flags  are reused, but the
139              semantics are different. Video output devices
140              are assumed to have an analog or PCM audio input with 1-3
141              channels. The ``txsubchans`` flags select one or more channels
142              for modulation, together with some audio subprogram indicator,
143              for example, a stereo pilot tone.
144
145     -  .. row 7
146
147        -  __u32
148
149        -  ``type``
150
151        -  :cspan:`2` Type of the modulator, see :ref:`v4l2-tuner-type`.
152
153     -  .. row 8
154
155        -  __u32
156
157        -  ``reserved``\ [3]
158
159        -  Reserved for future extensions.
160
161           Drivers and applications must set the array to zero.
162
163
164
165 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
166
167 .. _modulator-txsubchans:
168
169 .. flat-table:: Modulator Audio Transmission Flags
170     :header-rows:  0
171     :stub-columns: 0
172     :widths:       3 1 4
173
174
175     -  .. row 1
176
177        -  ``V4L2_TUNER_SUB_MONO``
178
179        -  0x0001
180
181        -  Modulate channel 1 as mono audio, when the input has more
182           channels, a down-mix of channel 1 and 2. This flag does not
183           combine with ``V4L2_TUNER_SUB_STEREO`` or
184           ``V4L2_TUNER_SUB_LANG1``.
185
186     -  .. row 2
187
188        -  ``V4L2_TUNER_SUB_STEREO``
189
190        -  0x0002
191
192        -  Modulate channel 1 and 2 as left and right channel of a stereo
193           audio signal. When the input has only one channel or two channels
194           and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as
195           left and right channel. This flag does not combine with
196           ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the
197           driver does not support stereo audio it shall fall back to mono.
198
199     -  .. row 3
200
201        -  ``V4L2_TUNER_SUB_LANG1``
202
203        -  0x0008
204
205        -  Modulate channel 1 and 2 as primary and secondary language of a
206           bilingual audio signal. When the input has only one channel it is
207           used for both languages. It is not possible to encode the primary
208           or secondary language only. This flag does not combine with
209           ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or
210           ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the
211           respective audio matrix, or the current video standard does not
212           permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall
213           return an ``EINVAL`` error code and the driver shall fall back to mono
214           or stereo mode.
215
216     -  .. row 4
217
218        -  ``V4L2_TUNER_SUB_LANG2``
219
220        -  0x0004
221
222        -  Same effect as ``V4L2_TUNER_SUB_SAP``.
223
224     -  .. row 5
225
226        -  ``V4L2_TUNER_SUB_SAP``
227
228        -  0x0004
229
230        -  When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is
231           encoded as mono audio, the last channel as Second Audio Program.
232           When the input has only one channel it is used for both audio
233           tracks. When the input has three channels the mono track is a
234           down-mix of channel 1 and 2. When combined with
235           ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and
236           right stereo audio, channel 3 as Second Audio Program. When the
237           input has only two channels, the first is encoded as left and
238           right channel and the second as SAP. When the input has only one
239           channel it is used for all audio tracks. It is not possible to
240           encode a Second Audio Program only. This flag must combine with
241           ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the
242           hardware does not support the respective audio matrix, or the
243           current video standard does not permit SAP the
244           :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and
245           driver shall fall back to mono or stereo mode.
246
247     -  .. row 6
248
249        -  ``V4L2_TUNER_SUB_RDS``
250
251        -  0x0010
252
253        -  Enable the RDS encoder for a radio FM transmitter.
254
255
256 Return Value
257 ============
258
259 On success 0 is returned, on error -1 and the ``errno`` variable is set
260 appropriately. The generic error codes are described at the
261 :ref:`Generic Error Codes <gen-errors>` chapter.
262
263 EINVAL
264     The struct :ref:`v4l2_modulator <v4l2-modulator>` ``index`` is
265     out of bounds.