Based on kernel version 3.9. Page generated on 2013-05-02 23:04 EST.
1 <refentry id="vidioc-g-tuner"> 2 <refmeta> 3 <refentrytitle>ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER</refentrytitle> 4 &manvol; 5 </refmeta> 6 7 <refnamediv> 8 <refname>VIDIOC_G_TUNER</refname> 9 <refname>VIDIOC_S_TUNER</refname> 10 <refpurpose>Get or set tuner attributes</refpurpose> 11 </refnamediv> 12 13 <refsynopsisdiv> 14 <funcsynopsis> 15 <funcprototype> 16 <funcdef>int <function>ioctl</function></funcdef> 17 <paramdef>int <parameter>fd</parameter></paramdef> 18 <paramdef>int <parameter>request</parameter></paramdef> 19 <paramdef>struct v4l2_tuner 20 *<parameter>argp</parameter></paramdef> 21 </funcprototype> 22 </funcsynopsis> 23 <funcsynopsis> 24 <funcprototype> 25 <funcdef>int <function>ioctl</function></funcdef> 26 <paramdef>int <parameter>fd</parameter></paramdef> 27 <paramdef>int <parameter>request</parameter></paramdef> 28 <paramdef>const struct v4l2_tuner 29 *<parameter>argp</parameter></paramdef> 30 </funcprototype> 31 </funcsynopsis> 32 </refsynopsisdiv> 33 34 <refsect1> 35 <title>Arguments</title> 36 37 <variablelist> 38 <varlistentry> 39 <term><parameter>fd</parameter></term> 40 <listitem> 41 <para>&fd;</para> 42 </listitem> 43 </varlistentry> 44 <varlistentry> 45 <term><parameter>request</parameter></term> 46 <listitem> 47 <para>VIDIOC_G_TUNER, VIDIOC_S_TUNER</para> 48 </listitem> 49 </varlistentry> 50 <varlistentry> 51 <term><parameter>argp</parameter></term> 52 <listitem> 53 <para></para> 54 </listitem> 55 </varlistentry> 56 </variablelist> 57 </refsect1> 58 59 <refsect1> 60 <title>Description</title> 61 62 <para>To query the attributes of a tuner applications initialize the 63 <structfield>index</structfield> field and zero out the 64 <structfield>reserved</structfield> array of a &v4l2-tuner; and call the 65 <constant>VIDIOC_G_TUNER</constant> ioctl with a pointer to this 66 structure. Drivers fill the rest of the structure or return an 67 &EINVAL; when the index is out of bounds. To enumerate all tuners 68 applications shall begin at index zero, incrementing by one until the 69 driver returns <errorcode>EINVAL</errorcode>.</para> 70 71 <para>Tuners have two writable properties, the audio mode and 72 the radio frequency. To change the audio mode, applications initialize 73 the <structfield>index</structfield>, 74 <structfield>audmode</structfield> and 75 <structfield>reserved</structfield> fields and call the 76 <constant>VIDIOC_S_TUNER</constant> ioctl. This will 77 <emphasis>not</emphasis> change the current tuner, which is determined 78 by the current video input. Drivers may choose a different audio mode 79 if the requested mode is invalid or unsupported. Since this is a 80 <!-- FIXME -->write-only ioctl, it does not return the actually 81 selected audio mode.</para> 82 83 <para>To change the radio frequency the &VIDIOC-S-FREQUENCY; ioctl 84 is available.</para> 85 86 <table pgwide="1" frame="none" id="v4l2-tuner"> 87 <title>struct <structname>v4l2_tuner</structname></title> 88 <tgroup cols="3"> 89 <colspec colname="c1" colwidth="1*" /> 90 <colspec colname="c2" colwidth="1*" /> 91 <colspec colname="c3" colwidth="1*" /> 92 <colspec colname="c4" colwidth="1*" /> 93 <spanspec spanname="hspan" namest="c3" nameend="c4" /> 94 <tbody valign="top"> 95 <row> 96 <entry>__u32</entry> 97 <entry><structfield>index</structfield></entry> 98 <entry spanname="hspan">Identifies the tuner, set by the 99 application.</entry> 100 </row> 101 <row> 102 <entry>__u8</entry> 103 <entry><structfield>name</structfield>[32]</entry> 104 <entry spanname="hspan"><para>Name of the tuner, a 105 NUL-terminated ASCII string. This information is intended for the 106 user.<!-- FIXME Video inputs already have a name, the purpose of this 107 field is not quite clear.--></para></entry> 108 </row> 109 <row> 110 <entry>__u32</entry> 111 <entry><structfield>type</structfield></entry> 112 <entry spanname="hspan">Type of the tuner, see <xref 113 linkend="v4l2-tuner-type" />.</entry> 114 </row> 115 <row> 116 <entry>__u32</entry> 117 <entry><structfield>capability</structfield></entry> 118 <entry spanname="hspan"><para>Tuner capability flags, see 119 <xref linkend="tuner-capability" />. Audio flags indicate the ability 120 to decode audio subprograms. They will <emphasis>not</emphasis> 121 change, for example with the current video standard.</para><para>When 122 the structure refers to a radio tuner the 123 <constant>V4L2_TUNER_CAP_LANG1</constant>, 124 <constant>V4L2_TUNER_CAP_LANG2</constant> and 125 <constant>V4L2_TUNER_CAP_NORM</constant> flags can't be used.</para> 126 <para>If multiple frequency bands are supported, then 127 <structfield>capability</structfield> is the union of all 128 <structfield>capability</structfield> fields of each &v4l2-frequency-band;. 129 </para></entry> 130 </row> 131 <row> 132 <entry>__u32</entry> 133 <entry><structfield>rangelow</structfield></entry> 134 <entry spanname="hspan">The lowest tunable frequency in 135 units of 62.5 kHz, or if the <structfield>capability</structfield> 136 flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 137 Hz. If multiple frequency bands are supported, then 138 <structfield>rangelow</structfield> is the lowest frequency 139 of all the frequency bands.</entry> 140 </row> 141 <row> 142 <entry>__u32</entry> 143 <entry><structfield>rangehigh</structfield></entry> 144 <entry spanname="hspan">The highest tunable frequency in 145 units of 62.5 kHz, or if the <structfield>capability</structfield> 146 flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 147 Hz. If multiple frequency bands are supported, then 148 <structfield>rangehigh</structfield> is the highest frequency 149 of all the frequency bands.</entry> 150 </row> 151 <row> 152 <entry>__u32</entry> 153 <entry><structfield>rxsubchans</structfield></entry> 154 <entry spanname="hspan"><para>Some tuners or audio 155 decoders can determine the received audio subprograms by analyzing 156 audio carriers, pilot tones or other indicators. To pass this 157 information drivers set flags defined in <xref 158 linkend="tuner-rxsubchans" /> in this field. For 159 example:</para></entry> 160 </row> 161 <row> 162 <entry></entry> 163 <entry></entry> 164 <entry><constant>V4L2_TUNER_SUB_MONO</constant></entry> 165 <entry>receiving mono audio</entry> 166 </row> 167 <row> 168 <entry></entry> 169 <entry></entry> 170 <entry><constant>STEREO | SAP</constant></entry> 171 <entry>receiving stereo audio and a secondary audio 172 program</entry> 173 </row> 174 <row> 175 <entry></entry> 176 <entry></entry> 177 <entry><constant>MONO | STEREO</constant></entry> 178 <entry>receiving mono or stereo audio, the hardware cannot 179 distinguish</entry> 180 </row> 181 <row> 182 <entry></entry> 183 <entry></entry> 184 <entry><constant>LANG1 | LANG2</constant></entry> 185 <entry>receiving bilingual audio</entry> 186 </row> 187 <row> 188 <entry></entry> 189 <entry></entry> 190 <entry><constant>MONO | STEREO | LANG1 | LANG2</constant></entry> 191 <entry>receiving mono, stereo or bilingual 192 audio</entry> 193 </row> 194 <row> 195 <entry></entry> 196 <entry></entry> 197 <entry spanname="hspan"><para>When the 198 <constant>V4L2_TUNER_CAP_STEREO</constant>, 199 <constant>_LANG1</constant>, <constant>_LANG2</constant> or 200 <constant>_SAP</constant> flag is cleared in the 201 <structfield>capability</structfield> field, the corresponding 202 <constant>V4L2_TUNER_SUB_</constant> flag must not be set 203 here.</para><para>This field is valid only if this is the tuner of the 204 current video input, or when the structure refers to a radio 205 tuner.</para></entry> 206 </row> 207 <row> 208 <entry>__u32</entry> 209 <entry><structfield>audmode</structfield></entry> 210 <entry spanname="hspan"><para>The selected audio mode, see 211 <xref linkend="tuner-audmode" /> for valid values. The audio mode does 212 not affect audio subprogram detection, and like a <link 213 linkend="control">control</link> it does not automatically change 214 unless the requested mode is invalid or unsupported. See <xref 215 linkend="tuner-matrix" /> for possible results when 216 the selected and received audio programs do not 217 match.</para><para>Currently this is the only field of struct 218 <structname>v4l2_tuner</structname> applications can 219 change.</para></entry> 220 </row> 221 <row> 222 <entry>__u32</entry> 223 <entry><structfield>signal</structfield></entry> 224 <entry spanname="hspan">The signal strength if known, ranging 225 from 0 to 65535. Higher values indicate a better signal.</entry> 226 </row> 227 <row> 228 <entry>__s32</entry> 229 <entry><structfield>afc</structfield></entry> 230 <entry spanname="hspan">Automatic frequency control: When the 231 <structfield>afc</structfield> value is negative, the frequency is too 232 low, when positive too high.<!-- FIXME need example what to do when it never 233 settles at zero, &ie; range is what? --></entry> 234 </row> 235 <row> 236 <entry>__u32</entry> 237 <entry><structfield>reserved</structfield>[4]</entry> 238 <entry spanname="hspan">Reserved for future extensions. Drivers and 239 applications must set the array to zero.</entry> 240 </row> 241 </tbody> 242 </tgroup> 243 </table> 244 245 <table pgwide="1" frame="none" id="v4l2-tuner-type"> 246 <title>enum v4l2_tuner_type</title> 247 <tgroup cols="3"> 248 &cs-def; 249 <tbody valign="top"> 250 <row> 251 <entry><constant>V4L2_TUNER_RADIO</constant></entry> 252 <entry>1</entry> 253 <entry></entry> 254 </row> 255 <row> 256 <entry><constant>V4L2_TUNER_ANALOG_TV</constant></entry> 257 <entry>2</entry> 258 <entry></entry> 259 </row> 260 </tbody> 261 </tgroup> 262 </table> 263 264 <table pgwide="1" frame="none" id="tuner-capability"> 265 <title>Tuner and Modulator Capability Flags</title> 266 <tgroup cols="3"> 267 &cs-def; 268 <tbody valign="top"> 269 <row> 270 <entry><constant>V4L2_TUNER_CAP_LOW</constant></entry> 271 <entry>0x0001</entry> 272 <entry>When set, tuning frequencies are expressed in units of 273 62.5 Hz, otherwise in units of 62.5 kHz.</entry> 274 </row> 275 <row> 276 <entry><constant>V4L2_TUNER_CAP_NORM</constant></entry> 277 <entry>0x0002</entry> 278 <entry>This is a multi-standard tuner; the video standard 279 can or must be switched. (B/G PAL tuners for example are typically not 280 considered multi-standard because the video standard is automatically 281 determined from the frequency band.) The set of supported video 282 standards is available from the &v4l2-input; pointing to this tuner, 283 see the description of ioctl &VIDIOC-ENUMINPUT; for details. Only 284 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners can have this capability.</entry> 285 </row> 286 <row> 287 <entry><constant>V4L2_TUNER_CAP_HWSEEK_BOUNDED</constant></entry> 288 <entry>0x0004</entry> 289 <entry>If set, then this tuner supports the hardware seek functionality 290 where the seek stops when it reaches the end of the frequency range.</entry> 291 </row> 292 <row> 293 <entry><constant>V4L2_TUNER_CAP_HWSEEK_WRAP</constant></entry> 294 <entry>0x0008</entry> 295 <entry>If set, then this tuner supports the hardware seek functionality 296 where the seek wraps around when it reaches the end of the frequency range.</entry> 297 </row> 298 <row> 299 <entry><constant>V4L2_TUNER_CAP_STEREO</constant></entry> 300 <entry>0x0010</entry> 301 <entry>Stereo audio reception is supported.</entry> 302 </row> 303 <row> 304 <entry><constant>V4L2_TUNER_CAP_LANG1</constant></entry> 305 <entry>0x0040</entry> 306 <entry>Reception of the primary language of a bilingual 307 audio program is supported. Bilingual audio is a feature of 308 two-channel systems, transmitting the primary language monaural on the 309 main audio carrier and a secondary language monaural on a second 310 carrier. Only 311 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners can have this capability.</entry> 312 </row> 313 <row> 314 <entry><constant>V4L2_TUNER_CAP_LANG2</constant></entry> 315 <entry>0x0020</entry> 316 <entry>Reception of the secondary language of a bilingual 317 audio program is supported. Only 318 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners can have this capability.</entry> 319 </row> 320 <row> 321 <entry><constant>V4L2_TUNER_CAP_SAP</constant></entry> 322 <entry>0x0020</entry> 323 <entry><para>Reception of a secondary audio program is 324 supported. This is a feature of the BTSC system which accompanies the 325 NTSC video standard. Two audio carriers are available for mono or 326 stereo transmissions of a primary language, and an independent third 327 carrier for a monaural secondary language. Only 328 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners can have this capability.</para><para>Note the 329 <constant>V4L2_TUNER_CAP_LANG2</constant> and 330 <constant>V4L2_TUNER_CAP_SAP</constant> flags are synonyms. 331 <constant>V4L2_TUNER_CAP_SAP</constant> applies when the tuner 332 supports the <constant>V4L2_STD_NTSC_M</constant> video 333 standard.</para><!-- FIXME what if PAL+NTSC and Bi but not SAP? --></entry> 334 </row> 335 <row> 336 <entry><constant>V4L2_TUNER_CAP_RDS</constant></entry> 337 <entry>0x0080</entry> 338 <entry>RDS capture is supported. This capability is only valid for 339 radio tuners.</entry> 340 </row> 341 <row> 342 <entry><constant>V4L2_TUNER_CAP_RDS_BLOCK_IO</constant></entry> 343 <entry>0x0100</entry> 344 <entry>The RDS data is passed as unparsed RDS blocks.</entry> 345 </row> 346 <row> 347 <entry><constant>V4L2_TUNER_CAP_RDS_CONTROLS</constant></entry> 348 <entry>0x0200</entry> 349 <entry>The RDS data is parsed by the hardware and set via controls.</entry> 350 </row> 351 <row> 352 <entry><constant>V4L2_TUNER_CAP_FREQ_BANDS</constant></entry> 353 <entry>0x0400</entry> 354 <entry>The &VIDIOC-ENUM-FREQ-BANDS; ioctl can be used to enumerate 355 the available frequency bands.</entry> 356 </row> 357 <row> 358 <entry><constant>V4L2_TUNER_CAP_HWSEEK_PROG_LIM</constant></entry> 359 <entry>0x0800</entry> 360 <entry>The range to search when using the hardware seek functionality 361 is programmable, see &VIDIOC-S-HW-FREQ-SEEK; for details.</entry> 362 </row> 363 </tbody> 364 </tgroup> 365 </table> 366 367 <table pgwide="1" frame="none" id="tuner-rxsubchans"> 368 <title>Tuner Audio Reception Flags</title> 369 <tgroup cols="3"> 370 &cs-def; 371 <tbody valign="top"> 372 <row> 373 <entry><constant>V4L2_TUNER_SUB_MONO</constant></entry> 374 <entry>0x0001</entry> 375 <entry>The tuner receives a mono audio signal.</entry> 376 </row> 377 <row> 378 <entry><constant>V4L2_TUNER_SUB_STEREO</constant></entry> 379 <entry>0x0002</entry> 380 <entry>The tuner receives a stereo audio signal.</entry> 381 </row> 382 <row> 383 <entry><constant>V4L2_TUNER_SUB_LANG1</constant></entry> 384 <entry>0x0008</entry> 385 <entry>The tuner receives the primary language of a 386 bilingual audio signal. Drivers must clear this flag when the current 387 video standard is <constant>V4L2_STD_NTSC_M</constant>.</entry> 388 </row> 389 <row> 390 <entry><constant>V4L2_TUNER_SUB_LANG2</constant></entry> 391 <entry>0x0004</entry> 392 <entry>The tuner receives the secondary language of a 393 bilingual audio signal (or a second audio program).</entry> 394 </row> 395 <row> 396 <entry><constant>V4L2_TUNER_SUB_SAP</constant></entry> 397 <entry>0x0004</entry> 398 <entry>The tuner receives a Second Audio Program. Note the 399 <constant>V4L2_TUNER_SUB_LANG2</constant> and 400 <constant>V4L2_TUNER_SUB_SAP</constant> flags are synonyms. The 401 <constant>V4L2_TUNER_SUB_SAP</constant> flag applies when the 402 current video standard is <constant>V4L2_STD_NTSC_M</constant>.</entry> 403 </row> 404 <row> 405 <entry><constant>V4L2_TUNER_SUB_RDS</constant></entry> 406 <entry>0x0010</entry> 407 <entry>The tuner receives an RDS channel.</entry> 408 </row> 409 </tbody> 410 </tgroup> 411 </table> 412 413 <table pgwide="1" frame="none" id="tuner-audmode"> 414 <title>Tuner Audio Modes</title> 415 <tgroup cols="3"> 416 &cs-def; 417 <tbody valign="top"> 418 <row> 419 <entry><constant>V4L2_TUNER_MODE_MONO</constant></entry> 420 <entry>0</entry> 421 <entry>Play mono audio. When the tuner receives a stereo 422 signal this a down-mix of the left and right channel. When the tuner 423 receives a bilingual or SAP signal this mode selects the primary 424 language.</entry> 425 </row> 426 <row> 427 <entry><constant>V4L2_TUNER_MODE_STEREO</constant></entry> 428 <entry>1</entry> 429 <entry><para>Play stereo audio. When the tuner receives 430 bilingual audio it may play different languages on the left and right 431 channel or the primary language is played on both channels.</para><para>Playing 432 different languages in this mode is 433 deprecated. New drivers should do this only in 434 <constant>MODE_LANG1_LANG2</constant>.</para><para>When the tuner 435 receives no stereo signal or does not support stereo reception the 436 driver shall fall back to <constant>MODE_MONO</constant>.</para></entry> 437 </row> 438 <row> 439 <entry><constant>V4L2_TUNER_MODE_LANG1</constant></entry> 440 <entry>3</entry> 441 <entry>Play the primary language, mono or stereo. Only 442 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners support this 443 mode.</entry> 444 </row> 445 <row> 446 <entry><constant>V4L2_TUNER_MODE_LANG2</constant></entry> 447 <entry>2</entry> 448 <entry>Play the secondary language, mono. When the tuner 449 receives no bilingual audio or SAP, or their reception is not 450 supported the driver shall fall back to mono or stereo mode. Only 451 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners support this 452 mode.</entry> 453 </row> 454 <row> 455 <entry><constant>V4L2_TUNER_MODE_SAP</constant></entry> 456 <entry>2</entry> 457 <entry>Play the Second Audio Program. When the tuner 458 receives no bilingual audio or SAP, or their reception is not 459 supported the driver shall fall back to mono or stereo mode. Only 460 <constant>V4L2_TUNER_ANALOG_TV</constant> tuners support this mode. 461 Note the <constant>V4L2_TUNER_MODE_LANG2</constant> and 462 <constant>V4L2_TUNER_MODE_SAP</constant> are synonyms.</entry> 463 </row> 464 <row> 465 <entry><constant>V4L2_TUNER_MODE_LANG1_LANG2</constant></entry> 466 <entry>4</entry> 467 <entry>Play the primary language on the left channel, the 468 secondary language on the right channel. When the tuner receives no 469 bilingual audio or SAP, it shall fall back to 470 <constant>MODE_LANG1</constant> or <constant>MODE_MONO</constant>. 471 Only <constant>V4L2_TUNER_ANALOG_TV</constant> tuners support this 472 mode.</entry> 473 </row> 474 </tbody> 475 </tgroup> 476 </table> 477 478 <table pgwide="1" frame="all" id="tuner-matrix"> 479 <title>Tuner Audio Matrix</title> 480 <tgroup cols="6" align="center"> 481 <colspec align="left" /> 482 <colspec colname="c2" colwidth="1*" /> 483 <colspec colwidth="1*" /> 484 <colspec colwidth="1*" /> 485 <colspec colnum="6" colname="c6" colwidth="1*" /> 486 <spanspec namest="c2" nameend="c6" spanname="hspan" align="center" /> 487 <thead> 488 <row> 489 <entry></entry> 490 <entry spanname="hspan">Selected 491 <constant>V4L2_TUNER_MODE_</constant></entry> 492 </row> 493 <row> 494 <entry>Received <constant>V4L2_TUNER_SUB_</constant></entry> 495 <entry><constant>MONO</constant></entry> 496 <entry><constant>STEREO</constant></entry> 497 <entry><constant>LANG1</constant></entry> 498 <entry><constant>LANG2 = SAP</constant></entry> 499 <entry><constant>LANG1_LANG2</constant><footnote><para>This 500 mode has been added in Linux 2.6.17 and may not be supported by older 501 drivers.</para></footnote></entry> 502 </row> 503 </thead> 504 <tbody valign="top"> 505 <row> 506 <entry><constant>MONO</constant></entry> 507 <entry>Mono</entry> 508 <entry>Mono/Mono</entry> 509 <entry>Mono</entry> 510 <entry>Mono</entry> 511 <entry>Mono/Mono</entry> 512 </row> 513 <row> 514 <entry><constant>MONO | SAP</constant></entry> 515 <entry>Mono</entry> 516 <entry>Mono/Mono</entry> 517 <entry>Mono</entry> 518 <entry>SAP</entry> 519 <entry>Mono/SAP (preferred) or Mono/Mono</entry> 520 </row> 521 <row> 522 <entry><constant>STEREO</constant></entry> 523 <entry>L+R</entry> 524 <entry>L/R</entry> 525 <entry>Stereo L/R (preferred) or Mono L+R</entry> 526 <entry>Stereo L/R (preferred) or Mono L+R</entry> 527 <entry>L/R (preferred) or L+R/L+R</entry> 528 </row> 529 <row> 530 <entry><constant>STEREO | SAP</constant></entry> 531 <entry>L+R</entry> 532 <entry>L/R</entry> 533 <entry>Stereo L/R (preferred) or Mono L+R</entry> 534 <entry>SAP</entry> 535 <entry>L+R/SAP (preferred) or L/R or L+R/L+R</entry> 536 </row> 537 <row> 538 <entry><constant>LANG1 | LANG2</constant></entry> 539 <entry>Language 1</entry> 540 <entry>Lang1/Lang2 (deprecated<footnote><para>Playback of 541 both languages in <constant>MODE_STEREO</constant> is deprecated. In 542 the future drivers should produce only the primary language in this 543 mode. Applications should request 544 <constant>MODE_LANG1_LANG2</constant> to record both languages or a 545 stereo signal.</para></footnote>) or 546 Lang1/Lang1</entry> 547 <entry>Language 1</entry> 548 <entry>Language 2</entry> 549 <entry>Lang1/Lang2 (preferred) or Lang1/Lang1</entry> 550 </row> 551 </tbody> 552 </tgroup> 553 </table> 554 </refsect1> 555 556 <refsect1> 557 &return-value; 558 559 <variablelist> 560 <varlistentry> 561 <term><errorcode>EINVAL</errorcode></term> 562 <listitem> 563 <para>The &v4l2-tuner; <structfield>index</structfield> is 564 out of bounds.</para> 565 </listitem> 566 </varlistentry> 567 </variablelist> 568 </refsect1> 569 </refentry>