ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER
&manvol;
VIDIOC_G_TUNERVIDIOC_S_TUNERGet or set tuner attributesint ioctlint fdint requeststruct v4l2_tuner
*argpint ioctlint fdint requestconst struct v4l2_tuner
*argpArgumentsfd&fd;requestVIDIOC_G_TUNER, VIDIOC_S_TUNERargpDescriptionTo query the attributes of a tuner applications initialize the
index field and zero out the
reserved array of a &v4l2-tuner; and call the
VIDIOC_G_TUNER ioctl with a pointer to this
structure. Drivers fill the rest of the structure or return an
&EINVAL; when the index is out of bounds. To enumerate all tuners
applications shall begin at index zero, incrementing by one until the
driver returns EINVAL.Tuners have two writable properties, the audio mode and
the radio frequency. To change the audio mode, applications initialize
the index,
audmode and
reserved fields and call the
VIDIOC_S_TUNER ioctl. This will
not change the current tuner, which is determined
by the current video input. Drivers may choose a different audio mode
if the requested mode is invalid or unsupported. Since this is a
write-only ioctl, it does not return the actually
selected audio mode.To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl
is available.
struct v4l2_tuner__u32indexIdentifies the tuner, set by the
application.__u8name[32]Name of the tuner, a
NUL-terminated ASCII string. This information is intended for the
user.__u32typeType of the tuner, see .__u32capabilityTuner capability flags, see
. Audio flags indicate the ability
to decode audio subprograms. They will not
change, for example with the current video standard.When
the structure refers to a radio tuner the
V4L2_TUNER_CAP_LANG1,
V4L2_TUNER_CAP_LANG2 and
V4L2_TUNER_CAP_NORM flags can't be used.If multiple frequency bands are supported, then
capability is the union of all
capability fields of each &v4l2-frequency-band;.
__u32rangelowThe lowest tunable frequency in
units of 62.5 kHz, or if the capability
flag V4L2_TUNER_CAP_LOW is set, in units of 62.5
Hz. If multiple frequency bands are supported, then
rangelow is the lowest frequency
of all the frequency bands.__u32rangehighThe highest tunable frequency in
units of 62.5 kHz, or if the capability
flag V4L2_TUNER_CAP_LOW is set, in units of 62.5
Hz. If multiple frequency bands are supported, then
rangehigh is the highest frequency
of all the frequency bands.__u32rxsubchansSome tuners or audio
decoders can determine the received audio subprograms by analyzing
audio carriers, pilot tones or other indicators. To pass this
information drivers set flags defined in in this field. For
example:V4L2_TUNER_SUB_MONOreceiving mono audioSTEREO | SAPreceiving stereo audio and a secondary audio
programMONO | STEREOreceiving mono or stereo audio, the hardware cannot
distinguishLANG1 | LANG2receiving bilingual audioMONO | STEREO | LANG1 | LANG2receiving mono, stereo or bilingual
audioWhen the
V4L2_TUNER_CAP_STEREO,
_LANG1, _LANG2 or
_SAP flag is cleared in the
capability field, the corresponding
V4L2_TUNER_SUB_ flag must not be set
here.This field is valid only if this is the tuner of the
current video input, or when the structure refers to a radio
tuner.__u32audmodeThe selected audio mode, see
for valid values. The audio mode does
not affect audio subprogram detection, and like a control it does not automatically change
unless the requested mode is invalid or unsupported. See for possible results when
the selected and received audio programs do not
match.Currently this is the only field of struct
v4l2_tuner applications can
change.__u32signalThe signal strength if known, ranging
from 0 to 65535. Higher values indicate a better signal.__s32afcAutomatic frequency control: When the
afc value is negative, the frequency is too
low, when positive too high.__u32reserved[4]Reserved for future extensions. Drivers and
applications must set the array to zero.
Tuner and Modulator Capability Flags
&cs-def;
V4L2_TUNER_CAP_LOW0x0001When set, tuning frequencies are expressed in units of
62.5 Hz, otherwise in units of 62.5 kHz.V4L2_TUNER_CAP_NORM0x0002This is a multi-standard tuner; the video standard
can or must be switched. (B/G PAL tuners for example are typically not
considered multi-standard because the video standard is automatically
determined from the frequency band.) The set of supported video
standards is available from the &v4l2-input; pointing to this tuner,
see the description of ioctl &VIDIOC-ENUMINPUT; for details. Only
V4L2_TUNER_ANALOG_TV tuners can have this capability.V4L2_TUNER_CAP_HWSEEK_BOUNDED0x0004If set, then this tuner supports the hardware seek functionality
where the seek stops when it reaches the end of the frequency range.V4L2_TUNER_CAP_HWSEEK_WRAP0x0008If set, then this tuner supports the hardware seek functionality
where the seek wraps around when it reaches the end of the frequency range.V4L2_TUNER_CAP_STEREO0x0010Stereo audio reception is supported.V4L2_TUNER_CAP_LANG10x0040Reception of the primary language of a bilingual
audio program is supported. Bilingual audio is a feature of
two-channel systems, transmitting the primary language monaural on the
main audio carrier and a secondary language monaural on a second
carrier. Only
V4L2_TUNER_ANALOG_TV tuners can have this capability.V4L2_TUNER_CAP_LANG20x0020Reception of the secondary language of a bilingual
audio program is supported. Only
V4L2_TUNER_ANALOG_TV tuners can have this capability.V4L2_TUNER_CAP_SAP0x0020Reception of a secondary audio program is
supported. This is a feature of the BTSC system which accompanies the
NTSC video standard. Two audio carriers are available for mono or
stereo transmissions of a primary language, and an independent third
carrier for a monaural secondary language. Only
V4L2_TUNER_ANALOG_TV tuners can have this capability.Note the
V4L2_TUNER_CAP_LANG2 and
V4L2_TUNER_CAP_SAP flags are synonyms.
V4L2_TUNER_CAP_SAP applies when the tuner
supports the V4L2_STD_NTSC_M video
standard.V4L2_TUNER_CAP_RDS0x0080RDS capture is supported. This capability is only valid for
radio tuners.V4L2_TUNER_CAP_RDS_BLOCK_IO0x0100The RDS data is passed as unparsed RDS blocks.V4L2_TUNER_CAP_RDS_CONTROLS0x0200The RDS data is parsed by the hardware and set via controls.V4L2_TUNER_CAP_FREQ_BANDS0x0400The &VIDIOC-ENUM-FREQ-BANDS; ioctl can be used to enumerate
the available frequency bands.V4L2_TUNER_CAP_HWSEEK_PROG_LIM0x0800The range to search when using the hardware seek functionality
is programmable, see &VIDIOC-S-HW-FREQ-SEEK; for details.
Tuner Audio Reception Flags
&cs-def;
V4L2_TUNER_SUB_MONO0x0001The tuner receives a mono audio signal.V4L2_TUNER_SUB_STEREO0x0002The tuner receives a stereo audio signal.V4L2_TUNER_SUB_LANG10x0008The tuner receives the primary language of a
bilingual audio signal. Drivers must clear this flag when the current
video standard is V4L2_STD_NTSC_M.V4L2_TUNER_SUB_LANG20x0004The tuner receives the secondary language of a
bilingual audio signal (or a second audio program).V4L2_TUNER_SUB_SAP0x0004The tuner receives a Second Audio Program. Note the
V4L2_TUNER_SUB_LANG2 and
V4L2_TUNER_SUB_SAP flags are synonyms. The
V4L2_TUNER_SUB_SAP flag applies when the
current video standard is V4L2_STD_NTSC_M.V4L2_TUNER_SUB_RDS0x0010The tuner receives an RDS channel.
Tuner Audio Modes
&cs-def;
V4L2_TUNER_MODE_MONO0Play mono audio. When the tuner receives a stereo
signal this a down-mix of the left and right channel. When the tuner
receives a bilingual or SAP signal this mode selects the primary
language.V4L2_TUNER_MODE_STEREO1Play stereo audio. When the tuner receives
bilingual audio it may play different languages on the left and right
channel or the primary language is played on both channels.Playing
different languages in this mode is
deprecated. New drivers should do this only in
MODE_LANG1_LANG2.When the tuner
receives no stereo signal or does not support stereo reception the
driver shall fall back to MODE_MONO.V4L2_TUNER_MODE_LANG13Play the primary language, mono or stereo. Only
V4L2_TUNER_ANALOG_TV tuners support this
mode.V4L2_TUNER_MODE_LANG22Play the secondary language, mono. When the tuner
receives no bilingual audio or SAP, or their reception is not
supported the driver shall fall back to mono or stereo mode. Only
V4L2_TUNER_ANALOG_TV tuners support this
mode.V4L2_TUNER_MODE_SAP2Play the Second Audio Program. When the tuner
receives no bilingual audio or SAP, or their reception is not
supported the driver shall fall back to mono or stereo mode. Only
V4L2_TUNER_ANALOG_TV tuners support this mode.
Note the V4L2_TUNER_MODE_LANG2 and
V4L2_TUNER_MODE_SAP are synonyms.V4L2_TUNER_MODE_LANG1_LANG24Play the primary language on the left channel, the
secondary language on the right channel. When the tuner receives no
bilingual audio or SAP, it shall fall back to
MODE_LANG1 or MODE_MONO.
Only V4L2_TUNER_ANALOG_TV tuners support this
mode.
Tuner Audio MatrixSelected
V4L2_TUNER_MODE_Received V4L2_TUNER_SUB_MONOSTEREOLANG1LANG2 = SAPLANG1_LANG2This
mode has been added in Linux 2.6.17 and may not be supported by older
drivers.MONOMonoMono/MonoMonoMonoMono/MonoMONO | SAPMonoMono/MonoMonoSAPMono/SAP (preferred) or Mono/MonoSTEREOL+RL/RStereo L/R (preferred) or Mono L+RStereo L/R (preferred) or Mono L+RL/R (preferred) or L+R/L+RSTEREO | SAPL+RL/RStereo L/R (preferred) or Mono L+RSAPL+R/SAP (preferred) or L/R or L+R/L+RLANG1 | LANG2Language 1Lang1/Lang2 (deprecatedPlayback of
both languages in MODE_STEREO is deprecated. In
the future drivers should produce only the primary language in this
mode. Applications should request
MODE_LANG1_LANG2 to record both languages or a
stereo signal.) or
Lang1/Lang1Language 1Language 2Lang1/Lang2 (preferred) or Lang1/Lang1
&return-value;
EINVALThe &v4l2-tuner; index is
out of bounds.