blob: ad117b068831c224f0fbaa0f6569d978f18fd8a2 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _tuner:
4
5*********************
6Tuners and Modulators
7*********************
8
9
10Tuners
11======
12
13Video input devices can have one or more tuners demodulating a RF
14signal. Each tuner is associated with one or more video inputs,
15depending on the number of RF connectors on the tuner. The ``type``
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030016field of the respective struct :c:type:`v4l2_input`
Mauro Carvalho Chehab73470812016-07-01 13:58:44 -030017returned by the :ref:`VIDIOC_ENUMINPUT` ioctl is
Markus Heiser5377d912016-06-30 15:18:56 +020018set to ``V4L2_INPUT_TYPE_TUNER`` and its ``tuner`` field contains the
19index number of the tuner.
20
21Radio input devices have exactly one tuner with index zero, no video
22inputs.
23
24To query and change tuner properties applications use the
Mauro Carvalho Chehab4e03cb72016-07-03 10:02:29 -030025:ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>` and
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030026:ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` ioctls, respectively. The
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030027struct :c:type:`v4l2_tuner` returned by :ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>`
Markus Heiser5377d912016-06-30 15:18:56 +020028also contains signal status information applicable when the tuner of the
Mauro Carvalho Chehab706f8a92016-07-10 11:57:43 -030029current video or radio input is queried.
30
Mauro Carvalho Chehabb6b6e672016-08-15 17:49:50 -030031.. note::
32
33 :ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` does not switch the
Mauro Carvalho Chehab706f8a92016-07-10 11:57:43 -030034 current tuner, when there is more than one at all. The tuner is solely
35 determined by the current video input. Drivers must support both ioctls
Mauro Carvalho Chehab56683d72016-09-08 06:41:26 -030036 and set the ``V4L2_CAP_TUNER`` flag in the struct :c:type:`v4l2_capability`
37 returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the
Mauro Carvalho Chehab706f8a92016-07-10 11:57:43 -030038 device has one or more tuners.
Markus Heiser5377d912016-06-30 15:18:56 +020039
40
41Modulators
42==========
43
44Video output devices can have one or more modulators, uh, modulating a
45video signal for radiation or connection to the antenna input of a TV
46set or video recorder. Each modulator is associated with one or more
47video outputs, depending on the number of RF connectors on the
48modulator. The ``type`` field of the respective struct
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030049:c:type:`v4l2_output` returned by the
Mauro Carvalho Chehab73470812016-07-01 13:58:44 -030050:ref:`VIDIOC_ENUMOUTPUT` ioctl is set to
Markus Heiser5377d912016-06-30 15:18:56 +020051``V4L2_OUTPUT_TYPE_MODULATOR`` and its ``modulator`` field contains the
52index number of the modulator.
53
54Radio output devices have exactly one modulator with index zero, no
55video outputs.
56
57A video or radio device cannot support both a tuner and a modulator. Two
58separate device nodes will have to be used for such hardware, one that
59supports the tuner functionality and one that supports the modulator
60functionality. The reason is a limitation with the
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030061:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl where you
Markus Heiser5377d912016-06-30 15:18:56 +020062cannot specify whether the frequency is for a tuner or a modulator.
63
64To query and change modulator properties applications use the
Mauro Carvalho Chehab4e03cb72016-07-03 10:02:29 -030065:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` and
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030066:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Note that
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030067:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` does not switch the current modulator, when there
Markus Heiser5377d912016-06-30 15:18:56 +020068is more than one at all. The modulator is solely determined by the
69current video output. Drivers must support both ioctls and set the
70``V4L2_CAP_MODULATOR`` flag in the struct
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030071:c:type:`v4l2_capability` returned by the
Mauro Carvalho Chehab73470812016-07-01 13:58:44 -030072:ref:`VIDIOC_QUERYCAP` ioctl when the device has
Markus Heiser5377d912016-06-30 15:18:56 +020073one or more modulators.
74
75
76Radio Frequency
77===============
78
79To get and set the tuner or modulator radio frequency applications use
Mauro Carvalho Chehab4e03cb72016-07-03 10:02:29 -030080the :ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` and
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030081:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl which both take
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030082a pointer to a struct :c:type:`v4l2_frequency`. These
Markus Heiser5377d912016-06-30 15:18:56 +020083ioctls are used for TV and radio devices alike. Drivers must support
84both ioctls when the tuner or modulator ioctls are supported, or when
85the device is a radio device.