1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2 <HTML 3 ><HEAD 4 ><TITLE 5 >Changes</TITLE 6 ><META 7 NAME="GENERATOR" 8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9 REL="HOME" 10 TITLE="Video for Linux Two API Specification" 11 HREF="book1.htm"><LINK 12 REL="PREVIOUS" 13 TITLE="V4L2 Driver Programming" 14 HREF="c14592.htm"><LINK 15 REL="NEXT" 16 TITLE="Changes of the V4L2 API" 17 HREF="x15446.htm"></HEAD 18 ><BODY 19 CLASS="CHAPTER" 20 BGCOLOR="#FFFFFF" 21 TEXT="#000000" 22 LINK="#0000FF" 23 VLINK="#840084" 24 ALINK="#0000FF" 25 ><DIV 26 CLASS="NAVHEADER" 27 ><TABLE 28 SUMMARY="Header navigation table" 29 WIDTH="100%" 30 BORDER="0" 31 CELLPADDING="0" 32 CELLSPACING="0" 33 ><TR 34 ><TH 35 COLSPAN="3" 36 ALIGN="center" 37 >Video for Linux Two API Specification: Revision 0.24</TH 38 ></TR 39 ><TR 40 ><TD 41 WIDTH="10%" 42 ALIGN="left" 43 VALIGN="bottom" 44 ><A 45 HREF="c14592.htm" 46 ACCESSKEY="P" 47 >Prev</A 48 ></TD 49 ><TD 50 WIDTH="80%" 51 ALIGN="center" 52 VALIGN="bottom" 53 ></TD 54 ><TD 55 WIDTH="10%" 56 ALIGN="right" 57 VALIGN="bottom" 58 ><A 59 HREF="x15446.htm" 60 ACCESSKEY="N" 61 >Next</A 62 ></TD 63 ></TR 64 ></TABLE 65 ><HR 66 ALIGN="LEFT" 67 WIDTH="100%"></DIV 68 ><DIV 69 CLASS="CHAPTER" 70 ><H1 71 ><A 72 NAME="COMPAT" 73 ></A 74 >Chapter 6. Changes</H1 75 ><DIV 76 CLASS="TOC" 77 ><DL 78 ><DT 79 ><B 80 >Table of Contents</B 81 ></DT 82 ><DT 83 >6.1. <A 84 HREF="c14595.htm#DIFF-V4L" 85 >Differences between V4L and V4L2</A 86 ></DT 87 ><DT 88 >6.2. <A 89 HREF="x15446.htm" 90 >Changes of the V4L2 API</A 91 ></DT 92 ><DT 93 >6.3. <A 94 HREF="x16430.htm" 95 >Relation of V4L2 to other Linux multimedia APIs</A 96 ></DT 97 ><DT 98 >6.4. <A 99 HREF="x16453.htm" 100 >Experimental API Elements</A 101 ></DT 102 ><DT 103 >6.5. <A 104 HREF="x16497.htm" 105 >Obsolete API Elements</A 106 ></DT 107 ></DL 108 ></DIV 109 ><P 110 >The following chapters document the evolution of the V4L2 API, 111 errata or extensions. They are also intended to help application and 112 driver writers to port or update their code.</P 113 ><DIV 114 CLASS="SECTION" 115 ><H1 116 CLASS="SECTION" 117 ><A 118 NAME="DIFF-V4L" 119 >6.1. Differences between V4L and V4L2</A 120 ></H1 121 ><P 122 >The Video For Linux API was first introduced in Linux 2.1 to 123 unify and replace various TV and radio device related interfaces, 124 developed independently by driver writers in prior years. Starting 125 with Linux 2.5 the much improved V4L2 API replaces the V4L API, 126 although existing drivers will continue to support V4L applications in 127 the future, either directly or through the V4L2 compatibility layer in 128 the <TT 129 CLASS="FILENAME" 130 >videodev</TT 131 > kernel module translating ioctls on 132 the fly. For a transition period not all drivers will support the V4L2 133 API.</P 134 ><DIV 135 CLASS="SECTION" 136 ><H2 137 CLASS="SECTION" 138 ><A 139 NAME="AEN14602" 140 >6.1.1. Opening and Closing Devices</A 141 ></H2 142 ><P 143 >For compatibility reasons the character device file names 144 recommended for V4L2 video capture, overlay, radio, teletext and raw 145 vbi capture devices did not change from those used by V4L. They are 146 listed in <A 147 HREF="c6488.htm" 148 >Chapter 4</A 149 > and below in <A 150 HREF="c14595.htm#V4L-DEV" 151 >Table 6-1</A 152 >.</P 153 ><P 154 >The V4L <TT 155 CLASS="FILENAME" 156 >videodev</TT 157 > module automatically 158 assigns minor numbers to drivers in load order, depending on the 159 registered device type. We recommend that V4L2 drivers by default 160 register devices with the same numbers, but the system administrator 161 can assign arbitrary minor numbers using driver module options. The 162 major device number remains 81.</P 163 ><DIV 164 CLASS="TABLE" 165 ><A 166 NAME="V4L-DEV" 167 ></A 168 ><P 169 ><B 170 >Table 6-1. V4L Device Types, Names and Numbers</B 171 ></P 172 ><TABLE 173 BORDER="1" 174 CLASS="CALSTABLE" 175 ><COL><COL><COL><THEAD 176 ><TR 177 ><TH 178 >Device Type</TH 179 ><TH 180 >File Name</TH 181 ><TH 182 >Minor Numbers</TH 183 ></TR 184 ></THEAD 185 ><TBODY 186 VALIGN="TOP" 187 ><TR 188 ><TD 189 >Video capture and overlay</TD 190 ><TD 191 ><P 192 ><TT 193 CLASS="FILENAME" 194 >/dev/video</TT 195 > and 196 <TT 197 CLASS="FILENAME" 198 >/dev/bttv0</TT 199 ><SUP 200 >a</SUP 201 >, 202 <TT 203 CLASS="FILENAME" 204 >/dev/video0</TT 205 > to 206 <TT 207 CLASS="FILENAME" 208 >/dev/video63</TT 209 ></P 210 ></TD 211 ><TD 212 >0-63</TD 213 ></TR 214 ><TR 215 ><TD 216 >Radio receiver</TD 217 ><TD 218 ><P 219 ><TT 220 CLASS="FILENAME" 221 >/dev/radio</TT 222 ><SUP 223 >b</SUP 224 >, <TT 225 CLASS="FILENAME" 226 >/dev/radio0</TT 227 > to 228 <TT 229 CLASS="FILENAME" 230 >/dev/radio63</TT 231 ></P 232 ></TD 233 ><TD 234 >64-127</TD 235 ></TR 236 ><TR 237 ><TD 238 >Teletext decoder</TD 239 ><TD 240 ><P 241 ><TT 242 CLASS="FILENAME" 243 >/dev/vtx</TT 244 >, 245 <TT 246 CLASS="FILENAME" 247 >/dev/vtx0</TT 248 > to 249 <TT 250 CLASS="FILENAME" 251 >/dev/vtx31</TT 252 ></P 253 ></TD 254 ><TD 255 >192-223</TD 256 ></TR 257 ><TR 258 ><TD 259 >Raw VBI capture</TD 260 ><TD 261 ><P 262 ><TT 263 CLASS="FILENAME" 264 >/dev/vbi</TT 265 >, 266 <TT 267 CLASS="FILENAME" 268 >/dev/vbi0</TT 269 > to 270 <TT 271 CLASS="FILENAME" 272 >/dev/vbi31</TT 273 ></P 274 ></TD 275 ><TD 276 >224-255</TD 277 ></TR 278 ></TBODY 279 ><TR 280 ><TD 281 COLSPAN="3" 282 >Notes:<BR><A 283 NAME="FTN.AEN14624" 284 >a. </A 285 >According to 286 Documentation/devices.txt these should be symbolic links to 287 <TT 288 CLASS="FILENAME" 289 >/dev/video0</TT 290 >. Note the original bttv interface is 291 not compatible with V4L or V4L2.<BR><A 292 NAME="FTN.AEN14635" 293 >b. </A 294 >According to 295 <TT 296 CLASS="FILENAME" 297 >Documentation/devices.txt</TT 298 > a symbolic link to 299 <TT 300 CLASS="FILENAME" 301 >/dev/radio0</TT 302 >.<BR></TD 303 ></TR 304 ></TABLE 305 ></DIV 306 ><P 307 >V4L prohibits (or used to prohibit) multiple opens of a 308 device file. V4L2 drivers <SPAN 309 CLASS="emphasis" 310 ><I 311 CLASS="EMPHASIS" 312 >may</I 313 ></SPAN 314 > support multiple 315 opens, see <A 316 HREF="c174.htm#OPEN" 317 >Section 1.1</A 318 > for details and consequences.</P 319 ><P 320 >V4L drivers respond to V4L2 ioctls with an <SPAN 321 CLASS="ERRORCODE" 322 >EINVAL</SPAN 323 > error code. The 324 compatibility layer in the V4L2 <TT 325 CLASS="FILENAME" 326 >videodev</TT 327 > module 328 can translate V4L ioctl requests to their V4L2 counterpart, however a 329 V4L2 driver usually needs more preparation to become fully V4L 330 compatible. This is covered in more detail in <A 331 HREF="c14592.htm" 332 >Chapter 5</A 333 >.</P 334 ></DIV 335 ><DIV 336 CLASS="SECTION" 337 ><H2 338 CLASS="SECTION" 339 ><A 340 NAME="AEN14665" 341 >6.1.2. Querying Capabilities</A 342 ></H2 343 ><P 344 >The V4L <CODE 345 CLASS="CONSTANT" 346 >VIDIOCGCAP</CODE 347 > ioctl is 348 equivalent to V4L2's <A 349 HREF="r13105.htm" 350 ><CODE 351 CLASS="CONSTANT" 352 >VIDIOC_QUERYCAP</CODE 353 ></A 354 >.</P 355 ><P 356 >The <CODE 357 CLASS="STRUCTFIELD" 358 >name</CODE 359 > field in struct 360 <CODE 361 CLASS="STRUCTNAME" 362 >video_capability</CODE 363 > became 364 <CODE 365 CLASS="STRUCTFIELD" 366 >card</CODE 367 > in struct <A 368 HREF="r13105.htm#V4L2-CAPABILITY" 369 >v4l2_capability</A 370 >, 371 <CODE 372 CLASS="STRUCTFIELD" 373 >type</CODE 374 > was replaced by 375 <CODE 376 CLASS="STRUCTFIELD" 377 >capabilities</CODE 378 >. Note V4L2 does not 379 distinguish between device types like this, better think of basic 380 video input, video output and radio devices supporting a set of 381 related functions like video capturing, video overlay and VBI 382 capturing. See <A 383 HREF="c174.htm#OPEN" 384 >Section 1.1</A 385 > for an 386 introduction.<DIV 387 CLASS="INFORMALTABLE" 388 ><P 389 ></P 390 ><A 391 NAME="AEN14679" 392 ></A 393 ><TABLE 394 BORDER="1" 395 CLASS="CALSTABLE" 396 ><COL><COL><COL><THEAD 397 ><TR 398 ><TH 399 >struct 400 <CODE 401 CLASS="STRUCTNAME" 402 >video_capability</CODE 403 > 404 <CODE 405 CLASS="STRUCTFIELD" 406 >type</CODE 407 ></TH 408 ><TH 409 >struct <A 410 HREF="r13105.htm#V4L2-CAPABILITY" 411 >v4l2_capability</A 412 > 413 <CODE 414 CLASS="STRUCTFIELD" 415 >capabilities</CODE 416 > flags</TH 417 ><TH 418 >Purpose</TH 419 ></TR 420 ></THEAD 421 ><TBODY 422 VALIGN="TOP" 423 ><TR 424 ><TD 425 ><CODE 426 CLASS="CONSTANT" 427 >VID_TYPE_CAPTURE</CODE 428 ></TD 429 ><TD 430 ><CODE 431 CLASS="CONSTANT" 432 >V4L2_CAP_VIDEO_CAPTURE</CODE 433 ></TD 434 ><TD 435 >The <A 436 HREF="c6488.htm#CAPTURE" 437 >video 438 capture</A 439 > interface is supported.</TD 440 ></TR 441 ><TR 442 ><TD 443 ><CODE 444 CLASS="CONSTANT" 445 >VID_TYPE_TUNER</CODE 446 ></TD 447 ><TD 448 ><CODE 449 CLASS="CONSTANT" 450 >V4L2_CAP_TUNER</CODE 451 ></TD 452 ><TD 453 >The device has a <A 454 HREF="x394.htm" 455 >tuner or 456 modulator</A 457 >.</TD 458 ></TR 459 ><TR 460 ><TD 461 ><CODE 462 CLASS="CONSTANT" 463 >VID_TYPE_TELETEXT</CODE 464 ></TD 465 ><TD 466 ><CODE 467 CLASS="CONSTANT" 468 >V4L2_CAP_VBI_CAPTURE</CODE 469 ></TD 470 ><TD 471 >The <A 472 HREF="x7013.htm" 473 >raw VBI 474 capture</A 475 > interface is supported.</TD 476 ></TR 477 ><TR 478 ><TD 479 ><CODE 480 CLASS="CONSTANT" 481 >VID_TYPE_OVERLAY</CODE 482 ></TD 483 ><TD 484 ><CODE 485 CLASS="CONSTANT" 486 >V4L2_CAP_VIDEO_OVERLAY</CODE 487 ></TD 488 ><TD 489 >The <A 490 HREF="x6570.htm" 491 >video 492 overlay</A 493 > interface is supported.</TD 494 ></TR 495 ><TR 496 ><TD 497 ><CODE 498 CLASS="CONSTANT" 499 >VID_TYPE_CHROMAKEY</CODE 500 ></TD 501 ><TD 502 ><CODE 503 CLASS="CONSTANT" 504 >V4L2_FBUF_CAP_CHROMAKEY</CODE 505 > in 506 field <CODE 507 CLASS="STRUCTFIELD" 508 >capability</CODE 509 > of 510 struct <A 511 HREF="r10595.htm#V4L2-FRAMEBUFFER" 512 >v4l2_framebuffer</A 513 ></TD 514 ><TD 515 >Whether chromakey overlay is supported. For 516 more information on overlay see 517 <A 518 HREF="x6570.htm" 519 >Section 4.2</A 520 >.</TD 521 ></TR 522 ><TR 523 ><TD 524 ><CODE 525 CLASS="CONSTANT" 526 >VID_TYPE_CLIPPING</CODE 527 ></TD 528 ><TD 529 ><CODE 530 CLASS="CONSTANT" 531 >V4L2_FBUF_CAP_LIST_CLIPPING</CODE 532 > 533 and <CODE 534 CLASS="CONSTANT" 535 >V4L2_FBUF_CAP_BITMAP_CLIPPING</CODE 536 > in field 537 <CODE 538 CLASS="STRUCTFIELD" 539 >capability</CODE 540 > of struct <A 541 HREF="r10595.htm#V4L2-FRAMEBUFFER" 542 >v4l2_framebuffer</A 543 ></TD 544 ><TD 545 >Whether clipping the overlaid image is 546 supported, see <A 547 HREF="x6570.htm" 548 >Section 4.2</A 549 >.</TD 550 ></TR 551 ><TR 552 ><TD 553 ><CODE 554 CLASS="CONSTANT" 555 >VID_TYPE_FRAMERAM</CODE 556 ></TD 557 ><TD 558 ><CODE 559 CLASS="CONSTANT" 560 >V4L2_FBUF_CAP_EXTERNOVERLAY</CODE 561 > 562 <SPAN 563 CLASS="emphasis" 564 ><I 565 CLASS="EMPHASIS" 566 >not set</I 567 ></SPAN 568 > in field 569 <CODE 570 CLASS="STRUCTFIELD" 571 >capability</CODE 572 > of struct <A 573 HREF="r10595.htm#V4L2-FRAMEBUFFER" 574 >v4l2_framebuffer</A 575 ></TD 576 ><TD 577 >Whether overlay overwrites frame buffer memory, 578 see <A 579 HREF="x6570.htm" 580 >Section 4.2</A 581 >.</TD 582 ></TR 583 ><TR 584 ><TD 585 ><CODE 586 CLASS="CONSTANT" 587 >VID_TYPE_SCALES</CODE 588 ></TD 589 ><TD 590 ><CODE 591 CLASS="CONSTANT" 592 >-</CODE 593 ></TD 594 ><TD 595 >This flag indicates if the hardware can scale 596 images. The V4L2 API implies the scale factor by setting the cropping 597 dimensions and image size with the <A 598 HREF="r9994.htm" 599 ><CODE 600 CLASS="CONSTANT" 601 >VIDIOC_S_CROP</CODE 602 ></A 603 > and <A 604 HREF="r10944.htm" 605 ><CODE 606 CLASS="CONSTANT" 607 >VIDIOC_S_FMT</CODE 608 ></A 609 > 610 ioctl, respectively. The driver returns the closest sizes possible. 611 For more information on cropping and scaling see <A 612 HREF="x1904.htm" 613 >Section 1.11</A 614 >.</TD 615 ></TR 616 ><TR 617 ><TD 618 ><CODE 619 CLASS="CONSTANT" 620 >VID_TYPE_MONOCHROME</CODE 621 ></TD 622 ><TD 623 ><CODE 624 CLASS="CONSTANT" 625 >-</CODE 626 ></TD 627 ><TD 628 >Applications can enumerate the supported image 629 formats with the <A 630 HREF="r8367.htm" 631 ><CODE 632 CLASS="CONSTANT" 633 >VIDIOC_ENUM_FMT</CODE 634 ></A 635 > ioctl to determine if the device 636 supports grey scale capturing only. For more information on image 637 formats see <A 638 HREF="c2030.htm" 639 >Chapter 2</A 640 >.</TD 641 ></TR 642 ><TR 643 ><TD 644 ><CODE 645 CLASS="CONSTANT" 646 >VID_TYPE_SUBCAPTURE</CODE 647 ></TD 648 ><TD 649 ><CODE 650 CLASS="CONSTANT" 651 >-</CODE 652 ></TD 653 ><TD 654 >Applications can call the <A 655 HREF="r9994.htm" 656 ><CODE 657 CLASS="CONSTANT" 658 >VIDIOC_G_CROP</CODE 659 ></A 660 > ioctl 661 to determine if the device supports capturing a subsection of the full 662 picture ("cropping" in V4L2). If not, the ioctl returns the <SPAN 663 CLASS="ERRORCODE" 664 >EINVAL</SPAN 665 > error code. 666 For more information on cropping and scaling see <A 667 HREF="x1904.htm" 668 >Section 1.11</A 669 >.</TD 670 ></TR 671 ><TR 672 ><TD 673 ><CODE 674 CLASS="CONSTANT" 675 >VID_TYPE_MPEG_DECODER</CODE 676 ></TD 677 ><TD 678 ><CODE 679 CLASS="CONSTANT" 680 >-</CODE 681 ></TD 682 ><TD 683 >Applications can enumerate the supported image 684 formats with the <A 685 HREF="r8367.htm" 686 ><CODE 687 CLASS="CONSTANT" 688 >VIDIOC_ENUM_FMT</CODE 689 ></A 690 > ioctl to determine if the device 691 supports MPEG streams.</TD 692 ></TR 693 ><TR 694 ><TD 695 ><CODE 696 CLASS="CONSTANT" 697 >VID_TYPE_MPEG_ENCODER</CODE 698 ></TD 699 ><TD 700 ><CODE 701 CLASS="CONSTANT" 702 >-</CODE 703 ></TD 704 ><TD 705 >See above.</TD 706 ></TR 707 ><TR 708 ><TD 709 ><CODE 710 CLASS="CONSTANT" 711 >VID_TYPE_MJPEG_DECODER</CODE 712 ></TD 713 ><TD 714 ><CODE 715 CLASS="CONSTANT" 716 >-</CODE 717 ></TD 718 ><TD 719 >See above.</TD 720 ></TR 721 ><TR 722 ><TD 723 ><CODE 724 CLASS="CONSTANT" 725 >VID_TYPE_MJPEG_ENCODER</CODE 726 ></TD 727 ><TD 728 ><CODE 729 CLASS="CONSTANT" 730 >-</CODE 731 ></TD 732 ><TD 733 >See above.</TD 734 ></TR 735 ></TBODY 736 ></TABLE 737 ><P 738 ></P 739 ></DIV 740 ></P 741 ><P 742 >The <CODE 743 CLASS="STRUCTFIELD" 744 >audios</CODE 745 > field was replaced 746 by <CODE 747 CLASS="STRUCTFIELD" 748 >capabilities</CODE 749 > flag 750 <CODE 751 CLASS="CONSTANT" 752 >V4L2_CAP_AUDIO</CODE 753 >, indicating 754 <SPAN 755 CLASS="emphasis" 756 ><I 757 CLASS="EMPHASIS" 758 >if</I 759 ></SPAN 760 > the device has any audio inputs or outputs. To 761 determine their number applications can enumerate audio inputs with 762 the <A 763 HREF="r9539.htm" 764 ><CODE 765 CLASS="CONSTANT" 766 >VIDIOC_G_AUDIO</CODE 767 ></A 768 > ioctl. The audio ioctls are described in <A 769 HREF="x341.htm" 770 >Section 1.5</A 771 >.</P 772 ><P 773 >The <CODE 774 CLASS="STRUCTFIELD" 775 >maxwidth</CODE 776 >, 777 <CODE 778 CLASS="STRUCTFIELD" 779 >maxheight</CODE 780 >, 781 <CODE 782 CLASS="STRUCTFIELD" 783 >minwidth</CODE 784 > and 785 <CODE 786 CLASS="STRUCTFIELD" 787 >minheight</CODE 788 > fields were removed. Calling the 789 <A 790 HREF="r10944.htm" 791 ><CODE 792 CLASS="CONSTANT" 793 >VIDIOC_S_FMT</CODE 794 ></A 795 > or <A 796 HREF="r10944.htm" 797 ><CODE 798 CLASS="CONSTANT" 799 >VIDIOC_TRY_FMT</CODE 800 ></A 801 > ioctl with the desired dimensions 802 returns the closest size possible, taking into account the current 803 video standard, cropping and scaling limitations.</P 804 ></DIV 805 ><DIV 806 CLASS="SECTION" 807 ><H2 808 CLASS="SECTION" 809 ><A 810 NAME="AEN14821" 811 >6.1.3. Video Sources</A 812 ></H2 813 ><P 814 >V4L provides the <CODE 815 CLASS="CONSTANT" 816 >VIDIOCGCHAN</CODE 817 > and 818 <CODE 819 CLASS="CONSTANT" 820 >VIDIOCSCHAN</CODE 821 > ioctl using struct 822 <CODE 823 CLASS="STRUCTNAME" 824 >video_channel</CODE 825 > to enumerate 826 the video inputs of a V4L device. The equivalent V4L2 ioctls 827 are <A 828 HREF="r8936.htm" 829 ><CODE 830 CLASS="CONSTANT" 831 >VIDIOC_ENUMINPUT</CODE 832 ></A 833 >, <A 834 HREF="r11217.htm" 835 ><CODE 836 CLASS="CONSTANT" 837 >VIDIOC_G_INPUT</CODE 838 ></A 839 > and <A 840 HREF="r11217.htm" 841 ><CODE 842 CLASS="CONSTANT" 843 >VIDIOC_S_INPUT</CODE 844 ></A 845 > 846 using struct <A 847 HREF="r8936.htm#V4L2-INPUT" 848 >v4l2_input</A 849 > as discussed in <A 850 HREF="x309.htm" 851 >Section 1.4</A 852 >.</P 853 ><P 854 >The <CODE 855 CLASS="STRUCTFIELD" 856 >channel</CODE 857 > field counting 858 inputs was renamed to <CODE 859 CLASS="STRUCTFIELD" 860 >index</CODE 861 >, the video 862 input types were renamed as follows: <DIV 863 CLASS="INFORMALTABLE" 864 ><P 865 ></P 866 ><A 867 NAME="AEN14838" 868 ></A 869 ><TABLE 870 BORDER="1" 871 CLASS="CALSTABLE" 872 ><COL><COL><THEAD 873 ><TR 874 ><TH 875 >struct <CODE 876 CLASS="STRUCTNAME" 877 >video_channel</CODE 878 > 879 <CODE 880 CLASS="STRUCTFIELD" 881 >type</CODE 882 ></TH 883 ><TH 884 >struct <A 885 HREF="r8936.htm#V4L2-INPUT" 886 >v4l2_input</A 887 > 888 <CODE 889 CLASS="STRUCTFIELD" 890 >type</CODE 891 ></TH 892 ></TR 893 ></THEAD 894 ><TBODY 895 VALIGN="TOP" 896 ><TR 897 ><TD 898 ><CODE 899 CLASS="CONSTANT" 900 >VIDEO_TYPE_TV</CODE 901 ></TD 902 ><TD 903 ><CODE 904 CLASS="CONSTANT" 905 >V4L2_INPUT_TYPE_TUNER</CODE 906 ></TD 907 ></TR 908 ><TR 909 ><TD 910 ><CODE 911 CLASS="CONSTANT" 912 >VIDEO_TYPE_CAMERA</CODE 913 ></TD 914 ><TD 915 ><CODE 916 CLASS="CONSTANT" 917 >V4L2_INPUT_TYPE_CAMERA</CODE 918 ></TD 919 ></TR 920 ></TBODY 921 ></TABLE 922 ><P 923 ></P 924 ></DIV 925 ></P 926 ><P 927 >Unlike the <CODE 928 CLASS="STRUCTFIELD" 929 >tuners</CODE 930 > field 931 expressing the number of tuners of this input, V4L2 assumes each video 932 input is connected to at most one tuner. However a tuner can have more 933 than one input, i. e. RF connectors, and a device can have multiple 934 tuners. The index number of the tuner associated with the input, if 935 any, is stored in field <CODE 936 CLASS="STRUCTFIELD" 937 >tuner</CODE 938 > of 939 struct <A 940 HREF="r8936.htm#V4L2-INPUT" 941 >v4l2_input</A 942 >. Enumeration of tuners is discussed in <A 943 HREF="x394.htm" 944 >Section 1.6</A 945 >.</P 946 ><P 947 >The redundant <CODE 948 CLASS="CONSTANT" 949 >VIDEO_VC_TUNER</CODE 950 > flag was 951 dropped. Video inputs associated with a tuner are of type 952 <CODE 953 CLASS="CONSTANT" 954 >V4L2_INPUT_TYPE_TUNER</CODE 955 >. The 956 <CODE 957 CLASS="CONSTANT" 958 >VIDEO_VC_AUDIO</CODE 959 > flag was replaced by the 960 <CODE 961 CLASS="STRUCTFIELD" 962 >audioset</CODE 963 > field. V4L2 considers devices with 964 up to 32 audio inputs. Each set bit in the 965 <CODE 966 CLASS="STRUCTFIELD" 967 >audioset</CODE 968 > field represents one audio input 969 this video input combines with. For information about audio inputs and 970 how to switch between them see <A 971 HREF="x341.htm" 972 >Section 1.5</A 973 >.</P 974 ><P 975 >The <CODE 976 CLASS="STRUCTFIELD" 977 >norm</CODE 978 > field describing the 979 supported video standards was replaced by 980 <CODE 981 CLASS="STRUCTFIELD" 982 >std</CODE 983 >. The V4L specification mentions a flag 984 <CODE 985 CLASS="CONSTANT" 986 >VIDEO_VC_NORM</CODE 987 > indicating whether the standard can 988 be changed. This flag was a later addition together with the 989 <CODE 990 CLASS="STRUCTFIELD" 991 >norm</CODE 992 > field and has been removed in the 993 meantime. V4L2 has a similar, albeit more comprehensive approach 994 to video standards, see <A 995 HREF="x448.htm" 996 >Section 1.7</A 997 > for more 998 information.</P 999 ></DIV 1000 ><DIV 1001 CLASS="SECTION" 1002 ><H2 1003 CLASS="SECTION" 1004 ><A 1005 NAME="AEN14877" 1006 >6.1.4. Tuning</A 1007 ></H2 1008 ><P 1009 >The V4L <CODE 1010 CLASS="CONSTANT" 1011 >VIDIOCGTUNER</CODE 1012 > and 1013 <CODE 1014 CLASS="CONSTANT" 1015 >VIDIOCSTUNER</CODE 1016 > ioctl and struct 1017 <CODE 1018 CLASS="STRUCTNAME" 1019 >video_tuner</CODE 1020 > can be used to enumerate the 1021 tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are 1022 <A 1023 HREF="r12342.htm" 1024 ><CODE 1025 CLASS="CONSTANT" 1026 >VIDIOC_G_TUNER</CODE 1027 ></A 1028 > and <A 1029 HREF="r12342.htm" 1030 ><CODE 1031 CLASS="CONSTANT" 1032 >VIDIOC_S_TUNER</CODE 1033 ></A 1034 > using struct <A 1035 HREF="r12342.htm#V4L2-TUNER" 1036 >v4l2_tuner</A 1037 >. Tuners are 1038 covered in <A 1039 HREF="x394.htm" 1040 >Section 1.6</A 1041 >.</P 1042 ><P 1043 >The <CODE 1044 CLASS="STRUCTFIELD" 1045 >tuner</CODE 1046 > field counting tuners 1047 was renamed to <CODE 1048 CLASS="STRUCTFIELD" 1049 >index</CODE 1050 >. The fields 1051 <CODE 1052 CLASS="STRUCTFIELD" 1053 >name</CODE 1054 >, <CODE 1055 CLASS="STRUCTFIELD" 1056 >rangelow</CODE 1057 > 1058 and <CODE 1059 CLASS="STRUCTFIELD" 1060 >rangehigh</CODE 1061 > remained unchanged.</P 1062 ><P 1063 >The <CODE 1064 CLASS="CONSTANT" 1065 >VIDEO_TUNER_PAL</CODE 1066 >, 1067 <CODE 1068 CLASS="CONSTANT" 1069 >VIDEO_TUNER_NTSC</CODE 1070 > and 1071 <CODE 1072 CLASS="CONSTANT" 1073 >VIDEO_TUNER_SECAM</CODE 1074 > flags indicating the supported 1075 video standards were dropped. This information is now contained in the 1076 associated struct <A 1077 HREF="r8936.htm#V4L2-INPUT" 1078 >v4l2_input</A 1079 >. No replacement exists for the 1080 <CODE 1081 CLASS="CONSTANT" 1082 >VIDEO_TUNER_NORM</CODE 1083 > flag indicating whether the 1084 video standard can be switched. The <CODE 1085 CLASS="STRUCTFIELD" 1086 >mode</CODE 1087 > 1088 field to select a different video standard was replaced by a whole new 1089 set of ioctls and structures described in <A 1090 HREF="x448.htm" 1091 >Section 1.7</A 1092 >. 1093 Due to its ubiquity it should be mentioned the BTTV driver supports 1094 several standards in addition to the regular 1095 <CODE 1096 CLASS="CONSTANT" 1097 >VIDEO_MODE_PAL</CODE 1098 > (0), 1099 <CODE 1100 CLASS="CONSTANT" 1101 >VIDEO_MODE_NTSC</CODE 1102 >, 1103 <CODE 1104 CLASS="CONSTANT" 1105 >VIDEO_MODE_SECAM</CODE 1106 > and 1107 <CODE 1108 CLASS="CONSTANT" 1109 >VIDEO_MODE_AUTO</CODE 1110 > (3). Namely N/PAL Argentina, 1111 M/PAL, N/PAL, and NTSC Japan with numbers 3-6 (sic).</P 1112 ><P 1113 >The <CODE 1114 CLASS="CONSTANT" 1115 >VIDEO_TUNER_STEREO_ON</CODE 1116 > flag 1117 indicating stereo reception became 1118 <CODE 1119 CLASS="CONSTANT" 1120 >V4L2_TUNER_SUB_STEREO</CODE 1121 > in field 1122 <CODE 1123 CLASS="STRUCTFIELD" 1124 >rxsubchans</CODE 1125 >. This field also permits the 1126 detection of monaural and bilingual audio, see the definition of 1127 struct <A 1128 HREF="r12342.htm#V4L2-TUNER" 1129 >v4l2_tuner</A 1130 > for details. Presently no replacement exists for the 1131 <CODE 1132 CLASS="CONSTANT" 1133 >VIDEO_TUNER_RDS_ON</CODE 1134 > and 1135 <CODE 1136 CLASS="CONSTANT" 1137 >VIDEO_TUNER_MBS_ON</CODE 1138 > flags.</P 1139 ><P 1140 > The <CODE 1141 CLASS="CONSTANT" 1142 >VIDEO_TUNER_LOW</CODE 1143 > flag was renamed 1144 to <CODE 1145 CLASS="CONSTANT" 1146 >V4L2_TUNER_CAP_LOW</CODE 1147 > in the struct <A 1148 HREF="r12342.htm#V4L2-TUNER" 1149 >v4l2_tuner</A 1150 > 1151 <CODE 1152 CLASS="STRUCTFIELD" 1153 >capability</CODE 1154 > field.</P 1155 ><P 1156 >The <CODE 1157 CLASS="CONSTANT" 1158 >VIDIOCGFREQ</CODE 1159 > and 1160 <CODE 1161 CLASS="CONSTANT" 1162 >VIDIOCSFREQ</CODE 1163 > ioctl to change the tuner frequency 1164 where renamed to <A 1165 HREF="r11094.htm" 1166 ><CODE 1167 CLASS="CONSTANT" 1168 >VIDIOC_G_FREQUENCY</CODE 1169 ></A 1170 > and <A 1171 HREF="r11094.htm" 1172 ><CODE 1173 CLASS="CONSTANT" 1174 >VIDIOC_S_FREQUENCY</CODE 1175 ></A 1176 >. They 1177 take a pointer to a struct <A 1178 HREF="r11094.htm#V4L2-FREQUENCY" 1179 >v4l2_frequency</A 1180 > instead of an unsigned long 1181 integer.</P 1182 ></DIV 1183 ><DIV 1184 CLASS="SECTION" 1185 ><H2 1186 CLASS="SECTION" 1187 ><A 1188 NAME="V4L-IMAGE-PROPERTIES" 1189 >6.1.5. Image Properties</A 1190 ></H2 1191 ><P 1192 >V4L2 has no equivalent of the 1193 <CODE 1194 CLASS="CONSTANT" 1195 >VIDIOCGPICT</CODE 1196 > and <CODE 1197 CLASS="CONSTANT" 1198 >VIDIOCSPICT</CODE 1199 > 1200 ioctl and struct <CODE 1201 CLASS="STRUCTNAME" 1202 >video_picture</CODE 1203 >. The following 1204 fields where replaced by V4L2 controls accessible with the 1205 <A 1206 HREF="r13317.htm" 1207 ><CODE 1208 CLASS="CONSTANT" 1209 >VIDIOC_QUERYCTRL</CODE 1210 ></A 1211 >, <A 1212 HREF="r10104.htm" 1213 ><CODE 1214 CLASS="CONSTANT" 1215 >VIDIOC_G_CTRL</CODE 1216 ></A 1217 > and <A 1218 HREF="r10104.htm" 1219 ><CODE 1220 CLASS="CONSTANT" 1221 >VIDIOC_S_CTRL</CODE 1222 ></A 1223 > ioctls:<DIV 1224 CLASS="INFORMALTABLE" 1225 ><P 1226 ></P 1227 ><A 1228 NAME="AEN14939" 1229 ></A 1230 ><TABLE 1231 BORDER="1" 1232 CLASS="CALSTABLE" 1233 ><COL><COL><THEAD 1234 ><TR 1235 ><TH 1236 >struct <CODE 1237 CLASS="STRUCTNAME" 1238 >video_picture</CODE 1239 ></TH 1240 ><TH 1241 >V4L2 Control ID</TH 1242 ></TR 1243 ></THEAD 1244 ><TBODY 1245 VALIGN="TOP" 1246 ><TR 1247 ><TD 1248 ><CODE 1249 CLASS="STRUCTFIELD" 1250 >brightness</CODE 1251 ></TD 1252 ><TD 1253 ><CODE 1254 CLASS="CONSTANT" 1255 >V4L2_CID_BRIGHTNESS</CODE 1256 ></TD 1257 ></TR 1258 ><TR 1259 ><TD 1260 ><CODE 1261 CLASS="STRUCTFIELD" 1262 >hue</CODE 1263 ></TD 1264 ><TD 1265 ><CODE 1266 CLASS="CONSTANT" 1267 >V4L2_CID_HUE</CODE 1268 ></TD 1269 ></TR 1270 ><TR 1271 ><TD 1272 ><CODE 1273 CLASS="STRUCTFIELD" 1274 >colour</CODE 1275 ></TD 1276 ><TD 1277 ><CODE 1278 CLASS="CONSTANT" 1279 >V4L2_CID_SATURATION</CODE 1280 ></TD 1281 ></TR 1282 ><TR 1283 ><TD 1284 ><CODE 1285 CLASS="STRUCTFIELD" 1286 >contrast</CODE 1287 ></TD 1288 ><TD 1289 ><CODE 1290 CLASS="CONSTANT" 1291 >V4L2_CID_CONTRAST</CODE 1292 ></TD 1293 ></TR 1294 ><TR 1295 ><TD 1296 ><CODE 1297 CLASS="STRUCTFIELD" 1298 >whiteness</CODE 1299 ></TD 1300 ><TD 1301 ><CODE 1302 CLASS="CONSTANT" 1303 >V4L2_CID_WHITENESS</CODE 1304 ></TD 1305 ></TR 1306 ></TBODY 1307 ></TABLE 1308 ><P 1309 ></P 1310 ></DIV 1311 ></P 1312 ><P 1313 >The V4L picture controls are assumed to range from 0 to 1314 65535 with no particular reset value. The V4L2 API permits arbitrary 1315 limits and defaults which can be queried with the <A 1316 HREF="r13317.htm" 1317 ><CODE 1318 CLASS="CONSTANT" 1319 >VIDIOC_QUERYCTRL</CODE 1320 ></A 1321 > 1322 ioctl. For general information about controls see <A 1323 HREF="x542.htm" 1324 >Section 1.8</A 1325 >.</P 1326 ><P 1327 >The <CODE 1328 CLASS="STRUCTFIELD" 1329 >depth</CODE 1330 > (average number of 1331 bits per pixel) of a video image is implied by the selected image 1332 format. V4L2 does not explicitely provide such information assuming 1333 applications recognizing the format are aware of the image depth and 1334 others need not know. The <CODE 1335 CLASS="STRUCTFIELD" 1336 >palette</CODE 1337 > field 1338 moved into the struct <A 1339 HREF="c2030.htm#V4L2-PIX-FORMAT" 1340 >v4l2_pix_format</A 1341 >:<DIV 1342 CLASS="INFORMALTABLE" 1343 ><P 1344 ></P 1345 ><A 1346 NAME="AEN14980" 1347 ></A 1348 ><TABLE 1349 BORDER="1" 1350 CLASS="CALSTABLE" 1351 ><COL><COL><THEAD 1352 ><TR 1353 ><TH 1354 >struct <CODE 1355 CLASS="STRUCTNAME" 1356 >video_picture</CODE 1357 > 1358 <CODE 1359 CLASS="STRUCTFIELD" 1360 >palette</CODE 1361 ></TH 1362 ><TH 1363 >struct <A 1364 HREF="c2030.htm#V4L2-PIX-FORMAT" 1365 >v4l2_pix_format</A 1366 > 1367 <CODE 1368 CLASS="STRUCTFIELD" 1369 >pixfmt</CODE 1370 ></TH 1371 ></TR 1372 ></THEAD 1373 ><TBODY 1374 VALIGN="TOP" 1375 ><TR 1376 ><TD 1377 ><CODE 1378 CLASS="CONSTANT" 1379 >VIDEO_PALETTE_GREY</CODE 1380 ></TD 1381 ><TD 1382 ><P 1383 ><A 1384 HREF="r4185.htm" 1385 ><CODE 1386 CLASS="CONSTANT" 1387 >V4L2_PIX_FMT_GREY</CODE 1388 ></A 1389 ></P 1390 ></TD 1391 ></TR 1392 ><TR 1393 ><TD 1394 ><CODE 1395 CLASS="CONSTANT" 1396 >VIDEO_PALETTE_HI240</CODE 1397 ></TD 1398 ><TD 1399 ><P 1400 ><A 1401 HREF="x5665.htm" 1402 ><CODE 1403 CLASS="CONSTANT" 1404 >V4L2_PIX_FMT_HI240</CODE 1405 ></A 1406 ><SUP 1407 >a</SUP 1408 ></P 1409 ></TD 1410 ></TR 1411 ><TR 1412 ><TD 1413 ><CODE 1414 CLASS="CONSTANT" 1415 >VIDEO_PALETTE_RGB565</CODE 1416 ></TD 1417 ><TD 1418 ><P 1419 ><A 1420 HREF="x2490.htm" 1421 ><CODE 1422 CLASS="CONSTANT" 1423 >V4L2_PIX_FMT_RGB565</CODE 1424 ></A 1425 ></P 1426 ></TD 1427 ></TR 1428 ><TR 1429 ><TD 1430 ><CODE 1431 CLASS="CONSTANT" 1432 >VIDEO_PALETTE_RGB555</CODE 1433 ></TD 1434 ><TD 1435 ><P 1436 ><A 1437 HREF="x2490.htm" 1438 ><CODE 1439 CLASS="CONSTANT" 1440 >V4L2_PIX_FMT_RGB555</CODE 1441 ></A 1442 ></P 1443 ></TD 1444 ></TR 1445 ><TR 1446 ><TD 1447 ><CODE 1448 CLASS="CONSTANT" 1449 >VIDEO_PALETTE_RGB24</CODE 1450 ></TD 1451 ><TD 1452 ><P 1453 ><A 1454 HREF="x2490.htm" 1455 ><CODE 1456 CLASS="CONSTANT" 1457 >V4L2_PIX_FMT_BGR24</CODE 1458 ></A 1459 ></P 1460 ></TD 1461 ></TR 1462 ><TR 1463 ><TD 1464 ><CODE 1465 CLASS="CONSTANT" 1466 >VIDEO_PALETTE_RGB32</CODE 1467 ></TD 1468 ><TD 1469 ><P 1470 ><A 1471 HREF="x2490.htm" 1472 ><CODE 1473 CLASS="CONSTANT" 1474 >V4L2_PIX_FMT_BGR32</CODE 1475 ></A 1476 ><SUP 1477 >b</SUP 1478 ></P 1479 ></TD 1480 ></TR 1481 ><TR 1482 ><TD 1483 ><CODE 1484 CLASS="CONSTANT" 1485 >VIDEO_PALETTE_YUV422</CODE 1486 ></TD 1487 ><TD 1488 ><P 1489 ><A 1490 HREF="r4339.htm" 1491 ><CODE 1492 CLASS="CONSTANT" 1493 >V4L2_PIX_FMT_YUYV</CODE 1494 ></A 1495 ></P 1496 ></TD 1497 ></TR 1498 ><TR 1499 ><TD 1500 ><P 1501 ><CODE 1502 CLASS="CONSTANT" 1503 >VIDEO_PALETTE_YUYV</CODE 1504 ><SUP 1505 >c</SUP 1506 ></P 1507 ></TD 1508 ><TD 1509 ><P 1510 ><A 1511 HREF="r4339.htm" 1512 ><CODE 1513 CLASS="CONSTANT" 1514 >V4L2_PIX_FMT_YUYV</CODE 1515 ></A 1516 ></P 1517 ></TD 1518 ></TR 1519 ><TR 1520 ><TD 1521 ><CODE 1522 CLASS="CONSTANT" 1523 >VIDEO_PALETTE_UYVY</CODE 1524 ></TD 1525 ><TD 1526 ><P 1527 ><A 1528 HREF="r4484.htm" 1529 ><CODE 1530 CLASS="CONSTANT" 1531 >V4L2_PIX_FMT_UYVY</CODE 1532 ></A 1533 ></P 1534 ></TD 1535 ></TR 1536 ><TR 1537 ><TD 1538 ><CODE 1539 CLASS="CONSTANT" 1540 >VIDEO_PALETTE_YUV420</CODE 1541 ></TD 1542 ><TD 1543 >None</TD 1544 ></TR 1545 ><TR 1546 ><TD 1547 ><CODE 1548 CLASS="CONSTANT" 1549 >VIDEO_PALETTE_YUV411</CODE 1550 ></TD 1551 ><TD 1552 ><P 1553 ><A 1554 HREF="r4629.htm" 1555 ><CODE 1556 CLASS="CONSTANT" 1557 >V4L2_PIX_FMT_Y41P</CODE 1558 ></A 1559 ><SUP 1560 >d</SUP 1561 ></P 1562 ></TD 1563 ></TR 1564 ><TR 1565 ><TD 1566 ><CODE 1567 CLASS="CONSTANT" 1568 >VIDEO_PALETTE_RAW</CODE 1569 ></TD 1570 ><TD 1571 ><P 1572 >None<SUP 1573 >e</SUP 1574 ></P 1575 ></TD 1576 ></TR 1577 ><TR 1578 ><TD 1579 ><CODE 1580 CLASS="CONSTANT" 1581 >VIDEO_PALETTE_YUV422P</CODE 1582 ></TD 1583 ><TD 1584 ><P 1585 ><A 1586 HREF="r5154.htm" 1587 ><CODE 1588 CLASS="CONSTANT" 1589 >V4L2_PIX_FMT_YUV422P</CODE 1590 ></A 1591 ></P 1592 ></TD 1593 ></TR 1594 ><TR 1595 ><TD 1596 ><CODE 1597 CLASS="CONSTANT" 1598 >VIDEO_PALETTE_YUV411P</CODE 1599 ></TD 1600 ><TD 1601 ><P 1602 ><A 1603 HREF="r5319.htm" 1604 ><CODE 1605 CLASS="CONSTANT" 1606 >V4L2_PIX_FMT_YUV411P</CODE 1607 ></A 1608 ><SUP 1609 >f</SUP 1610 ></P 1611 ></TD 1612 ></TR 1613 ><TR 1614 ><TD 1615 ><CODE 1616 CLASS="CONSTANT" 1617 >VIDEO_PALETTE_YUV420P</CODE 1618 ></TD 1619 ><TD 1620 ><P 1621 ><A 1622 HREF="r4850.htm#V4L2-PIX-FMT-YVU420" 1623 ><CODE 1624 CLASS="CONSTANT" 1625 >V4L2_PIX_FMT_YVU420</CODE 1626 ></A 1627 ></P 1628 ></TD 1629 ></TR 1630 ><TR 1631 ><TD 1632 ><CODE 1633 CLASS="CONSTANT" 1634 >VIDEO_PALETTE_YUV410P</CODE 1635 ></TD 1636 ><TD 1637 ><P 1638 ><A 1639 HREF="r5016.htm#V4L2-PIX-FMT-YVU410" 1640 ><CODE 1641 CLASS="CONSTANT" 1642 >V4L2_PIX_FMT_YVU410</CODE 1643 ></A 1644 ></P 1645 ></TD 1646 ></TR 1647 ></TBODY 1648 ><TR 1649 ><TD 1650 COLSPAN="2" 1651 >Notes:<BR><A 1652 NAME="FTN.AEN15005" 1653 >a. </A 1654 >This is a custom format used by the BTTV 1655 driver, not one of the V4L2 standard formats.<BR><A 1656 NAME="FTN.AEN15035" 1657 >b. </A 1658 >Presumably all V4L RGB formats are 1659 little-endian, although some drivers might interpret them according to machine endianess. V4L2 defines little-endian, big-endian and red/blue 1660 swapped variants. For details see <A 1661 HREF="x2490.htm" 1662 >Section 2.4</A 1663 >.<BR><A 1664 NAME="FTN.AEN15049" 1665 >c. </A 1666 ><CODE 1667 CLASS="CONSTANT" 1668 >VIDEO_PALETTE_YUV422</CODE 1669 > 1670 and <CODE 1671 CLASS="CONSTANT" 1672 >VIDEO_PALETTE_YUYV</CODE 1673 > are the same formats. Some 1674 V4L drivers respond to one, some to the other.<BR><A 1675 NAME="FTN.AEN15075" 1676 >d. </A 1677 >Not to be confused with 1678 <CODE 1679 CLASS="CONSTANT" 1680 >V4L2_PIX_FMT_YUV411P</CODE 1681 >, which is a planar 1682 format.<BR><A 1683 NAME="FTN.AEN15083" 1684 >e. </A 1685 >V4L explains this 1686 as: "RAW capture (BT848)"<BR><A 1687 NAME="FTN.AEN15099" 1688 >f. </A 1689 >Not to be confused with 1690 <CODE 1691 CLASS="CONSTANT" 1692 >V4L2_PIX_FMT_Y41P</CODE 1693 >, which is a packed 1694 format.<BR></TD 1695 ></TR 1696 ></TABLE 1697 ><P 1698 ></P 1699 ></DIV 1700 ></P 1701 ><P 1702 >V4L2 image formats are defined in <A 1703 HREF="c2030.htm" 1704 >Chapter 2</A 1705 >. The image format can be selected with the 1706 <A 1707 HREF="r10944.htm" 1708 ><CODE 1709 CLASS="CONSTANT" 1710 >VIDIOC_S_FMT</CODE 1711 ></A 1712 > ioctl.</P 1713 ></DIV 1714 ><DIV 1715 CLASS="SECTION" 1716 ><H2 1717 CLASS="SECTION" 1718 ><A 1719 NAME="AEN15120" 1720 >6.1.6. Audio</A 1721 ></H2 1722 ><P 1723 >The <CODE 1724 CLASS="CONSTANT" 1725 >VIDIOCGAUDIO</CODE 1726 > and 1727 <CODE 1728 CLASS="CONSTANT" 1729 >VIDIOCSAUDIO</CODE 1730 > ioctl and struct 1731 <CODE 1732 CLASS="STRUCTNAME" 1733 >video_audio</CODE 1734 > are used to enumerate the 1735 audio inputs of a V4L device. The equivalent V4L2 ioctls are 1736 <A 1737 HREF="r9539.htm" 1738 ><CODE 1739 CLASS="CONSTANT" 1740 >VIDIOC_G_AUDIO</CODE 1741 ></A 1742 > and <A 1743 HREF="r9539.htm" 1744 ><CODE 1745 CLASS="CONSTANT" 1746 >VIDIOC_S_AUDIO</CODE 1747 ></A 1748 > using struct <A 1749 HREF="r9539.htm#V4L2-AUDIO" 1750 >v4l2_audio</A 1751 > as 1752 discussed in <A 1753 HREF="x341.htm" 1754 >Section 1.5</A 1755 >.</P 1756 ><P 1757 >The <CODE 1758 CLASS="STRUCTFIELD" 1759 >audio</CODE 1760 > "channel number" 1761 field counting audio inputs was renamed to 1762 <CODE 1763 CLASS="STRUCTFIELD" 1764 >index</CODE 1765 >.</P 1766 ><P 1767 >On <CODE 1768 CLASS="CONSTANT" 1769 >VIDIOCSAUDIO</CODE 1770 > the 1771 <CODE 1772 CLASS="STRUCTFIELD" 1773 >mode</CODE 1774 > field selects <SPAN 1775 CLASS="emphasis" 1776 ><I 1777 CLASS="EMPHASIS" 1778 >one</I 1779 ></SPAN 1780 > 1781 of the <CODE 1782 CLASS="CONSTANT" 1783 >VIDEO_SOUND_MONO</CODE 1784 >, 1785 <CODE 1786 CLASS="CONSTANT" 1787 >VIDEO_SOUND_STEREO</CODE 1788 >, 1789 <CODE 1790 CLASS="CONSTANT" 1791 >VIDEO_SOUND_LANG1</CODE 1792 > or 1793 <CODE 1794 CLASS="CONSTANT" 1795 >VIDEO_SOUND_LANG2</CODE 1796 > audio demodulation modes. When 1797 the current audio standard is BTSC 1798 <CODE 1799 CLASS="CONSTANT" 1800 >VIDEO_SOUND_LANG2</CODE 1801 > refers to SAP and 1802 <CODE 1803 CLASS="CONSTANT" 1804 >VIDEO_SOUND_LANG1</CODE 1805 > is meaningless. Also 1806 undocumented in the V4L specification, there is no way to query the 1807 selected mode. On <CODE 1808 CLASS="CONSTANT" 1809 >VIDIOCGAUDIO</CODE 1810 > the driver returns 1811 the <SPAN 1812 CLASS="emphasis" 1813 ><I 1814 CLASS="EMPHASIS" 1815 >actually received</I 1816 ></SPAN 1817 > audio programmes in this 1818 field. In the V4L2 API this information is stored in the struct <A 1819 HREF="r12342.htm#V4L2-TUNER" 1820 >v4l2_tuner</A 1821 > 1822 <CODE 1823 CLASS="STRUCTFIELD" 1824 >rxsubchans</CODE 1825 > and 1826 <CODE 1827 CLASS="STRUCTFIELD" 1828 >audmode</CODE 1829 > fields, respectively. See <A 1830 HREF="x394.htm" 1831 >Section 1.6</A 1832 > for more information on tuners. Related to audio 1833 modes struct <A 1834 HREF="r9539.htm#V4L2-AUDIO" 1835 >v4l2_audio</A 1836 > also reports if this is a mono or stereo 1837 input, regardless if the source is a tuner.</P 1838 ><P 1839 >The following fields where replaced by V4L2 controls 1840 accessible with the <A 1841 HREF="r13317.htm" 1842 ><CODE 1843 CLASS="CONSTANT" 1844 >VIDIOC_QUERYCTRL</CODE 1845 ></A 1846 >, <A 1847 HREF="r10104.htm" 1848 ><CODE 1849 CLASS="CONSTANT" 1850 >VIDIOC_G_CTRL</CODE 1851 ></A 1852 > and 1853 <A 1854 HREF="r10104.htm" 1855 ><CODE 1856 CLASS="CONSTANT" 1857 >VIDIOC_S_CTRL</CODE 1858 ></A 1859 > ioctls:<DIV 1860 CLASS="INFORMALTABLE" 1861 ><P 1862 ></P 1863 ><A 1864 NAME="AEN15159" 1865 ></A 1866 ><TABLE 1867 BORDER="1" 1868 CLASS="CALSTABLE" 1869 ><COL><COL><THEAD 1870 ><TR 1871 ><TH 1872 >struct 1873 <CODE 1874 CLASS="STRUCTNAME" 1875 >video_audio</CODE 1876 ></TH 1877 ><TH 1878 >V4L2 Control ID</TH 1879 ></TR 1880 ></THEAD 1881 ><TBODY 1882 VALIGN="TOP" 1883 ><TR 1884 ><TD 1885 ><CODE 1886 CLASS="STRUCTFIELD" 1887 >volume</CODE 1888 ></TD 1889 ><TD 1890 ><CODE 1891 CLASS="CONSTANT" 1892 >V4L2_CID_AUDIO_VOLUME</CODE 1893 ></TD 1894 ></TR 1895 ><TR 1896 ><TD 1897 ><CODE 1898 CLASS="STRUCTFIELD" 1899 >bass</CODE 1900 ></TD 1901 ><TD 1902 ><CODE 1903 CLASS="CONSTANT" 1904 >V4L2_CID_AUDIO_BASS</CODE 1905 ></TD 1906 ></TR 1907 ><TR 1908 ><TD 1909 ><CODE 1910 CLASS="STRUCTFIELD" 1911 >treble</CODE 1912 ></TD 1913 ><TD 1914 ><CODE 1915 CLASS="CONSTANT" 1916 >V4L2_CID_AUDIO_TREBLE</CODE 1917 ></TD 1918 ></TR 1919 ><TR 1920 ><TD 1921 ><CODE 1922 CLASS="STRUCTFIELD" 1923 >balance</CODE 1924 ></TD 1925 ><TD 1926 ><CODE 1927 CLASS="CONSTANT" 1928 >V4L2_CID_AUDIO_BALANCE</CODE 1929 ></TD 1930 ></TR 1931 ></TBODY 1932 ></TABLE 1933 ><P 1934 ></P 1935 ></DIV 1936 ></P 1937 ><P 1938 >To determine which of these controls are supported by a 1939 driver V4L provides the <CODE 1940 CLASS="STRUCTFIELD" 1941 >flags</CODE 1942 > 1943 <CODE 1944 CLASS="CONSTANT" 1945 >VIDEO_AUDIO_VOLUME</CODE 1946 >, 1947 <CODE 1948 CLASS="CONSTANT" 1949 >VIDEO_AUDIO_BASS</CODE 1950 >, 1951 <CODE 1952 CLASS="CONSTANT" 1953 >VIDEO_AUDIO_TREBLE</CODE 1954 > and 1955 <CODE 1956 CLASS="CONSTANT" 1957 >VIDEO_AUDIO_BALANCE</CODE 1958 >. In the V4L2 API the 1959 <A 1960 HREF="r13317.htm" 1961 ><CODE 1962 CLASS="CONSTANT" 1963 >VIDIOC_QUERYCTRL</CODE 1964 ></A 1965 > ioctl reports if the respective control is 1966 supported. Accordingly the <CODE 1967 CLASS="CONSTANT" 1968 >VIDEO_AUDIO_MUTABLE</CODE 1969 > 1970 and <CODE 1971 CLASS="CONSTANT" 1972 >VIDEO_AUDIO_MUTE</CODE 1973 > flags where replaced by the 1974 boolean <CODE 1975 CLASS="CONSTANT" 1976 >V4L2_CID_AUDIO_MUTE</CODE 1977 > control.</P 1978 ><P 1979 >All V4L2 controls have a <CODE 1980 CLASS="STRUCTFIELD" 1981 >step</CODE 1982 > 1983 attribute replacing the struct <CODE 1984 CLASS="STRUCTNAME" 1985 >video_audio</CODE 1986 > 1987 <CODE 1988 CLASS="STRUCTFIELD" 1989 >step</CODE 1990 > field. The V4L audio controls are 1991 assumed to range from 0 to 65535 with no particular reset value. The 1992 V4L2 API permits arbitrary limits and defaults which can be queried 1993 with the <A 1994 HREF="r13317.htm" 1995 ><CODE 1996 CLASS="CONSTANT" 1997 >VIDIOC_QUERYCTRL</CODE 1998 ></A 1999 > ioctl. For general information about 2000 controls see <A 2001 HREF="x542.htm" 2002 >Section 1.8</A 2003 >.</P 2004 ></DIV 2005 ><DIV 2006 CLASS="SECTION" 2007 ><H2 2008 CLASS="SECTION" 2009 ><A 2010 NAME="AEN15205" 2011 >6.1.7. Frame Buffer Overlay</A 2012 ></H2 2013 ><P 2014 >The V4L2 ioctls equivalent to 2015 <CODE 2016 CLASS="CONSTANT" 2017 >VIDIOCGFBUF</CODE 2018 > and <CODE 2019 CLASS="CONSTANT" 2020 >VIDIOCSFBUF</CODE 2021 > 2022 are <A 2023 HREF="r10595.htm" 2024 ><CODE 2025 CLASS="CONSTANT" 2026 >VIDIOC_G_FBUF</CODE 2027 ></A 2028 > and <A 2029 HREF="r10595.htm" 2030 ><CODE 2031 CLASS="CONSTANT" 2032 >VIDIOC_S_FBUF</CODE 2033 ></A 2034 >. The 2035 <CODE 2036 CLASS="STRUCTFIELD" 2037 >base</CODE 2038 > field of struct 2039 <CODE 2040 CLASS="STRUCTNAME" 2041 >video_buffer</CODE 2042 > remained unchanged, except V4L2 2043 defines a flag to indicate non-destructive overlays instead of a 2044 <CODE 2045 CLASS="CONSTANT" 2046 >NULL</CODE 2047 > pointer. All other fields moved into the 2048 struct <A 2049 HREF="c2030.htm#V4L2-PIX-FORMAT" 2050 >v4l2_pix_format</A 2051 > <CODE 2052 CLASS="STRUCTFIELD" 2053 >fmt</CODE 2054 > substructure of 2055 struct <A 2056 HREF="r10595.htm#V4L2-FRAMEBUFFER" 2057 >v4l2_framebuffer</A 2058 >. The <CODE 2059 CLASS="STRUCTFIELD" 2060 >depth</CODE 2061 > field was 2062 replaced by <CODE 2063 CLASS="STRUCTFIELD" 2064 >pixelformat</CODE 2065 >. See <A 2066 HREF="x2490.htm" 2067 >Section 2.4</A 2068 > for a list of RGB formats and their 2069 respective color depths.</P 2070 ><P 2071 >Instead of the special ioctls 2072 <CODE 2073 CLASS="CONSTANT" 2074 >VIDIOCGWIN</CODE 2075 > and <CODE 2076 CLASS="CONSTANT" 2077 >VIDIOCSWIN</CODE 2078 > 2079 V4L2 uses the general-purpose data format negotiation ioctls 2080 <A 2081 HREF="r10944.htm" 2082 ><CODE 2083 CLASS="CONSTANT" 2084 >VIDIOC_G_FMT</CODE 2085 ></A 2086 > and <A 2087 HREF="r10944.htm" 2088 ><CODE 2089 CLASS="CONSTANT" 2090 >VIDIOC_S_FMT</CODE 2091 ></A 2092 >. They take a pointer to a 2093 struct <A 2094 HREF="r10944.htm#V4L2-FORMAT" 2095 >v4l2_format</A 2096 > as argument. Here the <CODE 2097 CLASS="STRUCTFIELD" 2098 >win</CODE 2099 > 2100 member of the <CODE 2101 CLASS="STRUCTFIELD" 2102 >fmt</CODE 2103 > union is used, a 2104 struct <A 2105 HREF="x6570.htm#V4L2-WINDOW" 2106 >v4l2_window</A 2107 >.</P 2108 ><P 2109 >The <CODE 2110 CLASS="STRUCTFIELD" 2111 >x</CODE 2112 >, 2113 <CODE 2114 CLASS="STRUCTFIELD" 2115 >y</CODE 2116 >, <CODE 2117 CLASS="STRUCTFIELD" 2118 >width</CODE 2119 > and 2120 <CODE 2121 CLASS="STRUCTFIELD" 2122 >height</CODE 2123 > fields of struct 2124 <CODE 2125 CLASS="STRUCTNAME" 2126 >video_window</CODE 2127 > moved into struct <A 2128 HREF="x6570.htm#V4L2-RECT" 2129 >v4l2_rect</A 2130 > 2131 substructure <CODE 2132 CLASS="STRUCTFIELD" 2133 >w</CODE 2134 > of struct 2135 <CODE 2136 CLASS="STRUCTNAME" 2137 >v4l2_window</CODE 2138 >. The 2139 <CODE 2140 CLASS="STRUCTFIELD" 2141 >chromakey</CODE 2142 >, 2143 <CODE 2144 CLASS="STRUCTFIELD" 2145 >clips</CODE 2146 >, and 2147 <CODE 2148 CLASS="STRUCTFIELD" 2149 >clipcount</CODE 2150 > fields remained unchanged. Struct 2151 <CODE 2152 CLASS="STRUCTNAME" 2153 >video_clip</CODE 2154 > was renamed to struct <A 2155 HREF="x6570.htm#V4L2-CLIP" 2156 >v4l2_clip</A 2157 >, also 2158 containing a struct <CODE 2159 CLASS="STRUCTNAME" 2160 >v4l2_rect</CODE 2161 >, but the 2162 semantics are still the same.</P 2163 ><P 2164 >The <CODE 2165 CLASS="CONSTANT" 2166 >VIDEO_WINDOW_INTERLACE</CODE 2167 > flag was 2168 dropped. Instead applications must set the 2169 <CODE 2170 CLASS="STRUCTFIELD" 2171 >field</CODE 2172 > field to 2173 <CODE 2174 CLASS="CONSTANT" 2175 >V4L2_FIELD_ANY</CODE 2176 > or 2177 <CODE 2178 CLASS="CONSTANT" 2179 >V4L2_FIELD_INTERLACED</CODE 2180 >. The 2181 <CODE 2182 CLASS="CONSTANT" 2183 >VIDEO_WINDOW_CHROMAKEY</CODE 2184 > flag moved into 2185 struct <A 2186 HREF="r10595.htm#V4L2-FRAMEBUFFER" 2187 >v4l2_framebuffer</A 2188 >, under the new name 2189 <CODE 2190 CLASS="CONSTANT" 2191 >V4L2_FBUF_FLAG_CHROMAKEY</CODE 2192 >.</P 2193 ><P 2194 >In V4L, storing a bitmap pointer in 2195 <CODE 2196 CLASS="STRUCTFIELD" 2197 >clips</CODE 2198 > and setting 2199 <CODE 2200 CLASS="STRUCTFIELD" 2201 >clipcount</CODE 2202 > to 2203 <CODE 2204 CLASS="CONSTANT" 2205 >VIDEO_CLIP_BITMAP</CODE 2206 > (-1) requests bitmap 2207 clipping, using a fixed size bitmap of 1024 × 625 bits. Struct 2208 <CODE 2209 CLASS="STRUCTNAME" 2210 >v4l2_window</CODE 2211 > has a separate 2212 <CODE 2213 CLASS="STRUCTFIELD" 2214 >bitmap</CODE 2215 > pointer field for this purpose and 2216 the bitmap size is determined by <CODE 2217 CLASS="STRUCTFIELD" 2218 >w.width</CODE 2219 > and 2220 <CODE 2221 CLASS="STRUCTFIELD" 2222 >w.height</CODE 2223 >.</P 2224 ><P 2225 >The <CODE 2226 CLASS="CONSTANT" 2227 >VIDIOCCAPTURE</CODE 2228 > ioctl to enable or 2229 disable overlay was renamed to <A 2230 HREF="r12816.htm" 2231 ><CODE 2232 CLASS="CONSTANT" 2233 >VIDIOC_OVERLAY</CODE 2234 ></A 2235 >.</P 2236 ></DIV 2237 ><DIV 2238 CLASS="SECTION" 2239 ><H2 2240 CLASS="SECTION" 2241 ><A 2242 NAME="AEN15269" 2243 >6.1.8. Cropping</A 2244 ></H2 2245 ><P 2246 >To capture only a subsection of the full picture V4L 2247 defines the <CODE 2248 CLASS="CONSTANT" 2249 >VIDIOCGCAPTURE</CODE 2250 > and 2251 <CODE 2252 CLASS="CONSTANT" 2253 >VIDIOCSCAPTURE</CODE 2254 > ioctls using struct 2255 <CODE 2256 CLASS="STRUCTNAME" 2257 >video_capture</CODE 2258 >. The equivalent V4L2 ioctls are 2259 <A 2260 HREF="r9994.htm" 2261 ><CODE 2262 CLASS="CONSTANT" 2263 >VIDIOC_G_CROP</CODE 2264 ></A 2265 > and <A 2266 HREF="r9994.htm" 2267 ><CODE 2268 CLASS="CONSTANT" 2269 >VIDIOC_S_CROP</CODE 2270 ></A 2271 > using struct <A 2272 HREF="r9994.htm#V4L2-CROP" 2273 >v4l2_crop</A 2274 >, and the related 2275 <A 2276 HREF="r7771.htm" 2277 ><CODE 2278 CLASS="CONSTANT" 2279 >VIDIOC_CROPCAP</CODE 2280 ></A 2281 > ioctl. This is a rather complex matter, see 2282 <A 2283 HREF="x1904.htm" 2284 >Section 1.11</A 2285 > for details.</P 2286 ><P 2287 >The <CODE 2288 CLASS="STRUCTFIELD" 2289 >x</CODE 2290 >, 2291 <CODE 2292 CLASS="STRUCTFIELD" 2293 >y</CODE 2294 >, <CODE 2295 CLASS="STRUCTFIELD" 2296 >width</CODE 2297 > and 2298 <CODE 2299 CLASS="STRUCTFIELD" 2300 >height</CODE 2301 > fields moved into struct <A 2302 HREF="x6570.htm#V4L2-RECT" 2303 >v4l2_rect</A 2304 > 2305 substructure <CODE 2306 CLASS="STRUCTFIELD" 2307 >c</CODE 2308 > of struct 2309 <CODE 2310 CLASS="STRUCTNAME" 2311 >v4l2_crop</CODE 2312 >. The 2313 <CODE 2314 CLASS="STRUCTFIELD" 2315 >decimation</CODE 2316 > field was dropped. In the V4L2 2317 API the scaling factor is implied by the size of the cropping 2318 rectangle and the size of the captured or overlaid image.</P 2319 ><P 2320 >The <CODE 2321 CLASS="CONSTANT" 2322 >VIDEO_CAPTURE_ODD</CODE 2323 > 2324 and <CODE 2325 CLASS="CONSTANT" 2326 >VIDEO_CAPTURE_EVEN</CODE 2327 > flags to capture only the 2328 odd or even field, respectively, were replaced by 2329 <CODE 2330 CLASS="CONSTANT" 2331 >V4L2_FIELD_TOP</CODE 2332 > and 2333 <CODE 2334 CLASS="CONSTANT" 2335 >V4L2_FIELD_BOTTOM</CODE 2336 > in the field named 2337 <CODE 2338 CLASS="STRUCTFIELD" 2339 >field</CODE 2340 > of struct <A 2341 HREF="c2030.htm#V4L2-PIX-FORMAT" 2342 >v4l2_pix_format</A 2343 > and 2344 struct <A 2345 HREF="x6570.htm#V4L2-WINDOW" 2346 >v4l2_window</A 2347 >. These structures are used to select a capture or 2348 overlay format with the <A 2349 HREF="r10944.htm" 2350 ><CODE 2351 CLASS="CONSTANT" 2352 >VIDIOC_S_FMT</CODE 2353 ></A 2354 > ioctl.</P 2355 ></DIV 2356 ><DIV 2357 CLASS="SECTION" 2358 ><H2 2359 CLASS="SECTION" 2360 ><A 2361 NAME="AEN15302" 2362 >6.1.9. Reading Images, Memory Mapping</A 2363 ></H2 2364 ><DIV 2365 CLASS="SECTION" 2366 ><H3 2367 CLASS="SECTION" 2368 ><A 2369 NAME="AEN15304" 2370 >6.1.9.1. Capturing using the read method</A 2371 ></H3 2372 ><P 2373 >There is no essential difference between reading images 2374 from a V4L or V4L2 device using the <A 2375 HREF="r14264.htm" 2376 ><CODE 2377 CLASS="FUNCTION" 2378 >read()</CODE 2379 ></A 2380 > function, however V4L2 2381 drivers are not required to support this I/O method. Applications can 2382 determine if the function is available with the <A 2383 HREF="r13105.htm" 2384 ><CODE 2385 CLASS="CONSTANT" 2386 >VIDIOC_QUERYCAP</CODE 2387 ></A 2388 > 2389 ioctl. All V4L2 devices exchanging data with applications must support 2390 the <A 2391 HREF="r14390.htm" 2392 ><CODE 2393 CLASS="FUNCTION" 2394 >select()</CODE 2395 ></A 2396 > and <A 2397 HREF="r14169.htm" 2398 ><CODE 2399 CLASS="FUNCTION" 2400 >poll()</CODE 2401 ></A 2402 > functions.</P 2403 ><P 2404 >To select an image format and size, V4L provides the 2405 <CODE 2406 CLASS="CONSTANT" 2407 >VIDIOCSPICT</CODE 2408 > and <CODE 2409 CLASS="CONSTANT" 2410 >VIDIOCSWIN</CODE 2411 > 2412 ioctls. V4L2 uses the general-purpose data format negotiation ioctls 2413 <A 2414 HREF="r10944.htm" 2415 ><CODE 2416 CLASS="CONSTANT" 2417 >VIDIOC_G_FMT</CODE 2418 ></A 2419 > and <A 2420 HREF="r10944.htm" 2421 ><CODE 2422 CLASS="CONSTANT" 2423 >VIDIOC_S_FMT</CODE 2424 ></A 2425 >. They take a pointer to a 2426 struct <A 2427 HREF="r10944.htm#V4L2-FORMAT" 2428 >v4l2_format</A 2429 > as argument, here the struct <A 2430 HREF="c2030.htm#V4L2-PIX-FORMAT" 2431 >v4l2_pix_format</A 2432 > named 2433 <CODE 2434 CLASS="STRUCTFIELD" 2435 >pix</CODE 2436 > of its <CODE 2437 CLASS="STRUCTFIELD" 2438 >fmt</CODE 2439 > 2440 union is used.</P 2441 ><P 2442 >For more information about the V4L2 read interface see 2443 <A 2444 HREF="c5742.htm#RW" 2445 >Section 3.1</A 2446 >.</P 2447 ></DIV 2448 ><DIV 2449 CLASS="SECTION" 2450 ><H3 2451 CLASS="SECTION" 2452 ><A 2453 NAME="AEN15328" 2454 >6.1.9.2. Capturing using memory mapping</A 2455 ></H3 2456 ><P 2457 >Applications can read from V4L devices by mapping 2458 buffers in device memory, or more often just buffers allocated in 2459 DMA-able system memory, into their address space. This avoids the data 2460 copying overhead of the read method. V4L2 supports memory mapping as 2461 well, with a few differences.</P 2462 ><DIV 2463 CLASS="INFORMALTABLE" 2464 ><P 2465 ></P 2466 ><A 2467 NAME="AEN15331" 2468 ></A 2469 ><TABLE 2470 BORDER="1" 2471 CLASS="CALSTABLE" 2472 ><COL><COL><THEAD 2473 ><TR 2474 ><TH 2475 >V4L</TH 2476 ><TH 2477 >V4L2</TH 2478 ></TR 2479 ></THEAD 2480 ><TBODY 2481 VALIGN="TOP" 2482 ><TR 2483 ><TD 2484 > </TD 2485 ><TD 2486 >The image format must be selected before 2487 buffers are allocated, with the <A 2488 HREF="r10944.htm" 2489 ><CODE 2490 CLASS="CONSTANT" 2491 >VIDIOC_S_FMT</CODE 2492 ></A 2493 > ioctl. When no format 2494 is selected the driver may use the last, possibly by another 2495 application requested format.</TD 2496 ></TR 2497 ><TR 2498 ><TD 2499 ><P 2500 >Applications cannot change the number of 2501 buffers. The it is built into the driver, unless it has a module 2502 option to change the number when the driver module is 2503 loaded.</P 2504 ></TD 2505 ><TD 2506 ><P 2507 >The <A 2508 HREF="r13696.htm" 2509 ><CODE 2510 CLASS="CONSTANT" 2511 >VIDIOC_REQBUFS</CODE 2512 ></A 2513 > ioctl allocates the 2514 desired number of buffers, this is a required step in the initialization 2515 sequence.</P 2516 ></TD 2517 ></TR 2518 ><TR 2519 ><TD 2520 ><P 2521 >Drivers map all buffers as one contiguous 2522 range of memory. The <CODE 2523 CLASS="CONSTANT" 2524 >VIDIOCGMBUF</CODE 2525 > ioctl is 2526 available to query the number of buffers, the offset of each buffer 2527 from the start of the virtual file, and the overall amount of memory 2528 used, which can be used as arguments for the <A 2529 HREF="r13889.htm" 2530 ><CODE 2531 CLASS="FUNCTION" 2532 >mmap()</CODE 2533 ></A 2534 > 2535 function.</P 2536 ></TD 2537 ><TD 2538 ><P 2539 >Buffers are individually mapped. The 2540 offset and size of each buffer can be determined with the 2541 <A 2542 HREF="r13022.htm" 2543 ><CODE 2544 CLASS="CONSTANT" 2545 >VIDIOC_QUERYBUF</CODE 2546 ></A 2547 > ioctl.</P 2548 ></TD 2549 ></TR 2550 ><TR 2551 ><TD 2552 ><P 2553 >The <CODE 2554 CLASS="CONSTANT" 2555 >VIDIOCMCAPTURE</CODE 2556 > 2557 ioctl prepares a buffer for capturing. It also determines the image 2558 format for this buffer. The ioctl returns immediately, eventually with 2559 an <SPAN 2560 CLASS="ERRORCODE" 2561 >EAGAIN</SPAN 2562 > error code if no video signal had been detected. When the driver 2563 supports more than one buffer applications can call the ioctl multiple 2564 times and thus have multiple outstanding capture 2565 requests.</P 2566 ><P 2567 >The <CODE 2568 CLASS="CONSTANT" 2569 >VIDIOCSYNC</CODE 2570 > ioctl 2571 suspends execution until a particular buffer has been 2572 filled.</P 2573 ></TD 2574 ><TD 2575 ><P 2576 >Drivers maintain an incoming and outgoing 2577 queue. <A 2578 HREF="r12878.htm" 2579 ><CODE 2580 CLASS="CONSTANT" 2581 >VIDIOC_QBUF</CODE 2582 ></A 2583 > enqueues any empty buffer into the incoming 2584 queue. Filled buffers are dequeued from the outgoing queue with the 2585 <A 2586 HREF="r12878.htm" 2587 ><CODE 2588 CLASS="CONSTANT" 2589 >VIDIOC_DQBUF</CODE 2590 ></A 2591 > ioctl. To wait until filled buffers become available this 2592 function, <A 2593 HREF="r14390.htm" 2594 ><CODE 2595 CLASS="FUNCTION" 2596 >select()</CODE 2597 ></A 2598 > or <A 2599 HREF="r14169.htm" 2600 ><CODE 2601 CLASS="FUNCTION" 2602 >poll()</CODE 2603 ></A 2604 > can be used. The 2605 <A 2606 HREF="r13817.htm" 2607 ><CODE 2608 CLASS="CONSTANT" 2609 >VIDIOC_STREAMON</CODE 2610 ></A 2611 > ioctl must be called once after enqueuing one or 2612 more buffers to start capturing. Its counterpart 2613 <A 2614 HREF="r13817.htm" 2615 ><CODE 2616 CLASS="CONSTANT" 2617 >VIDIOC_STREAMOFF</CODE 2618 ></A 2619 > stops capturing and dequeues all buffers from both 2620 queues. Applications can query the signal status, if known, with the 2621 <A 2622 HREF="r8936.htm" 2623 ><CODE 2624 CLASS="CONSTANT" 2625 >VIDIOC_ENUMINPUT</CODE 2626 ></A 2627 > ioctl.</P 2628 ></TD 2629 ></TR 2630 ></TBODY 2631 ></TABLE 2632 ><P 2633 ></P 2634 ></DIV 2635 ><P 2636 >For a more in-depth discussion of memory mapping and 2637 examples, see <A 2638 HREF="x5791.htm" 2639 >Section 3.2</A 2640 >.</P 2641 ></DIV 2642 ></DIV 2643 ><DIV 2644 CLASS="SECTION" 2645 ><H2 2646 CLASS="SECTION" 2647 ><A 2648 NAME="AEN15385" 2649 >6.1.10. Reading Raw VBI Data</A 2650 ></H2 2651 ><P 2652 >Originally the V4L API did not specify a raw VBI capture 2653 interface, only the device file <TT 2654 CLASS="FILENAME" 2655 >/dev/vbi</TT 2656 > was 2657 reserved for this purpose. The only driver supporting this interface 2658 was the BTTV driver, de-facto defining the V4L VBI interface. Reading 2659 from the device yields a raw VBI image with the following 2660 parameters:<DIV 2661 CLASS="INFORMALTABLE" 2662 ><P 2663 ></P 2664 ><A 2665 NAME="AEN15389" 2666 ></A 2667 ><TABLE 2668 BORDER="1" 2669 CLASS="CALSTABLE" 2670 ><COL><COL><THEAD 2671 ><TR 2672 ><TH 2673 >struct <A 2674 HREF="x7013.htm#V4L2-VBI-FORMAT" 2675 >v4l2_vbi_format</A 2676 ></TH 2677 ><TH 2678 >V4L, BTTV driver</TH 2679 ></TR 2680 ></THEAD 2681 ><TBODY 2682 VALIGN="TOP" 2683 ><TR 2684 ><TD 2685 >sampling_rate</TD 2686 ><TD 2687 >28636363 Hz NTSC (or any other 525-line 2688 standard); 35468950 Hz PAL and SECAM (625-line standards)</TD 2689 ></TR 2690 ><TR 2691 ><TD 2692 >offset</TD 2693 ><TD 2694 >?</TD 2695 ></TR 2696 ><TR 2697 ><TD 2698 >samples_per_line</TD 2699 ><TD 2700 >2048</TD 2701 ></TR 2702 ><TR 2703 ><TD 2704 >sample_format</TD 2705 ><TD 2706 >V4L2_PIX_FMT_GREY. The last four bytes (a 2707 machine endianess integer) contain a frame counter.</TD 2708 ></TR 2709 ><TR 2710 ><TD 2711 >start[]</TD 2712 ><TD 2713 >10, 273 NTSC; 22, 335 PAL and SECAM</TD 2714 ></TR 2715 ><TR 2716 ><TD 2717 >count[]</TD 2718 ><TD 2719 ><P 2720 >16, 16<SUP 2721 >a</SUP 2722 ></P 2723 ></TD 2724 ></TR 2725 ><TR 2726 ><TD 2727 >flags</TD 2728 ><TD 2729 >0</TD 2730 ></TR 2731 ></TBODY 2732 ><TR 2733 ><TD 2734 COLSPAN="2" 2735 >Notes:<BR><A 2736 NAME="FTN.AEN15416" 2737 >a. </A 2738 >Old driver 2739 versions used different values, eventually the custom 2740 <CODE 2741 CLASS="CONSTANT" 2742 >BTTV_VBISIZE</CODE 2743 > ioctl was added to query the 2744 correct values.<BR></TD 2745 ></TR 2746 ></TABLE 2747 ><P 2748 ></P 2749 ></DIV 2750 ></P 2751 ><P 2752 >Undocumented in the V4L specification, in Linux 2.3 the 2753 <CODE 2754 CLASS="CONSTANT" 2755 >VIDIOCGVBIFMT</CODE 2756 > and 2757 <CODE 2758 CLASS="CONSTANT" 2759 >VIDIOCSVBIFMT</CODE 2760 > ioctls using struct 2761 <CODE 2762 CLASS="STRUCTNAME" 2763 >vbi_format</CODE 2764 > were added to determine the VBI 2765 image parameters. These ioctls are only partially compatible with the 2766 V4L2 VBI interface specified in <A 2767 HREF="x7013.htm" 2768 >Section 4.7</A 2769 >.</P 2770 ><P 2771 >An <CODE 2772 CLASS="STRUCTFIELD" 2773 >offset</CODE 2774 > field does not 2775 exist, <CODE 2776 CLASS="STRUCTFIELD" 2777 >sample_format</CODE 2778 > is supposed to be 2779 <CODE 2780 CLASS="CONSTANT" 2781 >VIDEO_PALETTE_RAW</CODE 2782 >, equivalent to 2783 <CODE 2784 CLASS="CONSTANT" 2785 >V4L2_PIX_FMT_GREY</CODE 2786 >. The remaining fields are 2787 probably equivalent to struct <A 2788 HREF="x7013.htm#V4L2-VBI-FORMAT" 2789 >v4l2_vbi_format</A 2790 >.</P 2791 ><P 2792 >Apparently only the Zoran (ZR 36120) driver implements 2793 these ioctls. The semantics differ from those specified for V4L2 in two 2794 ways. The parameters are reset on <A 2795 HREF="r14090.htm" 2796 ><CODE 2797 CLASS="FUNCTION" 2798 >open()</CODE 2799 ></A 2800 > and 2801 <CODE 2802 CLASS="CONSTANT" 2803 >VIDIOCSVBIFMT</CODE 2804 > always returns an <SPAN 2805 CLASS="ERRORCODE" 2806 >EINVAL</SPAN 2807 > error code if the 2808 parameters are invalid.</P 2809 ></DIV 2810 ><DIV 2811 CLASS="SECTION" 2812 ><H2 2813 CLASS="SECTION" 2814 ><A 2815 NAME="AEN15438" 2816 >6.1.11. Miscellaneous</A 2817 ></H2 2818 ><P 2819 >V4L2 has no equivalent of the 2820 <CODE 2821 CLASS="CONSTANT" 2822 >VIDIOCGUNIT</CODE 2823 > ioctl. Applications can find the VBI 2824 device associated with a video capture device (or vice versa) by 2825 reopening the device and requesting VBI data. For details see 2826 <A 2827 HREF="c174.htm#OPEN" 2828 >Section 1.1</A 2829 >.</P 2830 ><P 2831 >No replacement exists for <CODE 2832 CLASS="CONSTANT" 2833 >VIDIOCKEY</CODE 2834 >, 2835 and the V4L functions for microcode programming. A new interface for 2836 MPEG compression and playback devices is documented in <A 2837 HREF="x802.htm" 2838 >Section 1.9</A 2839 >.</P 2840 ></DIV 2841 ></DIV 2842 ></DIV 2843 ><DIV 2844 CLASS="NAVFOOTER" 2845 ><HR 2846 ALIGN="LEFT" 2847 WIDTH="100%"><TABLE 2848 SUMMARY="Footer navigation table" 2849 WIDTH="100%" 2850 BORDER="0" 2851 CELLPADDING="0" 2852 CELLSPACING="0" 2853 ><TR 2854 ><TD 2855 WIDTH="33%" 2856 ALIGN="left" 2857 VALIGN="top" 2858 ><A 2859 HREF="c14592.htm" 2860 ACCESSKEY="P" 2861 >Prev</A 2862 ></TD 2863 ><TD 2864 WIDTH="34%" 2865 ALIGN="center" 2866 VALIGN="top" 2867 ><A 2868 HREF="book1.htm" 2869 ACCESSKEY="H" 2870 >Home</A 2871 ></TD 2872 ><TD 2873 WIDTH="33%" 2874 ALIGN="right" 2875 VALIGN="top" 2876 ><A 2877 HREF="x15446.htm" 2878 ACCESSKEY="N" 2879 >Next</A 2880 ></TD 2881 ></TR 2882 ><TR 2883 ><TD 2884 WIDTH="33%" 2885 ALIGN="left" 2886 VALIGN="top" 2887 >V4L2 Driver Programming</TD 2888 ><TD 2889 WIDTH="34%" 2890 ALIGN="center" 2891 VALIGN="top" 2892 > </TD 2893 ><TD 2894 WIDTH="33%" 2895 ALIGN="right" 2896 VALIGN="top" 2897 >Changes of the V4L2 API</TD 2898 ></TR 2899 ></TABLE 2900 ></DIV 2901 ></BODY 2902 ></HTML 2903 > 2904