1 .. -*- coding: utf-8; mode: rst -*-
5 ************************************
6 ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER
7 ************************************
9 *man VIDIOC_G_TUNER(2)*
12 Get or set tuner attributes
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_tuner *argp )
20 .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_tuner *argp )
26 File descriptor returned by :ref:`open() <func-open>`.
29 VIDIOC_G_TUNER, VIDIOC_S_TUNER
37 To query the attributes of a tuner applications initialize the ``index``
38 field and zero out the ``reserved`` array of a struct
39 :ref:`v4l2_tuner <v4l2-tuner>` and call the ``VIDIOC_G_TUNER`` ioctl
40 with a pointer to this structure. Drivers fill the rest of the structure
41 or return an EINVAL error code when the index is out of bounds. To
42 enumerate all tuners applications shall begin at index zero,
43 incrementing by one until the driver returns EINVAL.
45 Tuners have two writable properties, the audio mode and the radio
46 frequency. To change the audio mode, applications initialize the
47 ``index``, ``audmode`` and ``reserved`` fields and call the
48 ``VIDIOC_S_TUNER`` ioctl. This will *not* change the current tuner,
49 which is determined by the current video input. Drivers may choose a
50 different audio mode if the requested mode is invalid or unsupported.
51 Since this is a write-only ioctl, it does not return the actually
54 :ref:`SDR <sdr>` specific tuner types are ``V4L2_TUNER_SDR`` and
55 ``V4L2_TUNER_RF``. For SDR devices ``audmode`` field must be initialized
56 to zero. The term 'tuner' means SDR receiver in this context.
58 To change the radio frequency the
59 :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.
64 .. flat-table:: struct v4l2_tuner
75 - :cspan:`1` Identifies the tuner, set by the application.
85 Name of the tuner, a NUL-terminated ASCII string. This information
86 is intended for the user.
94 - :cspan:`1` Type of the tuner, see :ref:`v4l2-tuner-type`.
104 Tuner capability flags, see :ref:`tuner-capability`. Audio flags
105 indicate the ability to decode audio subprograms. They will *not*
106 change, for example with the current video standard.
108 When the structure refers to a radio tuner the
109 ``V4L2_TUNER_CAP_LANG1``, ``V4L2_TUNER_CAP_LANG2`` and
110 ``V4L2_TUNER_CAP_NORM`` flags can't be used.
112 If multiple frequency bands are supported, then ``capability`` is
113 the union of all ``capability`` fields of each struct
114 :ref:`v4l2_frequency_band <v4l2-frequency-band>`.
122 - :cspan:`1` The lowest tunable frequency in units of 62.5 kHz, or
123 if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units
124 of 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ``
125 is set, in units of 1 Hz. If multiple frequency bands are
126 supported, then ``rangelow`` is the lowest frequency of all the
135 - :cspan:`1` The highest tunable frequency in units of 62.5 kHz,
136 or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in
137 units of 62.5 Hz, or if the ``capability`` flag
138 ``V4L2_TUNER_CAP_1HZ`` is set, in units of 1 Hz. If multiple
139 frequency bands are supported, then ``rangehigh`` is the highest
140 frequency of all the frequency bands.
150 Some tuners or audio decoders can determine the received audio
151 subprograms by analyzing audio carriers, pilot tones or other
152 indicators. To pass this information drivers set flags defined in
153 :ref:`tuner-rxsubchans` in this field. For example:
159 - ``V4L2_TUNER_SUB_MONO``
161 - receiving mono audio
169 - receiving stereo audio and a secondary audio program
177 - receiving mono or stereo audio, the hardware cannot distinguish
185 - receiving bilingual audio
191 - ``MONO | STEREO | LANG1 | LANG2``
193 - receiving mono, stereo or bilingual audio
201 When the ``V4L2_TUNER_CAP_STEREO``, ``_LANG1``, ``_LANG2`` or
202 ``_SAP`` flag is cleared in the ``capability`` field, the
203 corresponding ``V4L2_TUNER_SUB_`` flag must not be set here.
205 This field is valid only if this is the tuner of the current video
206 input, or when the structure refers to a radio tuner.
216 The selected audio mode, see :ref:`tuner-audmode` for valid
217 values. The audio mode does not affect audio subprogram detection,
218 and like a :ref:`control` it does not automatically
219 change unless the requested mode is invalid or unsupported. See
220 :ref:`tuner-matrix` for possible results when the selected and
221 received audio programs do not match.
223 Currently this is the only field of struct
224 :c:type:`struct v4l2_tuner` applications can change.
232 - :cspan:`1` The signal strength if known, ranging from 0 to
233 65535. Higher values indicate a better signal.
241 - :cspan:`1` Automatic frequency control: When the ``afc`` value
242 is negative, the frequency is too low, when positive too high.
250 - :cspan:`1` Reserved for future extensions. Drivers and
251 applications must set the array to zero.
257 .. flat-table:: enum v4l2_tuner_type
265 - ``V4L2_TUNER_RADIO``
273 - ``V4L2_TUNER_ANALOG_TV``
297 .. _tuner-capability:
299 .. flat-table:: Tuner and Modulator Capability Flags
307 - ``V4L2_TUNER_CAP_LOW``
311 - When set, tuning frequencies are expressed in units of 62.5 Hz
316 - ``V4L2_TUNER_CAP_NORM``
320 - This is a multi-standard tuner; the video standard can or must be
321 switched. (B/G PAL tuners for example are typically not considered
322 multi-standard because the video standard is automatically
323 determined from the frequency band.) The set of supported video
324 standards is available from the struct
325 :ref:`v4l2_input <v4l2-input>` pointing to this tuner, see the
326 description of ioctl :ref:`VIDIOC_ENUMINPUT`
327 for details. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this
332 - ``V4L2_TUNER_CAP_HWSEEK_BOUNDED``
336 - If set, then this tuner supports the hardware seek functionality
337 where the seek stops when it reaches the end of the frequency
342 - ``V4L2_TUNER_CAP_HWSEEK_WRAP``
346 - If set, then this tuner supports the hardware seek functionality
347 where the seek wraps around when it reaches the end of the
352 - ``V4L2_TUNER_CAP_STEREO``
356 - Stereo audio reception is supported.
360 - ``V4L2_TUNER_CAP_LANG1``
364 - Reception of the primary language of a bilingual audio program is
365 supported. Bilingual audio is a feature of two-channel systems,
366 transmitting the primary language monaural on the main audio
367 carrier and a secondary language monaural on a second carrier.
368 Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability.
372 - ``V4L2_TUNER_CAP_LANG2``
376 - Reception of the secondary language of a bilingual audio program
377 is supported. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this
382 - ``V4L2_TUNER_CAP_SAP``
386 - Reception of a secondary audio program is supported. This is a
387 feature of the BTSC system which accompanies the NTSC video
388 standard. Two audio carriers are available for mono or stereo
389 transmissions of a primary language, and an independent third
390 carrier for a monaural secondary language. Only
391 ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability.
393 Note the ``V4L2_TUNER_CAP_LANG2`` and ``V4L2_TUNER_CAP_SAP`` flags
394 are synonyms. ``V4L2_TUNER_CAP_SAP`` applies when the tuner
395 supports the ``V4L2_STD_NTSC_M`` video standard.
399 - ``V4L2_TUNER_CAP_RDS``
403 - RDS capture is supported. This capability is only valid for radio
408 - ``V4L2_TUNER_CAP_RDS_BLOCK_IO``
412 - The RDS data is passed as unparsed RDS blocks.
416 - ``V4L2_TUNER_CAP_RDS_CONTROLS``
420 - The RDS data is parsed by the hardware and set via controls.
424 - ``V4L2_TUNER_CAP_FREQ_BANDS``
428 - The :ref:`VIDIOC_ENUM_FREQ_BANDS`
429 ioctl can be used to enumerate the available frequency bands.
433 - ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM``
437 - The range to search when using the hardware seek functionality is
439 :ref:`VIDIOC_S_HW_FREQ_SEEK` for
444 - ``V4L2_TUNER_CAP_1HZ``
448 - When set, tuning frequencies are expressed in units of 1 Hz
453 .. _tuner-rxsubchans:
455 .. flat-table:: Tuner Audio Reception Flags
463 - ``V4L2_TUNER_SUB_MONO``
467 - The tuner receives a mono audio signal.
471 - ``V4L2_TUNER_SUB_STEREO``
475 - The tuner receives a stereo audio signal.
479 - ``V4L2_TUNER_SUB_LANG1``
483 - The tuner receives the primary language of a bilingual audio
484 signal. Drivers must clear this flag when the current video
485 standard is ``V4L2_STD_NTSC_M``.
489 - ``V4L2_TUNER_SUB_LANG2``
493 - The tuner receives the secondary language of a bilingual audio
494 signal (or a second audio program).
498 - ``V4L2_TUNER_SUB_SAP``
502 - The tuner receives a Second Audio Program. Note the
503 ``V4L2_TUNER_SUB_LANG2`` and ``V4L2_TUNER_SUB_SAP`` flags are
504 synonyms. The ``V4L2_TUNER_SUB_SAP`` flag applies when the current
505 video standard is ``V4L2_STD_NTSC_M``.
509 - ``V4L2_TUNER_SUB_RDS``
513 - The tuner receives an RDS channel.
519 .. flat-table:: Tuner Audio Modes
527 - ``V4L2_TUNER_MODE_MONO``
531 - Play mono audio. When the tuner receives a stereo signal this a
532 down-mix of the left and right channel. When the tuner receives a
533 bilingual or SAP signal this mode selects the primary language.
537 - ``V4L2_TUNER_MODE_STEREO``
541 - Play stereo audio. When the tuner receives bilingual audio it may
542 play different languages on the left and right channel or the
543 primary language is played on both channels.
545 Playing different languages in this mode is deprecated. New
546 drivers should do this only in ``MODE_LANG1_LANG2``.
548 When the tuner receives no stereo signal or does not support
549 stereo reception the driver shall fall back to ``MODE_MONO``.
553 - ``V4L2_TUNER_MODE_LANG1``
557 - Play the primary language, mono or stereo. Only
558 ``V4L2_TUNER_ANALOG_TV`` tuners support this mode.
562 - ``V4L2_TUNER_MODE_LANG2``
566 - Play the secondary language, mono. When the tuner receives no
567 bilingual audio or SAP, or their reception is not supported the
568 driver shall fall back to mono or stereo mode. Only
569 ``V4L2_TUNER_ANALOG_TV`` tuners support this mode.
573 - ``V4L2_TUNER_MODE_SAP``
577 - Play the Second Audio Program. When the tuner receives no
578 bilingual audio or SAP, or their reception is not supported the
579 driver shall fall back to mono or stereo mode. Only
580 ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. Note the
581 ``V4L2_TUNER_MODE_LANG2`` and ``V4L2_TUNER_MODE_SAP`` are
586 - ``V4L2_TUNER_MODE_LANG1_LANG2``
590 - Play the primary language on the left channel, the secondary
591 language on the right channel. When the tuner receives no
592 bilingual audio or SAP, it shall fall back to ``MODE_LANG1`` or
593 ``MODE_MONO``. Only ``V4L2_TUNER_ANALOG_TV`` tuners support this
600 .. flat-table:: Tuner Audio Matrix
608 - :cspan:`5` Selected ``V4L2_TUNER_MODE_``
612 - Received ``V4L2_TUNER_SUB_``
622 - ``LANG1_LANG2``\ [1]_
650 - Mono/SAP (preferred) or Mono/Mono
660 - Stereo L/R (preferred) or Mono L+R
662 - Stereo L/R (preferred) or Mono L+R
664 - L/R (preferred) or L+R/L+R
674 - Stereo L/R (preferred) or Mono L+R
678 - L+R/SAP (preferred) or L/R or L+R/L+R
686 - Lang1/Lang2 (deprecated [2]_) or Lang1/Lang1
692 - Lang1/Lang2 (preferred) or Lang1/Lang1
699 On success 0 is returned, on error -1 and the ``errno`` variable is set
700 appropriately. The generic error codes are described at the
701 :ref:`Generic Error Codes <gen-errors>` chapter.
704 The struct :ref:`v4l2_tuner <v4l2-tuner>` ``index`` is out of
708 This mode has been added in Linux 2.6.17 and may not be supported by
712 Playback of both languages in ``MODE_STEREO`` is deprecated. In the
713 future drivers should produce only the primary language in this mode.
714 Applications should request ``MODE_LANG1_LANG2`` to record both
715 languages or a stereo signal.
718 .. ------------------------------------------------------------------------------
719 .. This file was automatically converted from DocBook-XML with the dbxml
720 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
721 .. from the linux kernel, refer to:
723 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
724 .. ------------------------------------------------------------------------------