Home | History | Annotate | Download | only in spec
      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 >Raw 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="Effect Devices Interface"
     17 HREF="x7002.htm"><LINK
     18 REL="NEXT"
     19 TITLE="Sliced VBI Data Interface"
     20 HREF="x7236.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="x7002.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="x7236.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="RAW-VBI"
     77 >4.7. Raw VBI Data Interface</A
     78 ></H1
     79 ><P
     80 >VBI is an abbreviation of Vertical Blanking Interval, a gap
     81 in the sequence of lines of an analog video signal. During VBI
     82 no picture information is transmitted, allowing some time while the
     83 electron beam of a cathode ray tube TV returns to the top of the
     84 screen. Using an oscilloscope you will find here the vertical
     85 synchronization pulses and short data packages ASK
     86 modulated<A
     87 NAME="AEN7016"
     88 HREF="x7013.htm#FTN.AEN7016"
     89 ><SPAN
     90 CLASS="footnote"
     91 >[1]</SPAN
     92 ></A
     93 >
     94 onto the video signal. These are transmissions of services such as
     95 Teletext or Closed Caption.</P
     96 ><P
     97 >Subject of this interface type is raw VBI data, as sampled off
     98 a video signal, or to be added to a signal for output.
     99 The data format is similar to uncompressed video images, a number of
    100 lines times a number of samples per line, we call this a VBI image.</P
    101 ><P
    102 >Conventionally V4L2 VBI devices are accessed through character
    103 device special files named <TT
    104 CLASS="FILENAME"
    105 >/dev/vbi</TT
    106 > and
    107 <TT
    108 CLASS="FILENAME"
    109 >/dev/vbi0</TT
    110 > to <TT
    111 CLASS="FILENAME"
    112 >/dev/vbi31</TT
    113 > with
    114 major number 81 and minor numbers 224 to 255.
    115 <TT
    116 CLASS="FILENAME"
    117 >/dev/vbi</TT
    118 > is typically a symbolic link to the
    119 preferred VBI device. This convention applies to both input and output
    120 devices.</P
    121 ><P
    122 >To address the problems of finding related video and VBI
    123 devices VBI capturing and output is also available as device function
    124 under <TT
    125 CLASS="FILENAME"
    126 >/dev/video</TT
    127 >. To capture or output raw VBI
    128 data with these devices applications must call the <A
    129 HREF="r10944.htm"
    130 ><CODE
    131 CLASS="CONSTANT"
    132 >VIDIOC_S_FMT</CODE
    133 ></A
    134 >
    135 ioctl. Accessed as <TT
    136 CLASS="FILENAME"
    137 >/dev/vbi</TT
    138 >, raw VBI capturing
    139 or output is the default device function.</P
    140 ><DIV
    141 CLASS="SECTION"
    142 ><H2
    143 CLASS="SECTION"
    144 ><A
    145 NAME="AEN7029"
    146 >4.7.1. Querying Capabilities</A
    147 ></H2
    148 ><P
    149 >Devices supporting the raw VBI capturing or output API set
    150 the <CODE
    151 CLASS="CONSTANT"
    152 >V4L2_CAP_VBI_CAPTURE</CODE
    153 > or
    154 <CODE
    155 CLASS="CONSTANT"
    156 >V4L2_CAP_VBI_OUTPUT</CODE
    157 > flags, respectively, in the
    158 <CODE
    159 CLASS="STRUCTFIELD"
    160 >capabilities</CODE
    161 > field of struct&nbsp;<A
    162 HREF="r13105.htm#V4L2-CAPABILITY"
    163 >v4l2_capability</A
    164 >
    165 returned by the <A
    166 HREF="r13105.htm"
    167 ><CODE
    168 CLASS="CONSTANT"
    169 >VIDIOC_QUERYCAP</CODE
    170 ></A
    171 > ioctl. At least one of the
    172 read/write, streaming or asynchronous I/O methods must be
    173 supported. VBI devices may or may not have a tuner or modulator.</P
    174 ></DIV
    175 ><DIV
    176 CLASS="SECTION"
    177 ><H2
    178 CLASS="SECTION"
    179 ><A
    180 NAME="AEN7038"
    181 >4.7.2. Supplemental Functions</A
    182 ></H2
    183 ><P
    184 >VBI devices shall support <A
    185 HREF="x309.htm"
    186 >video
    187 input or output</A
    188 >, <A
    189 HREF="x394.htm"
    190 >tuner or
    191 modulator</A
    192 >, and <A
    193 HREF="x542.htm"
    194 >controls</A
    195 > ioctls
    196 as needed. The <A
    197 HREF="x448.htm"
    198 >video standard</A
    199 > ioctls provide
    200 information vital to program a VBI device, therefore must be
    201 supported.</P
    202 ></DIV
    203 ><DIV
    204 CLASS="SECTION"
    205 ><H2
    206 CLASS="SECTION"
    207 ><A
    208 NAME="AEN7045"
    209 >4.7.3. Raw VBI Format Negotiation</A
    210 ></H2
    211 ><P
    212 >Raw VBI sampling abilities can vary, in particular the
    213 sampling frequency. To properly interpret the data V4L2 specifies an
    214 ioctl to query the sampling parameters. Moreover, to allow for some
    215 flexibility applications can also suggest different parameters.</P
    216 ><P
    217 >As usual these parameters are <SPAN
    218 CLASS="emphasis"
    219 ><I
    220 CLASS="EMPHASIS"
    221 >not</I
    222 ></SPAN
    223 >
    224 reset at <A
    225 HREF="r14090.htm"
    226 ><CODE
    227 CLASS="FUNCTION"
    228 >open()</CODE
    229 ></A
    230 > time to permit Unix tool chains, programming a
    231 device and then reading from it as if it was a plain file. Well
    232 written V4L2 applications should always ensure they really get what
    233 they want, requesting reasonable parameters and then checking if the
    234 actual parameters are suitable.</P
    235 ><P
    236 >To query the current raw VBI capture parameters
    237 applications set the <CODE
    238 CLASS="STRUCTFIELD"
    239 >type</CODE
    240 > field of a
    241 struct&nbsp;<A
    242 HREF="r10944.htm#V4L2-FORMAT"
    243 >v4l2_format</A
    244 > to <CODE
    245 CLASS="CONSTANT"
    246 >V4L2_BUF_TYPE_VBI_CAPTURE</CODE
    247 > or
    248 <CODE
    249 CLASS="CONSTANT"
    250 >V4L2_BUF_TYPE_VBI_OUTPUT</CODE
    251 >, and call the
    252 <A
    253 HREF="r10944.htm"
    254 ><CODE
    255 CLASS="CONSTANT"
    256 >VIDIOC_G_FMT</CODE
    257 ></A
    258 > ioctl with a pointer to this structure. Drivers fill
    259 the struct&nbsp;<A
    260 HREF="x7013.htm#V4L2-VBI-FORMAT"
    261 >v4l2_vbi_format</A
    262 > <CODE
    263 CLASS="STRUCTFIELD"
    264 >vbi</CODE
    265 > member of the
    266 <CODE
    267 CLASS="STRUCTFIELD"
    268 >fmt</CODE
    269 > union.</P
    270 ><P
    271 >To request different parameters applications set the
    272 <CODE
    273 CLASS="STRUCTFIELD"
    274 >type</CODE
    275 > field of a struct&nbsp;<A
    276 HREF="r10944.htm#V4L2-FORMAT"
    277 >v4l2_format</A
    278 > as above and
    279 initialize all fields of the struct&nbsp;<A
    280 HREF="x7013.htm#V4L2-VBI-FORMAT"
    281 >v4l2_vbi_format</A
    282 >
    283 <CODE
    284 CLASS="STRUCTFIELD"
    285 >vbi</CODE
    286 > member of the
    287 <CODE
    288 CLASS="STRUCTFIELD"
    289 >fmt</CODE
    290 > union, or better just modify the
    291 results of <CODE
    292 CLASS="CONSTANT"
    293 >VIDIOC_G_FMT</CODE
    294 >, and call the
    295 <A
    296 HREF="r10944.htm"
    297 ><CODE
    298 CLASS="CONSTANT"
    299 >VIDIOC_S_FMT</CODE
    300 ></A
    301 > ioctl with a pointer to this structure. Drivers return
    302 an <SPAN
    303 CLASS="ERRORCODE"
    304 >EINVAL</SPAN
    305 > error code only when the given parameters are ambiguous, otherwise
    306 they modify the parameters according to the hardware capabilites and
    307 return the actual parameters. When the driver allocates resources at
    308 this point, it may return an <SPAN
    309 CLASS="ERRORCODE"
    310 >EBUSY</SPAN
    311 > error code to indicate the returned
    312 parameters are valid but the required resources are currently not
    313 available. That may happen for instance when the video and VBI areas
    314 to capture would overlap, or when the driver supports multiple opens
    315 and another process already requested VBI capturing or output. Anyway,
    316 applications must expect other resource allocation points which may
    317 return <SPAN
    318 CLASS="ERRORCODE"
    319 >EBUSY</SPAN
    320 >, at the <A
    321 HREF="r13817.htm"
    322 ><CODE
    323 CLASS="CONSTANT"
    324 >VIDIOC_STREAMON</CODE
    325 ></A
    326 > ioctl
    327 and the first read(), write() and select() call.</P
    328 ><P
    329 >VBI devices must implement both the
    330 <CODE
    331 CLASS="CONSTANT"
    332 >VIDIOC_G_FMT</CODE
    333 > and
    334 <CODE
    335 CLASS="CONSTANT"
    336 >VIDIOC_S_FMT</CODE
    337 > ioctl, even if
    338 <CODE
    339 CLASS="CONSTANT"
    340 >VIDIOC_S_FMT</CODE
    341 > ignores all requests and always
    342 returns default parameters as <CODE
    343 CLASS="CONSTANT"
    344 >VIDIOC_G_FMT</CODE
    345 > does.
    346 <CODE
    347 CLASS="CONSTANT"
    348 >VIDIOC_TRY_FMT</CODE
    349 > is optional.</P
    350 ><DIV
    351 CLASS="TABLE"
    352 ><A
    353 NAME="V4L2-VBI-FORMAT"
    354 ></A
    355 ><P
    356 ><B
    357 >Table 4-4. struct <CODE
    358 CLASS="STRUCTNAME"
    359 >v4l2_vbi_format</CODE
    360 ></B
    361 ></P
    362 ><TABLE
    363 BORDER="0"
    364 FRAME="void"
    365 WIDTH="100%"
    366 CLASS="CALSTABLE"
    367 ><COL
    368 WIDTH="25%"
    369 TITLE="C1"><COL
    370 WIDTH="25%"
    371 TITLE="C2"><COL
    372 WIDTH="50%"
    373 TITLE="C3"><TBODY
    374 VALIGN="TOP"
    375 ><TR
    376 ><TD
    377 >__u32</TD
    378 ><TD
    379 ><CODE
    380 CLASS="STRUCTFIELD"
    381 >sampling_rate</CODE
    382 ></TD
    383 ><TD
    384 >Samples per second, i.&nbsp;e. unit 1 Hz.</TD
    385 ></TR
    386 ><TR
    387 ><TD
    388 >__u32</TD
    389 ><TD
    390 ><CODE
    391 CLASS="STRUCTFIELD"
    392 >offset</CODE
    393 ></TD
    394 ><TD
    395 ><P
    396 >Horizontal offset of the VBI image,
    397 relative to the leading edge of the line synchronization pulse and
    398 counted in samples: The first sample in the VBI image will be located
    399 <CODE
    400 CLASS="STRUCTFIELD"
    401 >offset</CODE
    402 > /
    403 <CODE
    404 CLASS="STRUCTFIELD"
    405 >sampling_rate</CODE
    406 > seconds following the leading
    407 edge. See also <A
    408 HREF="x7013.htm#VBI-HSYNC"
    409 >Figure 4-1</A
    410 >.</P
    411 ></TD
    412 ></TR
    413 ><TR
    414 ><TD
    415 >__u32</TD
    416 ><TD
    417 ><CODE
    418 CLASS="STRUCTFIELD"
    419 >samples_per_line</CODE
    420 ></TD
    421 ><TD
    422 >&nbsp;</TD
    423 ></TR
    424 ><TR
    425 ><TD
    426 >__u32</TD
    427 ><TD
    428 ><CODE
    429 CLASS="STRUCTFIELD"
    430 >sample_format</CODE
    431 ></TD
    432 ><TD
    433 ><P
    434 >Defines the sample format as in <A
    435 HREF="c2030.htm"
    436 >Chapter 2</A
    437 >, a four-character-code.<SUP
    438 >a</SUP
    439 > Usually this is
    440 <CODE
    441 CLASS="CONSTANT"
    442 >V4L2_PIX_FMT_GREY</CODE
    443 >, i.&nbsp;e. each sample
    444 consists of 8 bits with lower values oriented towards the black level.
    445 Do not assume any other correlation of values with the signal level.
    446 For example, the MSB does not necessarily indicate if the signal is
    447 'high' or 'low' because 128 may not be the mean value of the
    448 signal. Drivers shall not convert the sample format by software.</P
    449 ></TD
    450 ></TR
    451 ><TR
    452 ><TD
    453 >__u32</TD
    454 ><TD
    455 ><CODE
    456 CLASS="STRUCTFIELD"
    457 >start</CODE
    458 >[2]</TD
    459 ><TD
    460 >This is the scanning system line number
    461 associated with the first line of the VBI image, of the first and the
    462 second field respectively. See <A
    463 HREF="x7013.htm#VBI-525"
    464 >Figure 4-2</A
    465 > and
    466 <A
    467 HREF="x7013.htm#VBI-625"
    468 >Figure 4-3</A
    469 > for valid values. VBI input drivers can
    470 return start values 0 if the hardware cannot reliable identify
    471 scanning lines, VBI acquisition may not require this
    472 information.</TD
    473 ></TR
    474 ><TR
    475 ><TD
    476 >__u32</TD
    477 ><TD
    478 ><CODE
    479 CLASS="STRUCTFIELD"
    480 >count</CODE
    481 >[2]</TD
    482 ><TD
    483 >The number of lines in the first and second
    484 field image, respectively.</TD
    485 ></TR
    486 ><TR
    487 ><TD
    488 COLSPAN="3"
    489 ><P
    490 >Drivers should be as
    491 flexibility as possible. For example, it may be possible to extend or
    492 move the VBI capture window down to the picture area, implementing a
    493 'full field mode' to capture data service transmissions embedded in
    494 the picture.</P
    495 ><P
    496 >An application can set the first or second
    497 <CODE
    498 CLASS="STRUCTFIELD"
    499 >count</CODE
    500 > value to zero if no data is required
    501 from the respective field; <CODE
    502 CLASS="STRUCTFIELD"
    503 >count</CODE
    504 >[1] if the
    505 scanning system is progressive, i.&nbsp;e. not interlaced. The
    506 corresponding start value shall be ignored by the application and
    507 driver. Anyway, drivers may not support single field capturing and
    508 return both count values non-zero.</P
    509 ><P
    510 >Both
    511 <CODE
    512 CLASS="STRUCTFIELD"
    513 >count</CODE
    514 > values set to zero, or line numbers
    515 outside the bounds depicted in <A
    516 HREF="x7013.htm#VBI-525"
    517 >Figure 4-2</A
    518 > and <A
    519 HREF="x7013.htm#VBI-625"
    520 >Figure 4-3</A
    521 >, or a field image covering
    522 lines of two fields, are invalid and shall not be returned by the
    523 driver.</P
    524 ><P
    525 >To initialize the <CODE
    526 CLASS="STRUCTFIELD"
    527 >start</CODE
    528 >
    529 and <CODE
    530 CLASS="STRUCTFIELD"
    531 >count</CODE
    532 > fields, applications must first
    533 determine the current video standard selection. The <A
    534 HREF="r9288.htm#V4L2-STD-ID"
    535 >v4l2_std_id</A
    536 > or
    537 the <CODE
    538 CLASS="STRUCTFIELD"
    539 >framelines</CODE
    540 > field of struct&nbsp;<A
    541 HREF="r9288.htm#V4L2-STANDARD"
    542 >v4l2_standard</A
    543 > can
    544 be evaluated for this purpose.</P
    545 ></TD
    546 ></TR
    547 ><TR
    548 ><TD
    549 >__u32</TD
    550 ><TD
    551 ><CODE
    552 CLASS="STRUCTFIELD"
    553 >flags</CODE
    554 ></TD
    555 ><TD
    556 >See <A
    557 HREF="x7013.htm#VBIFMT-FLAGS"
    558 >Table 4-5</A
    559 > below. Currently
    560 only drivers set flags, applications must set this field to
    561 zero.</TD
    562 ></TR
    563 ><TR
    564 ><TD
    565 >__u32</TD
    566 ><TD
    567 ><CODE
    568 CLASS="STRUCTFIELD"
    569 >reserved</CODE
    570 >[2]</TD
    571 ><TD
    572 >This array is reserved for future extensions.
    573 Drivers and applications must set it to zero.</TD
    574 ></TR
    575 ></TBODY
    576 ><TR
    577 ><TD
    578 COLSPAN="3"
    579 >Notes:<BR><A
    580 NAME="FTN.AEN7117"
    581 >a. </A
    582 >A few devices may be unable to
    583 sample VBI data at all but can extend the video capture window to the
    584 VBI region.<BR></TD
    585 ></TR
    586 ></TABLE
    587 ></DIV
    588 ><DIV
    589 CLASS="TABLE"
    590 ><A
    591 NAME="VBIFMT-FLAGS"
    592 ></A
    593 ><P
    594 ><B
    595 >Table 4-5. Raw VBI Format Flags</B
    596 ></P
    597 ><TABLE
    598 BORDER="0"
    599 FRAME="void"
    600 WIDTH="100%"
    601 CLASS="CALSTABLE"
    602 ><COL
    603 WIDTH="38%"
    604 TITLE="C1"><COL
    605 WIDTH="12%"
    606 TITLE="C2"><COL
    607 WIDTH="50%"
    608 TITLE="C3"><TBODY
    609 VALIGN="TOP"
    610 ><TR
    611 ><TD
    612 ><CODE
    613 CLASS="CONSTANT"
    614 >V4L2_VBI_UNSYNC</CODE
    615 ></TD
    616 ><TD
    617 >0x0001</TD
    618 ><TD
    619 ><P
    620 >This flag indicates hardware which does not
    621 properly distinguish between fields. Normally the VBI image stores the
    622 first field (lower scanning line numbers) first in memory. This may be
    623 a top or bottom field depending on the video standard. When this flag
    624 is set the first or second field may be stored first, however the
    625 fields are still in correct temporal order with the older field first
    626 in memory.<SUP
    627 >a</SUP
    628 ></P
    629 ></TD
    630 ></TR
    631 ><TR
    632 ><TD
    633 ><CODE
    634 CLASS="CONSTANT"
    635 >V4L2_VBI_INTERLACED</CODE
    636 ></TD
    637 ><TD
    638 >0x0002</TD
    639 ><TD
    640 >By default the two field images will be passed
    641 sequentially; all lines of the first field followed by all lines of
    642 the second field (compare <A
    643 HREF="x6386.htm"
    644 >Section 3.6</A
    645 >
    646 <CODE
    647 CLASS="CONSTANT"
    648 >V4L2_FIELD_SEQ_TB</CODE
    649 > and
    650 <CODE
    651 CLASS="CONSTANT"
    652 >V4L2_FIELD_SEQ_BT</CODE
    653 >, whether the top or bottom
    654 field is first in memory depends on the video standard). When this
    655 flag is set, the two fields are interlaced (cf.
    656 <CODE
    657 CLASS="CONSTANT"
    658 >V4L2_FIELD_INTERLACED</CODE
    659 >). The first line of the
    660 first field followed by the first line of the second field, then the
    661 two second lines, and so on. Such a layout may be necessary when the
    662 hardware has been programmed to capture or output interlaced video
    663 images and is unable to separate the fields for VBI capturing at
    664 the same time. For simplicity setting this flag implies that both
    665 <CODE
    666 CLASS="STRUCTFIELD"
    667 >count</CODE
    668 > values are equal and non-zero.</TD
    669 ></TR
    670 ></TBODY
    671 ><TR
    672 ><TD
    673 COLSPAN="3"
    674 >Notes:<BR><A
    675 NAME="FTN.AEN7173"
    676 >a. </A
    677 >Most VBI services transmit on both fields, but
    678 some have different semantics depending on the field number. These
    679 cannot be reliable decoded or encoded when
    680 <CODE
    681 CLASS="CONSTANT"
    682 >V4L2_VBI_UNSYNC</CODE
    683 > is set.<BR></TD
    684 ></TR
    685 ></TABLE
    686 ></DIV
    687 ><DIV
    688 CLASS="FIGURE"
    689 ><A
    690 NAME="VBI-HSYNC"
    691 ></A
    692 ><P
    693 ><B
    694 >Figure 4-1. Line synchronization</B
    695 ></P
    696 ><DIV
    697 CLASS="MEDIAOBJECT"
    698 ><P
    699 ><IMG
    700 SRC="vbi_hsync.gif"></P
    701 ></DIV
    702 ></DIV
    703 ><DIV
    704 CLASS="FIGURE"
    705 ><A
    706 NAME="VBI-525"
    707 ></A
    708 ><P
    709 ><B
    710 >Figure 4-2. ITU-R 525 line numbering (M/NTSC and M/PAL)</B
    711 ></P
    712 ><DIV
    713 CLASS="MEDIAOBJECT"
    714 ><P
    715 ><IMG
    716 SRC="vbi_525.gif"><DIV
    717 CLASS="CAPTION"
    718 ><P
    719 >(1) For the purpose of this specification field 2
    720 starts in line 264 and not 263.5 because half line capturing is not
    721 supported.</P
    722 ></DIV
    723 ></P
    724 ></DIV
    725 ></DIV
    726 ><DIV
    727 CLASS="FIGURE"
    728 ><A
    729 NAME="VBI-625"
    730 ></A
    731 ><P
    732 ><B
    733 >Figure 4-3. ITU-R 625 line numbering</B
    734 ></P
    735 ><DIV
    736 CLASS="MEDIAOBJECT"
    737 ><P
    738 ><IMG
    739 SRC="vbi_625.gif"><DIV
    740 CLASS="CAPTION"
    741 ><P
    742 >(1) For the purpose of this specification field 2
    743 starts in line 314 and not 313.5 because half line capturing is not
    744 supported.</P
    745 ></DIV
    746 ></P
    747 ></DIV
    748 ></DIV
    749 ><P
    750 >Remember the VBI image format depends on the selected
    751 video standard, therefore the application must choose a new standard or
    752 query the current standard first. Attempts to read or write data ahead
    753 of format negotiation, or after switching the video standard which may
    754 invalidate the negotiated VBI parameters, should be refused by the
    755 driver. A format change during active I/O is not permitted.</P
    756 ></DIV
    757 ><DIV
    758 CLASS="SECTION"
    759 ><H2
    760 CLASS="SECTION"
    761 ><A
    762 NAME="AEN7218"
    763 >4.7.4. Reading and writing VBI images</A
    764 ></H2
    765 ><P
    766 >To assure synchronization with the field number and easier
    767 implementation, the smallest unit of data passed at a time is one
    768 frame, consisting of two fields of VBI images immediately following in
    769 memory.</P
    770 ><P
    771 >The total size of a frame computes as follows:</P
    772 ><PRE
    773 CLASS="PROGRAMLISTING"
    774 >(<CODE
    775 CLASS="STRUCTFIELD"
    776 >count</CODE
    777 >[0] + <CODE
    778 CLASS="STRUCTFIELD"
    779 >count</CODE
    780 >[1]) *
    781 <CODE
    782 CLASS="STRUCTFIELD"
    783 >samples_per_line</CODE
    784 > * sample size in bytes</PRE
    785 ><P
    786 >The sample size is most likely always one byte,
    787 applications must check the <CODE
    788 CLASS="STRUCTFIELD"
    789 >sample_format</CODE
    790 >
    791 field though, to function properly with other drivers.</P
    792 ><P
    793 >A VBI device may support <A
    794 HREF="c5742.htm#RW"
    795 >read/write</A
    796 > and/or streaming (<A
    797 HREF="x5791.htm"
    798 >memory mapping</A
    799 > or <A
    800 HREF="x5884.htm"
    801 >user pointer</A
    802 >) I/O. The latter bears the
    803 possibility of synchronizing video and
    804 VBI data by using buffer timestamps.</P
    805 ><P
    806 >Remember the <A
    807 HREF="r13817.htm"
    808 ><CODE
    809 CLASS="CONSTANT"
    810 >VIDIOC_STREAMON</CODE
    811 ></A
    812 > ioctl and the first read(),
    813 write() and select() call can be resource allocation points returning
    814 an <SPAN
    815 CLASS="ERRORCODE"
    816 >EBUSY</SPAN
    817 > error code if the required hardware resources are temporarily
    818 unavailable, for example the device is already in use by another
    819 process.</P
    820 ></DIV
    821 ></DIV
    822 ><H3
    823 CLASS="FOOTNOTES"
    824 >Notes</H3
    825 ><TABLE
    826 BORDER="0"
    827 CLASS="FOOTNOTES"
    828 WIDTH="100%"
    829 ><TR
    830 ><TD
    831 ALIGN="LEFT"
    832 VALIGN="TOP"
    833 WIDTH="5%"
    834 ><A
    835 NAME="FTN.AEN7016"
    836 HREF="x7013.htm#AEN7016"
    837 ><SPAN
    838 CLASS="footnote"
    839 >[1]</SPAN
    840 ></A
    841 ></TD
    842 ><TD
    843 ALIGN="LEFT"
    844 VALIGN="TOP"
    845 WIDTH="95%"
    846 ><P
    847 >ASK: Amplitude-Shift Keying. A high signal
    848 level represents a '1' bit, a low level a '0' bit.</P
    849 ></TD
    850 ></TR
    851 ></TABLE
    852 ><DIV
    853 CLASS="NAVFOOTER"
    854 ><HR
    855 ALIGN="LEFT"
    856 WIDTH="100%"><TABLE
    857 SUMMARY="Footer navigation table"
    858 WIDTH="100%"
    859 BORDER="0"
    860 CELLPADDING="0"
    861 CELLSPACING="0"
    862 ><TR
    863 ><TD
    864 WIDTH="33%"
    865 ALIGN="left"
    866 VALIGN="top"
    867 ><A
    868 HREF="x7002.htm"
    869 ACCESSKEY="P"
    870 >Prev</A
    871 ></TD
    872 ><TD
    873 WIDTH="34%"
    874 ALIGN="center"
    875 VALIGN="top"
    876 ><A
    877 HREF="book1.htm"
    878 ACCESSKEY="H"
    879 >Home</A
    880 ></TD
    881 ><TD
    882 WIDTH="33%"
    883 ALIGN="right"
    884 VALIGN="top"
    885 ><A
    886 HREF="x7236.htm"
    887 ACCESSKEY="N"
    888 >Next</A
    889 ></TD
    890 ></TR
    891 ><TR
    892 ><TD
    893 WIDTH="33%"
    894 ALIGN="left"
    895 VALIGN="top"
    896 >Effect Devices Interface</TD
    897 ><TD
    898 WIDTH="34%"
    899 ALIGN="center"
    900 VALIGN="top"
    901 ><A
    902 HREF="c6488.htm"
    903 ACCESSKEY="U"
    904 >Up</A
    905 ></TD
    906 ><TD
    907 WIDTH="33%"
    908 ALIGN="right"
    909 VALIGN="top"
    910 >Sliced VBI Data Interface</TD
    911 ></TR
    912 ></TABLE
    913 ></DIV
    914 ></BODY
    915 ></HTML
    916 >
    917