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 >Sliced VBI Data Interface</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="UP" 13 TITLE="Interfaces" 14 HREF="c6488.htm"><LINK 15 REL="PREVIOUS" 16 TITLE="Raw VBI Data Interface" 17 HREF="x7013.htm"><LINK 18 REL="NEXT" 19 TITLE="Teletext Interface" 20 HREF="x7561.htm"></HEAD 21 ><BODY 22 CLASS="SECTION" 23 BGCOLOR="#FFFFFF" 24 TEXT="#000000" 25 LINK="#0000FF" 26 VLINK="#840084" 27 ALINK="#0000FF" 28 ><DIV 29 CLASS="NAVHEADER" 30 ><TABLE 31 SUMMARY="Header navigation table" 32 WIDTH="100%" 33 BORDER="0" 34 CELLPADDING="0" 35 CELLSPACING="0" 36 ><TR 37 ><TH 38 COLSPAN="3" 39 ALIGN="center" 40 >Video for Linux Two API Specification: Revision 0.24</TH 41 ></TR 42 ><TR 43 ><TD 44 WIDTH="10%" 45 ALIGN="left" 46 VALIGN="bottom" 47 ><A 48 HREF="x7013.htm" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 >Chapter 4. Interfaces</TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="x7561.htm" 63 ACCESSKEY="N" 64 >Next</A 65 ></TD 66 ></TR 67 ></TABLE 68 ><HR 69 ALIGN="LEFT" 70 WIDTH="100%"></DIV 71 ><DIV 72 CLASS="SECTION" 73 ><H1 74 CLASS="SECTION" 75 ><A 76 NAME="SLICED" 77 >4.8. Sliced VBI Data Interface</A 78 ></H1 79 ><P 80 >VBI stands for Vertical Blanking Interval, a gap in the 81 sequence of lines of an analog video signal. During VBI no picture 82 information is transmitted, allowing some time while the electron beam 83 of a cathode ray tube TV returns to the top of the screen.</P 84 ><P 85 >Sliced VBI devices use hardware to demodulate data transmitted 86 in the VBI. V4L2 drivers shall <SPAN 87 CLASS="emphasis" 88 ><I 89 CLASS="EMPHASIS" 90 >not</I 91 ></SPAN 92 > do this by 93 software, see also the <A 94 HREF="x7013.htm" 95 >raw VBI 96 interface</A 97 >. The data is passed as short packets of fixed size, 98 covering one scan line each. The number of packets per video frame is 99 variable.</P 100 ><P 101 >Sliced VBI capture and output devices are accessed through the 102 same character special files as raw VBI devices. When a driver 103 supports both interfaces, the default function of a 104 <TT 105 CLASS="FILENAME" 106 >/dev/vbi</TT 107 > device is <SPAN 108 CLASS="emphasis" 109 ><I 110 CLASS="EMPHASIS" 111 >raw</I 112 ></SPAN 113 > VBI 114 capturing or output, and the sliced VBI function is only available 115 after calling the <A 116 HREF="r10944.htm" 117 ><CODE 118 CLASS="CONSTANT" 119 >VIDIOC_S_FMT</CODE 120 ></A 121 > ioctl as defined below. Likewise a 122 <TT 123 CLASS="FILENAME" 124 >/dev/video</TT 125 > device may support the sliced VBI API, 126 however the default function here is video capturing or output. 127 Different file descriptors must be used to pass raw and sliced VBI 128 data simultaneously, if this is supported by the driver.</P 129 ><DIV 130 CLASS="SECTION" 131 ><H2 132 CLASS="SECTION" 133 ><A 134 NAME="AEN7248" 135 >4.8.1. Querying Capabilities</A 136 ></H2 137 ><P 138 >Devices supporting the sliced VBI capturing or output API 139 set the <CODE 140 CLASS="CONSTANT" 141 >V4L2_CAP_SLICED_VBI_CAPTURE</CODE 142 > or 143 <CODE 144 CLASS="CONSTANT" 145 >V4L2_CAP_SLICED_VBI_OUTPUT</CODE 146 > flag respectively, in 147 the <CODE 148 CLASS="STRUCTFIELD" 149 >capabilities</CODE 150 > field of struct <A 151 HREF="r13105.htm#V4L2-CAPABILITY" 152 >v4l2_capability</A 153 > 154 returned by the <A 155 HREF="r13105.htm" 156 ><CODE 157 CLASS="CONSTANT" 158 >VIDIOC_QUERYCAP</CODE 159 ></A 160 > ioctl. At least one of the 161 read/write, streaming or asynchronous <A 162 HREF="c5742.htm" 163 >I/O 164 methods</A 165 > must be supported. Sliced VBI devices may have a tuner 166 or modulator.</P 167 ></DIV 168 ><DIV 169 CLASS="SECTION" 170 ><H2 171 CLASS="SECTION" 172 ><A 173 NAME="AEN7258" 174 >4.8.2. Supplemental Functions</A 175 ></H2 176 ><P 177 >Sliced VBI devices shall support <A 178 HREF="x309.htm" 179 >video 180 input or output</A 181 > and <A 182 HREF="x394.htm" 183 >tuner or 184 modulator</A 185 > ioctls if they have these capabilities, and they may 186 support <A 187 HREF="x542.htm" 188 >control</A 189 > ioctls. The <A 190 HREF="x448.htm" 191 >video standard</A 192 > ioctls provide information 193 vital to program a sliced VBI device, therefore must be 194 supported.</P 195 ></DIV 196 ><DIV 197 CLASS="SECTION" 198 ><H2 199 CLASS="SECTION" 200 ><A 201 NAME="AEN7265" 202 >4.8.3. Sliced VBI Format Negotiation</A 203 ></H2 204 ><P 205 >To find out which data services are supported by the 206 hardware applications can call the <A 207 HREF="r12051.htm" 208 ><CODE 209 CLASS="CONSTANT" 210 >VIDIOC_G_SLICED_VBI_CAP</CODE 211 ></A 212 > ioctl. 213 All drivers implementing the sliced VBI interface must support this 214 ioctl. The results may differ from those of the <A 215 HREF="r10944.htm" 216 ><CODE 217 CLASS="CONSTANT" 218 >VIDIOC_S_FMT</CODE 219 ></A 220 > ioctl 221 when the number of VBI lines the hardware can capture or output per 222 frame, or the number of services it can identify on a given line are 223 limited. For example on PAL line 16 the hardware may be able to look 224 for a VPS or Teletext signal, but not both at the same time.</P 225 ><P 226 >To determine the currently selected services applications 227 set the <CODE 228 CLASS="STRUCTFIELD" 229 >type </CODE 230 > field of struct <A 231 HREF="r10944.htm#V4L2-FORMAT" 232 >v4l2_format</A 233 > to 234 <CODE 235 CLASS="CONSTANT" 236 > V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</CODE 237 > or <CODE 238 CLASS="CONSTANT" 239 >V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</CODE 240 >, and the <A 241 HREF="r10944.htm" 242 ><CODE 243 CLASS="CONSTANT" 244 >VIDIOC_G_FMT</CODE 245 ></A 246 > 247 ioctl fills the <CODE 248 CLASS="STRUCTFIELD" 249 >fmt.sliced</CODE 250 > member, a 251 struct <A 252 HREF="x7236.htm#V4L2-SLICED-VBI-FORMAT" 253 >v4l2_sliced_vbi_format</A 254 >.</P 255 ><P 256 >Applications can request different parameters by 257 initializing or modifying the <CODE 258 CLASS="STRUCTFIELD" 259 >fmt.sliced</CODE 260 > 261 member and calling the <A 262 HREF="r10944.htm" 263 ><CODE 264 CLASS="CONSTANT" 265 >VIDIOC_S_FMT</CODE 266 ></A 267 > ioctl with a pointer to the 268 <CODE 269 CLASS="STRUCTNAME" 270 >v4l2_format</CODE 271 > structure.</P 272 ><P 273 >The sliced VBI API is more complicated than the raw VBI API 274 because the hardware must be told which VBI service to expect on each 275 scan line. Not all services may be supported by the hardware on all 276 lines (this is especially true for VBI output where Teletext is often 277 unsupported and other services can only be inserted in one specific 278 line). In many cases, however, it is sufficient to just set the 279 <CODE 280 CLASS="STRUCTFIELD" 281 >service_set</CODE 282 > field to the required services 283 and let the driver fill the <CODE 284 CLASS="STRUCTFIELD" 285 >service_lines</CODE 286 > 287 array according to hardware capabilities. Only if more precise control 288 is needed should the programmer set the 289 <CODE 290 CLASS="STRUCTFIELD" 291 >service_lines</CODE 292 > array explicitly.</P 293 ><P 294 >The <A 295 HREF="r10944.htm" 296 ><CODE 297 CLASS="CONSTANT" 298 >VIDIOC_S_FMT</CODE 299 ></A 300 > ioctl returns an <SPAN 301 CLASS="ERRORCODE" 302 >EINVAL</SPAN 303 > error code only when the 304 given parameters are ambiguous, otherwise it modifies the parameters 305 according to hardware capabilities. When the driver allocates 306 resources at this point, it may return an <SPAN 307 CLASS="ERRORCODE" 308 >EBUSY</SPAN 309 > error code if the required 310 resources are temporarily unavailable. Other resource allocation 311 points which may return <SPAN 312 CLASS="ERRORCODE" 313 >EBUSY</SPAN 314 > can be the 315 <A 316 HREF="r13817.htm" 317 ><CODE 318 CLASS="CONSTANT" 319 >VIDIOC_STREAMON</CODE 320 ></A 321 > ioctl and the first <A 322 HREF="r14264.htm" 323 ><CODE 324 CLASS="FUNCTION" 325 >read()</CODE 326 ></A 327 >, <A 328 HREF="r14496.htm" 329 ><CODE 330 CLASS="FUNCTION" 331 >write()</CODE 332 ></A 333 > and 334 <A 335 HREF="r14390.htm" 336 ><CODE 337 CLASS="FUNCTION" 338 >select()</CODE 339 ></A 340 > call.</P 341 ><DIV 342 CLASS="TABLE" 343 ><A 344 NAME="V4L2-SLICED-VBI-FORMAT" 345 ></A 346 ><P 347 ><B 348 >Table 4-6. struct 349 <CODE 350 CLASS="STRUCTNAME" 351 >v4l2_sliced_vbi_format</CODE 352 ></B 353 ></P 354 ><TABLE 355 BORDER="0" 356 FRAME="void" 357 WIDTH="100%" 358 CLASS="CALSTABLE" 359 ><COL 360 WIDTH="25%" 361 TITLE="C1"><COL 362 WIDTH="25%" 363 TITLE="C2"><COL 364 WIDTH="17%" 365 TITLE="C3"><COL 366 WIDTH="17%" 367 TITLE="C4"><COL 368 WIDTH="17%" 369 TITLE="C5"><TBODY 370 VALIGN="TOP" 371 ><TR 372 ><TD 373 >__u32</TD 374 ><TD 375 ><CODE 376 CLASS="STRUCTFIELD" 377 >service_set</CODE 378 ></TD 379 ><TD 380 COLSPAN="3" 381 ><P 382 >If 383 <CODE 384 CLASS="STRUCTFIELD" 385 >service_set</CODE 386 > is non-zero when passed with 387 <A 388 HREF="r10944.htm" 389 ><CODE 390 CLASS="CONSTANT" 391 >VIDIOC_S_FMT</CODE 392 ></A 393 > or <A 394 HREF="r10944.htm" 395 ><CODE 396 CLASS="CONSTANT" 397 >VIDIOC_TRY_FMT</CODE 398 ></A 399 >, the 400 <CODE 401 CLASS="STRUCTFIELD" 402 >service_lines</CODE 403 > array will be filled by the 404 driver according to the services specified in this field. For example, 405 if <CODE 406 CLASS="STRUCTFIELD" 407 >service_set</CODE 408 > is initialized with 409 <CODE 410 CLASS="CONSTANT" 411 >V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625</CODE 412 >, a 413 driver for the cx25840 video decoder sets lines 7-22 of both 414 fields<SUP 415 >a</SUP 416 > to <CODE 417 CLASS="CONSTANT" 418 >V4L2_SLICED_TELETEXT_B</CODE 419 > 420 and line 23 of the first field to 421 <CODE 422 CLASS="CONSTANT" 423 >V4L2_SLICED_WSS_625</CODE 424 >. If 425 <CODE 426 CLASS="STRUCTFIELD" 427 >service_set</CODE 428 > is set to zero, then the values 429 of <CODE 430 CLASS="STRUCTFIELD" 431 >service_lines</CODE 432 > will be used instead.</P 433 ><P 434 >On return the driver sets this field to the union of all 435 elements of the returned <CODE 436 CLASS="STRUCTFIELD" 437 >service_lines</CODE 438 > 439 array. It may contain less services than requested, perhaps just one, 440 if the hardware cannot handle more services simultaneously. It may be 441 empty (zero) if none of the requested services are supported by the 442 hardware.</P 443 ></TD 444 ></TR 445 ><TR 446 ><TD 447 >__u16</TD 448 ><TD 449 ><CODE 450 CLASS="STRUCTFIELD" 451 >service_lines</CODE 452 >[2][24]</TD 453 ><TD 454 COLSPAN="3" 455 ><P 456 >Applications initialize this 457 array with sets of data services the driver shall look for or insert 458 on the respective scan line. Subject to hardware capabilities drivers 459 return the requested set, a subset, which may be just a single 460 service, or an empty set. When the hardware cannot handle multiple 461 services on the same line the driver shall choose one. No assumptions 462 can be made on which service the driver chooses.</P 463 ><P 464 >Data 465 services are defined in <A 466 HREF="x7236.htm#VBI-SERVICES2" 467 >Table 4-7</A 468 >. Array indices 469 map to ITU-R line numbers (see also <A 470 HREF="x7013.htm#VBI-525" 471 >Figure 4-2</A 472 > and <A 473 HREF="x7013.htm#VBI-625" 474 >Figure 4-3</A 475 >) as follows: </P 476 ></TD 477 ></TR 478 ><TR 479 ><TD 480 > </TD 481 ><TD 482 > </TD 483 ><TD 484 >Element</TD 485 ><TD 486 >525 line systems</TD 487 ><TD 488 >625 line systems</TD 489 ></TR 490 ><TR 491 ><TD 492 > </TD 493 ><TD 494 > </TD 495 ><TD 496 ><CODE 497 CLASS="STRUCTFIELD" 498 >service_lines</CODE 499 >[0][1]</TD 500 ><TD 501 ALIGN="CENTER" 502 >1</TD 503 ><TD 504 ALIGN="CENTER" 505 >1</TD 506 ></TR 507 ><TR 508 ><TD 509 > </TD 510 ><TD 511 > </TD 512 ><TD 513 ><CODE 514 CLASS="STRUCTFIELD" 515 >service_lines</CODE 516 >[0][23]</TD 517 ><TD 518 ALIGN="CENTER" 519 >23</TD 520 ><TD 521 ALIGN="CENTER" 522 >23</TD 523 ></TR 524 ><TR 525 ><TD 526 > </TD 527 ><TD 528 > </TD 529 ><TD 530 ><CODE 531 CLASS="STRUCTFIELD" 532 >service_lines</CODE 533 >[1][1]</TD 534 ><TD 535 ALIGN="CENTER" 536 >264</TD 537 ><TD 538 ALIGN="CENTER" 539 >314</TD 540 ></TR 541 ><TR 542 ><TD 543 > </TD 544 ><TD 545 > </TD 546 ><TD 547 ><CODE 548 CLASS="STRUCTFIELD" 549 >service_lines</CODE 550 >[1][23]</TD 551 ><TD 552 ALIGN="CENTER" 553 >286</TD 554 ><TD 555 ALIGN="CENTER" 556 >336</TD 557 ></TR 558 ><TR 559 ><TD 560 > </TD 561 ><TD 562 > </TD 563 ><TD 564 COLSPAN="3" 565 >Drivers must set 566 <CODE 567 CLASS="STRUCTFIELD" 568 >service_lines</CODE 569 >[0][0] and 570 <CODE 571 CLASS="STRUCTFIELD" 572 >service_lines</CODE 573 >[1][0] to zero.</TD 574 ></TR 575 ><TR 576 ><TD 577 >__u32</TD 578 ><TD 579 ><CODE 580 CLASS="STRUCTFIELD" 581 >io_size</CODE 582 ></TD 583 ><TD 584 COLSPAN="3" 585 >Maximum number of bytes passed by 586 one <A 587 HREF="r14264.htm" 588 ><CODE 589 CLASS="FUNCTION" 590 >read()</CODE 591 ></A 592 > or <A 593 HREF="r14496.htm" 594 ><CODE 595 CLASS="FUNCTION" 596 >write()</CODE 597 ></A 598 > call, and the buffer size in bytes for 599 the <A 600 HREF="r12878.htm" 601 ><CODE 602 CLASS="CONSTANT" 603 >VIDIOC_QBUF</CODE 604 ></A 605 > and <A 606 HREF="r12878.htm" 607 ><CODE 608 CLASS="CONSTANT" 609 >VIDIOC_DQBUF</CODE 610 ></A 611 > ioctl. Drivers set this field to 612 the size of struct <A 613 HREF="x7236.htm#V4L2-SLICED-VBI-DATA" 614 >v4l2_sliced_vbi_data</A 615 > times the number of non-zero 616 elements in the returned <CODE 617 CLASS="STRUCTFIELD" 618 >service_lines</CODE 619 > 620 array (that is the number of lines potentially carrying data).</TD 621 ></TR 622 ><TR 623 ><TD 624 >__u32</TD 625 ><TD 626 ><CODE 627 CLASS="STRUCTFIELD" 628 >reserved</CODE 629 >[2]</TD 630 ><TD 631 COLSPAN="3" 632 >This array is reserved for future 633 extensions. Applications and drivers must set it to zero.</TD 634 ></TR 635 ></TBODY 636 ><TR 637 ><TD 638 COLSPAN="5" 639 >Notes:<BR><A 640 NAME="FTN.AEN7329" 641 >a. </A 642 >According to <A 643 HREF="b17127.htm#ETS300706" 644 >ETS 300 706</A 645 > lines 6-22 of the 646 first field and lines 5-22 of the second field may carry Teletext 647 data.<BR></TD 648 ></TR 649 ></TABLE 650 ></DIV 651 ><DIV 652 CLASS="TABLE" 653 ><A 654 NAME="VBI-SERVICES2" 655 ></A 656 ><P 657 ><B 658 >Table 4-7. Sliced VBI services</B 659 ></P 660 ><TABLE 661 BORDER="0" 662 FRAME="void" 663 WIDTH="100%" 664 CLASS="CALSTABLE" 665 ><COL 666 WIDTH="25%" 667 TITLE="C1"><COL 668 WIDTH="12%" 669 TITLE="C2"><COL 670 WIDTH="12%" 671 TITLE="C3"><COL 672 WIDTH="25%" 673 TITLE="C4"><COL 674 WIDTH="25%" 675 TITLE="C5"><THEAD 676 ><TR 677 ><TH 678 >Symbol</TH 679 ><TH 680 >Value</TH 681 ><TH 682 >Reference</TH 683 ><TH 684 >Lines, usually</TH 685 ><TH 686 >Payload</TH 687 ></TR 688 ></THEAD 689 ><TBODY 690 VALIGN="TOP" 691 ><TR 692 ><TD 693 ><CODE 694 CLASS="CONSTANT" 695 >V4L2_SLICED_TELETEXT_B</CODE 696 > 697 (Teletext System B)</TD 698 ><TD 699 >0x0001</TD 700 ><TD 701 ><A 702 HREF="b17127.htm#ETS300706" 703 ><ABBR 704 CLASS="ABBREV" 705 >ETS 300 706</ABBR 706 ></A 707 >, <A 708 HREF="b17127.htm#ITU653" 709 ><ABBR 710 CLASS="ABBREV" 711 >ITU BT.653</ABBR 712 ></A 713 ></TD 714 ><TD 715 >PAL/SECAM line 7-22, 320-335 (second field 7-22)</TD 716 ><TD 717 >Last 42 of the 45 byte Teletext packet, that is 718 without clock run-in and framing code, lsb first transmitted.</TD 719 ></TR 720 ><TR 721 ><TD 722 ><CODE 723 CLASS="CONSTANT" 724 >V4L2_SLICED_VPS</CODE 725 ></TD 726 ><TD 727 >0x0400</TD 728 ><TD 729 ><A 730 HREF="b17127.htm#ETS300231" 731 ><ABBR 732 CLASS="ABBREV" 733 >ETS 300 231</ABBR 734 ></A 735 ></TD 736 ><TD 737 >PAL line 16</TD 738 ><TD 739 >Byte number 3 to 15 according to Figure 9 of 740 ETS 300 231, lsb first transmitted.</TD 741 ></TR 742 ><TR 743 ><TD 744 ><CODE 745 CLASS="CONSTANT" 746 >V4L2_SLICED_CAPTION_525</CODE 747 ></TD 748 ><TD 749 >0x1000</TD 750 ><TD 751 ><A 752 HREF="b17127.htm#EIA608" 753 ><ABBR 754 CLASS="ABBREV" 755 >EIA 608-B</ABBR 756 ></A 757 ></TD 758 ><TD 759 >NTSC line 21, 284 (second field 21)</TD 760 ><TD 761 >Two bytes in transmission order, including parity 762 bit, lsb first transmitted.</TD 763 ></TR 764 ><TR 765 ><TD 766 ><CODE 767 CLASS="CONSTANT" 768 >V4L2_SLICED_WSS_625</CODE 769 ></TD 770 ><TD 771 >0x4000</TD 772 ><TD 773 ><A 774 HREF="b17127.htm#ITU1119" 775 ><ABBR 776 CLASS="ABBREV" 777 >ITU BT.1119</ABBR 778 ></A 779 >, <A 780 HREF="b17127.htm#EN300294" 781 ><ABBR 782 CLASS="ABBREV" 783 >EN 300 294</ABBR 784 ></A 785 ></TD 786 ><TD 787 >PAL/SECAM line 23</TD 788 ><TD 789 ><PRE 790 CLASS="SCREEN" 791 >Byte 0 1 792 msb lsb msb lsb 793 Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9</PRE 794 ></TD 795 ></TR 796 ><TR 797 ><TD 798 ><CODE 799 CLASS="CONSTANT" 800 >V4L2_SLICED_VBI_525</CODE 801 ></TD 802 ><TD 803 >0x1000</TD 804 ><TD 805 COLSPAN="3" 806 >Set of services applicable to 525 807 line systems.</TD 808 ></TR 809 ><TR 810 ><TD 811 ><CODE 812 CLASS="CONSTANT" 813 >V4L2_SLICED_VBI_625</CODE 814 ></TD 815 ><TD 816 >0x4401</TD 817 ><TD 818 COLSPAN="3" 819 >Set of services applicable to 625 820 line systems.</TD 821 ></TR 822 ></TBODY 823 ></TABLE 824 ></DIV 825 ><P 826 >Drivers may return an <SPAN 827 CLASS="ERRORCODE" 828 >EINVAL</SPAN 829 > error code when applications attempt to 830 read or write data without prior format negotiation, after switching 831 the video standard (which may invalidate the negotiated VBI 832 parameters) and after switching the video input (which may change the 833 video standard as a side effect). The <A 834 HREF="r10944.htm" 835 ><CODE 836 CLASS="CONSTANT" 837 >VIDIOC_S_FMT</CODE 838 ></A 839 > ioctl may return 840 an <SPAN 841 CLASS="ERRORCODE" 842 >EBUSY</SPAN 843 > error code when applications attempt to change the format while i/o is 844 in progress (between a <A 845 HREF="r13817.htm" 846 ><CODE 847 CLASS="CONSTANT" 848 >VIDIOC_STREAMON</CODE 849 ></A 850 > and <A 851 HREF="r13817.htm" 852 ><CODE 853 CLASS="CONSTANT" 854 >VIDIOC_STREAMOFF</CODE 855 ></A 856 > call, 857 and after the first <A 858 HREF="r14264.htm" 859 ><CODE 860 CLASS="FUNCTION" 861 >read()</CODE 862 ></A 863 > or <A 864 HREF="r14496.htm" 865 ><CODE 866 CLASS="FUNCTION" 867 >write()</CODE 868 ></A 869 > call).</P 870 ></DIV 871 ><DIV 872 CLASS="SECTION" 873 ><H2 874 CLASS="SECTION" 875 ><A 876 NAME="AEN7483" 877 >4.8.4. Reading and writing sliced VBI data</A 878 ></H2 879 ><P 880 >A single <A 881 HREF="r14264.htm" 882 ><CODE 883 CLASS="FUNCTION" 884 >read()</CODE 885 ></A 886 > or <A 887 HREF="r14496.htm" 888 ><CODE 889 CLASS="FUNCTION" 890 >write()</CODE 891 ></A 892 > call must pass all data 893 belonging to one video frame. That is an array of 894 <CODE 895 CLASS="STRUCTNAME" 896 >v4l2_sliced_vbi_data</CODE 897 > structures with one or 898 more elements and a total size not exceeding 899 <CODE 900 CLASS="STRUCTFIELD" 901 >io_size</CODE 902 > bytes. Likewise in streaming I/O 903 mode one buffer of <CODE 904 CLASS="STRUCTFIELD" 905 >io_size</CODE 906 > bytes must 907 contain data of one video frame. The <CODE 908 CLASS="STRUCTFIELD" 909 >id</CODE 910 > of 911 unused <CODE 912 CLASS="STRUCTNAME" 913 >v4l2_sliced_vbi_data</CODE 914 > elements must be 915 zero.</P 916 ><DIV 917 CLASS="TABLE" 918 ><A 919 NAME="V4L2-SLICED-VBI-DATA" 920 ></A 921 ><P 922 ><B 923 >Table 4-8. struct 924 <CODE 925 CLASS="STRUCTNAME" 926 >v4l2_sliced_vbi_data</CODE 927 ></B 928 ></P 929 ><TABLE 930 BORDER="0" 931 FRAME="void" 932 WIDTH="100%" 933 CLASS="CALSTABLE" 934 ><COL 935 WIDTH="38%" 936 TITLE="C1"><COL 937 WIDTH="12%" 938 TITLE="C2"><COL 939 WIDTH="50%" 940 TITLE="C3"><TBODY 941 VALIGN="TOP" 942 ><TR 943 ><TD 944 >__u32</TD 945 ><TD 946 ><CODE 947 CLASS="STRUCTFIELD" 948 >id</CODE 949 ></TD 950 ><TD 951 >A flag from <A 952 HREF="r12051.htm#VBI-SERVICES" 953 >Table 2</A 954 > 955 identifying the type of data in this packet. Only a single bit must be 956 set. When the <CODE 957 CLASS="STRUCTFIELD" 958 >id</CODE 959 > of a captured packet is 960 zero, the packet is empty and the contents of other fields are 961 undefined. Applications shall ignore empty packets. When the 962 <CODE 963 CLASS="STRUCTFIELD" 964 >id</CODE 965 > of a packet for output is zero the 966 contents of the <CODE 967 CLASS="STRUCTFIELD" 968 >data</CODE 969 > field are undefined 970 and the driver must no longer insert data on the requested 971 <CODE 972 CLASS="STRUCTFIELD" 973 >field</CODE 974 > and 975 <CODE 976 CLASS="STRUCTFIELD" 977 >line</CODE 978 >.</TD 979 ></TR 980 ><TR 981 ><TD 982 >__u32</TD 983 ><TD 984 ><CODE 985 CLASS="STRUCTFIELD" 986 >field</CODE 987 ></TD 988 ><TD 989 >The video field number this data has been captured 990 from, or shall be inserted at. <CODE 991 CLASS="CONSTANT" 992 >0</CODE 993 > for the first 994 field, <CODE 995 CLASS="CONSTANT" 996 >1</CODE 997 > for the second field.</TD 998 ></TR 999 ><TR 1000 ><TD 1001 >__u32</TD 1002 ><TD 1003 ><CODE 1004 CLASS="STRUCTFIELD" 1005 >line</CODE 1006 ></TD 1007 ><TD 1008 >The field (as opposed to frame) line number this 1009 data has been captured from, or shall be inserted at. See <A 1010 HREF="x7013.htm#VBI-525" 1011 >Figure 4-2</A 1012 > and <A 1013 HREF="x7013.htm#VBI-625" 1014 >Figure 4-3</A 1015 > for valid 1016 values. Sliced VBI capture devices can set the line number of all 1017 packets to <CODE 1018 CLASS="CONSTANT" 1019 >0</CODE 1020 > if the hardware cannot reliably 1021 identify scan lines. The field number must always be valid.</TD 1022 ></TR 1023 ><TR 1024 ><TD 1025 >__u32</TD 1026 ><TD 1027 ><CODE 1028 CLASS="STRUCTFIELD" 1029 >reserved</CODE 1030 ></TD 1031 ><TD 1032 >This field is reserved for future extensions. 1033 Applications and drivers must set it to zero.</TD 1034 ></TR 1035 ><TR 1036 ><TD 1037 >__u8</TD 1038 ><TD 1039 ><CODE 1040 CLASS="STRUCTFIELD" 1041 >data</CODE 1042 >[48]</TD 1043 ><TD 1044 >The packet payload. See <A 1045 HREF="r12051.htm#VBI-SERVICES" 1046 >Table 2</A 1047 > for the contents and number of 1048 bytes passed for each data type. The contents of padding bytes at the 1049 end of this array are undefined, drivers and applications shall ignore 1050 them.</TD 1051 ></TR 1052 ></TBODY 1053 ></TABLE 1054 ></DIV 1055 ><P 1056 >Packets are always passed in ascending line number order, 1057 without duplicate line numbers. The <A 1058 HREF="r14496.htm" 1059 ><CODE 1060 CLASS="FUNCTION" 1061 >write()</CODE 1062 ></A 1063 > function and the 1064 <A 1065 HREF="r12878.htm" 1066 ><CODE 1067 CLASS="CONSTANT" 1068 >VIDIOC_QBUF</CODE 1069 ></A 1070 > ioctl must return an <SPAN 1071 CLASS="ERRORCODE" 1072 >EINVAL</SPAN 1073 > error code when applications violate 1074 this rule. They must also return an <SPAN 1075 CLASS="ERRORCODE" 1076 >EINVAL</SPAN 1077 > error code when applications pass an 1078 incorrect field or line number, or a combination of 1079 <CODE 1080 CLASS="STRUCTFIELD" 1081 >field</CODE 1082 >, <CODE 1083 CLASS="STRUCTFIELD" 1084 >line</CODE 1085 > and 1086 <CODE 1087 CLASS="STRUCTFIELD" 1088 >id</CODE 1089 > which has not been negotiated with the 1090 <A 1091 HREF="r10944.htm" 1092 ><CODE 1093 CLASS="CONSTANT" 1094 >VIDIOC_G_FMT</CODE 1095 ></A 1096 > or <A 1097 HREF="r10944.htm" 1098 ><CODE 1099 CLASS="CONSTANT" 1100 >VIDIOC_S_FMT</CODE 1101 ></A 1102 > ioctl. When the line numbers are 1103 unknown the driver must pass the packets in transmitted order. The 1104 driver can insert empty packets with <CODE 1105 CLASS="STRUCTFIELD" 1106 >id</CODE 1107 > set 1108 to zero anywhere in the packet array.</P 1109 ><P 1110 >To assure synchronization and to distinguish from frame 1111 dropping, when a captured frame does not carry any of the requested 1112 data services drivers must pass one or more empty packets. When an 1113 application fails to pass VBI data in time for output, the driver 1114 must output the last VPS and WSS packet again, and disable the output 1115 of Closed Caption and Teletext data, or output data which is ignored 1116 by Closed Caption and Teletext decoders.</P 1117 ><P 1118 >A sliced VBI device may support <A 1119 HREF="c5742.htm#RW" 1120 >read/write</A 1121 > and/or streaming (<A 1122 HREF="x5791.htm" 1123 >memory mapping</A 1124 > and/or <A 1125 HREF="x5884.htm" 1126 >user 1127 pointer</A 1128 >) I/O. The latter bears the possibility of synchronizing 1129 video and VBI data by using buffer timestamps.</P 1130 ></DIV 1131 ></DIV 1132 ><DIV 1133 CLASS="NAVFOOTER" 1134 ><HR 1135 ALIGN="LEFT" 1136 WIDTH="100%"><TABLE 1137 SUMMARY="Footer navigation table" 1138 WIDTH="100%" 1139 BORDER="0" 1140 CELLPADDING="0" 1141 CELLSPACING="0" 1142 ><TR 1143 ><TD 1144 WIDTH="33%" 1145 ALIGN="left" 1146 VALIGN="top" 1147 ><A 1148 HREF="x7013.htm" 1149 ACCESSKEY="P" 1150 >Prev</A 1151 ></TD 1152 ><TD 1153 WIDTH="34%" 1154 ALIGN="center" 1155 VALIGN="top" 1156 ><A 1157 HREF="book1.htm" 1158 ACCESSKEY="H" 1159 >Home</A 1160 ></TD 1161 ><TD 1162 WIDTH="33%" 1163 ALIGN="right" 1164 VALIGN="top" 1165 ><A 1166 HREF="x7561.htm" 1167 ACCESSKEY="N" 1168 >Next</A 1169 ></TD 1170 ></TR 1171 ><TR 1172 ><TD 1173 WIDTH="33%" 1174 ALIGN="left" 1175 VALIGN="top" 1176 >Raw VBI Data Interface</TD 1177 ><TD 1178 WIDTH="34%" 1179 ALIGN="center" 1180 VALIGN="top" 1181 ><A 1182 HREF="c6488.htm" 1183 ACCESSKEY="U" 1184 >Up</A 1185 ></TD 1186 ><TD 1187 WIDTH="33%" 1188 ALIGN="right" 1189 VALIGN="top" 1190 >Teletext Interface</TD 1191 ></TR 1192 ></TABLE 1193 ></DIV 1194 ></BODY 1195 ></HTML 1196 > 1197