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 >Buffers</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="Input/Output" 14 HREF="c5742.htm"><LINK 15 REL="PREVIOUS" 16 TITLE="Asynchronous I/O" 17 HREF="x5950.htm"><LINK 18 REL="NEXT" 19 TITLE="Field Order" 20 HREF="x6386.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="x5950.htm" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 >Chapter 3. Input/Output</TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="x6386.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="BUFFER" 77 >3.5. Buffers</A 78 ></H1 79 ><P 80 >A buffer contains data exchanged by application and 81 driver using one of the Streaming I/O methods. Only pointers to 82 buffers are exchanged, the data itself is not copied. These pointers, 83 together with meta-information like timestamps or field parity, are 84 stored in a struct <CODE 85 CLASS="STRUCTNAME" 86 >v4l2_buffer</CODE 87 >, argument to 88 the <A 89 HREF="r13022.htm" 90 ><CODE 91 CLASS="CONSTANT" 92 >VIDIOC_QUERYBUF</CODE 93 ></A 94 >, <A 95 HREF="r12878.htm" 96 ><CODE 97 CLASS="CONSTANT" 98 >VIDIOC_QBUF</CODE 99 ></A 100 > and <A 101 HREF="r12878.htm" 102 ><CODE 103 CLASS="CONSTANT" 104 >VIDIOC_DQBUF</CODE 105 ></A 106 > ioctl.</P 107 ><P 108 >Nominally timestamps refer to the first data byte transmitted. 109 In practice however the wide range of hardware covered by the V4L2 API 110 limits timestamp accuracy. Often an interrupt routine will 111 sample the system clock shortly after the field or frame was stored 112 completely in memory. So applications must expect a constant 113 difference up to one field or frame period plus a small (few scan 114 lines) random error. The delay and error can be much 115 larger due to compression or transmission over an external bus when 116 the frames are not properly stamped by the sender. This is frequently 117 the case with USB cameras. Here timestamps refer to the instant the 118 field or frame was received by the driver, not the capture time. These 119 devices identify by not enumerating any video standards, see <A 120 HREF="x448.htm" 121 >Section 1.7</A 122 >.</P 123 ><P 124 >Similar limitations apply to output timestamps. Typically 125 the video hardware locks to a clock controlling the video timing, the 126 horizontal and vertical synchronization pulses. At some point in the 127 line sequence, possibly the vertical blanking, an interrupt routine 128 samples the system clock, compares against the timestamp and programs 129 the hardware to repeat the previous field or frame, or to display the 130 buffer contents.</P 131 ><P 132 >Apart of limitations of the video device and natural 133 inaccuracies of all clocks, it should be noted system time itself is 134 not perfectly stable. It can be affected by power saving cycles, 135 warped to insert leap seconds, or even turned back or forth by the 136 system administrator affecting long term measurements. <A 137 NAME="AEN5967" 138 HREF="x5953.htm#FTN.AEN5967" 139 ><SPAN 140 CLASS="footnote" 141 >[1]</SPAN 142 ></A 143 ></P 144 ><DIV 145 CLASS="TABLE" 146 ><A 147 NAME="V4L2-BUFFER" 148 ></A 149 ><P 150 ><B 151 >Table 3-1. struct <CODE 152 CLASS="STRUCTNAME" 153 >v4l2_buffer</CODE 154 ></B 155 ></P 156 ><TABLE 157 BORDER="0" 158 FRAME="void" 159 WIDTH="100%" 160 CLASS="CALSTABLE" 161 ><COL 162 WIDTH="20%" 163 TITLE="C1"><COL 164 WIDTH="20%" 165 TITLE="C2"><COL 166 WIDTH="20%" 167 TITLE="C3"><COL 168 WIDTH="40%" 169 TITLE="C4"><TBODY 170 VALIGN="TOP" 171 ><TR 172 ><TD 173 >__u32</TD 174 ><TD 175 ><CODE 176 CLASS="STRUCTFIELD" 177 >index</CODE 178 ></TD 179 ><TD 180 > </TD 181 ><TD 182 >Number of the buffer, set by the application. This 183 field is only used for <A 184 HREF="x5791.htm" 185 >memory mapping</A 186 > I/O 187 and can range from zero to the number of buffers allocated 188 with the <A 189 HREF="r13696.htm" 190 ><CODE 191 CLASS="CONSTANT" 192 >VIDIOC_REQBUFS</CODE 193 ></A 194 > ioctl (struct <A 195 HREF="r13696.htm#V4L2-REQUESTBUFFERS" 196 >v4l2_requestbuffers</A 197 > <CODE 198 CLASS="STRUCTFIELD" 199 >count</CODE 200 >) minus one.</TD 201 ></TR 202 ><TR 203 ><TD 204 >enum <A 205 HREF="x5953.htm#V4L2-BUF-TYPE" 206 >v4l2_buf_type</A 207 ></TD 208 ><TD 209 ><CODE 210 CLASS="STRUCTFIELD" 211 >type</CODE 212 ></TD 213 ><TD 214 > </TD 215 ><TD 216 >Type of the buffer, same as struct <A 217 HREF="r10944.htm#V4L2-FORMAT" 218 >v4l2_format</A 219 > 220 <CODE 221 CLASS="STRUCTFIELD" 222 >type</CODE 223 > or struct <A 224 HREF="r13696.htm#V4L2-REQUESTBUFFERS" 225 >v4l2_requestbuffers</A 226 > 227 <CODE 228 CLASS="STRUCTFIELD" 229 >type</CODE 230 >, set by the application.</TD 231 ></TR 232 ><TR 233 ><TD 234 >__u32</TD 235 ><TD 236 ><CODE 237 CLASS="STRUCTFIELD" 238 >bytesused</CODE 239 ></TD 240 ><TD 241 > </TD 242 ><TD 243 >The number of bytes occupied by the data in the 244 buffer. It depends on the negotiated data format and may change with 245 each buffer for compressed variable size data like JPEG images. 246 Drivers must set this field when <CODE 247 CLASS="STRUCTFIELD" 248 >type</CODE 249 > 250 refers to an input stream, applications when an output stream.</TD 251 ></TR 252 ><TR 253 ><TD 254 >__u32</TD 255 ><TD 256 ><CODE 257 CLASS="STRUCTFIELD" 258 >flags</CODE 259 ></TD 260 ><TD 261 > </TD 262 ><TD 263 >Flags set by the application or driver, see <A 264 HREF="x5953.htm#BUFFER-FLAGS" 265 >Table 3-3</A 266 >.</TD 267 ></TR 268 ><TR 269 ><TD 270 >enum <A 271 HREF="x6386.htm#V4L2-FIELD" 272 >v4l2_field</A 273 ></TD 274 ><TD 275 ><CODE 276 CLASS="STRUCTFIELD" 277 >field</CODE 278 ></TD 279 ><TD 280 > </TD 281 ><TD 282 >Indicates the field order of the image in the 283 buffer, see <A 284 HREF="x6386.htm#V4L2-FIELD" 285 >Table 3-8</A 286 >. This field is not used when 287 the buffer contains VBI data. Drivers must set it when 288 <CODE 289 CLASS="STRUCTFIELD" 290 >type</CODE 291 > refers to an input stream, 292 applications when an output stream.</TD 293 ></TR 294 ><TR 295 ><TD 296 >struct timeval</TD 297 ><TD 298 ><CODE 299 CLASS="STRUCTFIELD" 300 >timestamp</CODE 301 ></TD 302 ><TD 303 > </TD 304 ><TD 305 ><P 306 >For input streams this is the 307 system time (as returned by the <CODE 308 CLASS="FUNCTION" 309 >gettimeofday()</CODE 310 > 311 function) when the first data byte was captured. For output streams 312 the data will not be displayed before this time, secondary to the 313 nominal frame rate determined by the current video standard in 314 enqueued order. Applications can for example zero this field to 315 display frames as soon as possible. The driver stores the time at 316 which the first data byte was actually sent out in the 317 <CODE 318 CLASS="STRUCTFIELD" 319 >timestamp</CODE 320 > field. This permits 321 applications to monitor the drift between the video and system 322 clock.</P 323 ></TD 324 ></TR 325 ><TR 326 ><TD 327 >struct <A 328 HREF="x5953.htm#V4L2-TIMECODE" 329 >v4l2_timecode</A 330 ></TD 331 ><TD 332 ><CODE 333 CLASS="STRUCTFIELD" 334 >timecode</CODE 335 ></TD 336 ><TD 337 > </TD 338 ><TD 339 >When <CODE 340 CLASS="STRUCTFIELD" 341 >type</CODE 342 > is 343 <CODE 344 CLASS="CONSTANT" 345 >V4L2_BUF_TYPE_VIDEO_CAPTURE</CODE 346 > and the 347 <CODE 348 CLASS="CONSTANT" 349 >V4L2_BUF_FLAG_TIMECODE</CODE 350 > flag is set in 351 <CODE 352 CLASS="STRUCTFIELD" 353 >flags</CODE 354 >, this structure contains a frame 355 timecode. In <A 356 HREF="x6386.htm#V4L2-FIELD" 357 >V4L2_FIELD_ALTERNATE</A 358 > 359 mode the top and bottom field contain the same timecode. 360 Timecodes are intended to help video editing and are typically recorded on 361 video tapes, but also embedded in compressed formats like MPEG. This 362 field is independent of the <CODE 363 CLASS="STRUCTFIELD" 364 >timestamp</CODE 365 > and 366 <CODE 367 CLASS="STRUCTFIELD" 368 >sequence</CODE 369 > fields.</TD 370 ></TR 371 ><TR 372 ><TD 373 >__u32</TD 374 ><TD 375 ><CODE 376 CLASS="STRUCTFIELD" 377 >sequence</CODE 378 ></TD 379 ><TD 380 > </TD 381 ><TD 382 >Set by the driver, counting the frames in the 383 sequence.</TD 384 ></TR 385 ><TR 386 ><TD 387 COLSPAN="4" 388 ><P 389 >In <A 390 HREF="x6386.htm#V4L2-FIELD" 391 >V4L2_FIELD_ALTERNATE</A 392 > mode the top and 393 bottom field have the same sequence number. The count starts at zero 394 and includes dropped or repeated frames. A dropped frame was received 395 by an input device but could not be stored due to lack of free buffer 396 space. A repeated frame was displayed again by an output device 397 because the application did not pass new data in 398 time.</P 399 ><P 400 >Note this may count the frames received 401 e.g. over USB, without taking into account the frames dropped by the 402 remote hardware due to limited compression throughput or bus 403 bandwidth. These devices identify by not enumerating any video 404 standards, see <A 405 HREF="x448.htm" 406 >Section 1.7</A 407 >.</P 408 ></TD 409 ></TR 410 ><TR 411 ><TD 412 >enum <A 413 HREF="x5953.htm#V4L2-MEMORY" 414 >v4l2_memory</A 415 ></TD 416 ><TD 417 ><CODE 418 CLASS="STRUCTFIELD" 419 >memory</CODE 420 ></TD 421 ><TD 422 > </TD 423 ><TD 424 >This field must be set by applications and/or drivers 425 in accordance with the selected I/O method.</TD 426 ></TR 427 ><TR 428 ><TD 429 >union</TD 430 ><TD 431 ><CODE 432 CLASS="STRUCTFIELD" 433 >m</CODE 434 ></TD 435 ><TD 436 > </TD 437 ><TD 438 > </TD 439 ></TR 440 ><TR 441 ><TD 442 > </TD 443 ><TD 444 >__u32</TD 445 ><TD 446 ><CODE 447 CLASS="STRUCTFIELD" 448 >offset</CODE 449 ></TD 450 ><TD 451 >When <CODE 452 CLASS="STRUCTFIELD" 453 >memory</CODE 454 > is 455 <CODE 456 CLASS="CONSTANT" 457 >V4L2_MEMORY_MMAP</CODE 458 > this is the offset of the buffer 459 from the start of the device memory. The value is returned by the 460 driver and apart of serving as parameter to the <A 461 HREF="r13889.htm" 462 ><CODE 463 CLASS="FUNCTION" 464 >mmap()</CODE 465 ></A 466 > function 467 not useful for applications. See <A 468 HREF="x5791.htm" 469 >Section 3.2</A 470 > for details.</TD 471 ></TR 472 ><TR 473 ><TD 474 > </TD 475 ><TD 476 >unsigned long</TD 477 ><TD 478 ><CODE 479 CLASS="STRUCTFIELD" 480 >userptr</CODE 481 ></TD 482 ><TD 483 >When <CODE 484 CLASS="STRUCTFIELD" 485 >memory</CODE 486 > is 487 <CODE 488 CLASS="CONSTANT" 489 >V4L2_MEMORY_USERPTR</CODE 490 > this is a pointer to the 491 buffer (casted to unsigned long type) in virtual memory, set by the 492 application. See <A 493 HREF="x5884.htm" 494 >Section 3.3</A 495 > for details.</TD 496 ></TR 497 ><TR 498 ><TD 499 >__u32</TD 500 ><TD 501 ><CODE 502 CLASS="STRUCTFIELD" 503 >length</CODE 504 ></TD 505 ><TD 506 > </TD 507 ><TD 508 >Size of the buffer (not the payload) in bytes.</TD 509 ></TR 510 ><TR 511 ><TD 512 >__u32</TD 513 ><TD 514 ><CODE 515 CLASS="STRUCTFIELD" 516 >input</CODE 517 ></TD 518 ><TD 519 > </TD 520 ><TD 521 >Some video capture drivers support rapid and 522 synchronous video input changes, a function useful for example in 523 video surveillance applications. For this purpose applications set the 524 <CODE 525 CLASS="CONSTANT" 526 >V4L2_BUF_FLAG_INPUT</CODE 527 > flag, and this field to the 528 number of a video input as in struct <A 529 HREF="r8936.htm#V4L2-INPUT" 530 >v4l2_input</A 531 > field 532 <CODE 533 CLASS="STRUCTFIELD" 534 >index</CODE 535 >.</TD 536 ></TR 537 ><TR 538 ><TD 539 >__u32</TD 540 ><TD 541 ><CODE 542 CLASS="STRUCTFIELD" 543 >reserved</CODE 544 ></TD 545 ><TD 546 > </TD 547 ><TD 548 >A place holder for future extensions and custom 549 (driver defined) buffer types 550 <CODE 551 CLASS="CONSTANT" 552 >V4L2_BUF_TYPE_PRIVATE</CODE 553 > and higher.</TD 554 ></TR 555 ></TBODY 556 ></TABLE 557 ></DIV 558 ><DIV 559 CLASS="TABLE" 560 ><A 561 NAME="V4L2-BUF-TYPE" 562 ></A 563 ><P 564 ><B 565 >Table 3-2. enum v4l2_buf_type</B 566 ></P 567 ><TABLE 568 BORDER="0" 569 FRAME="void" 570 WIDTH="100%" 571 CLASS="CALSTABLE" 572 ><COL 573 WIDTH="38%" 574 TITLE="C1"><COL 575 WIDTH="12%" 576 TITLE="C2"><COL 577 WIDTH="50%" 578 TITLE="C3"><TBODY 579 VALIGN="TOP" 580 ><TR 581 ><TD 582 ><CODE 583 CLASS="CONSTANT" 584 >V4L2_BUF_TYPE_VIDEO_CAPTURE</CODE 585 ></TD 586 ><TD 587 >1</TD 588 ><TD 589 >Buffer of a video capture stream, see <A 590 HREF="c6488.htm#CAPTURE" 591 >Section 4.1</A 592 >.</TD 593 ></TR 594 ><TR 595 ><TD 596 ><CODE 597 CLASS="CONSTANT" 598 >V4L2_BUF_TYPE_VIDEO_OUTPUT</CODE 599 ></TD 600 ><TD 601 >2</TD 602 ><TD 603 >Buffer of a video output stream, see <A 604 HREF="x6831.htm" 605 >Section 4.3</A 606 >.</TD 607 ></TR 608 ><TR 609 ><TD 610 ><CODE 611 CLASS="CONSTANT" 612 >V4L2_BUF_TYPE_VIDEO_OVERLAY</CODE 613 ></TD 614 ><TD 615 >3</TD 616 ><TD 617 >Buffer for video overlay, see <A 618 HREF="x6570.htm" 619 >Section 4.2</A 620 >.</TD 621 ></TR 622 ><TR 623 ><TD 624 ><CODE 625 CLASS="CONSTANT" 626 >V4L2_BUF_TYPE_VBI_CAPTURE</CODE 627 ></TD 628 ><TD 629 >4</TD 630 ><TD 631 >Buffer of a raw VBI capture stream, see <A 632 HREF="x7013.htm" 633 >Section 4.7</A 634 >.</TD 635 ></TR 636 ><TR 637 ><TD 638 ><CODE 639 CLASS="CONSTANT" 640 >V4L2_BUF_TYPE_VBI_OUTPUT</CODE 641 ></TD 642 ><TD 643 >5</TD 644 ><TD 645 >Buffer of a raw VBI output stream, see <A 646 HREF="x7013.htm" 647 >Section 4.7</A 648 >.</TD 649 ></TR 650 ><TR 651 ><TD 652 ><CODE 653 CLASS="CONSTANT" 654 >V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</CODE 655 ></TD 656 ><TD 657 >6</TD 658 ><TD 659 >Buffer of a sliced VBI capture stream, see <A 660 HREF="x7236.htm" 661 >Section 4.8</A 662 >.</TD 663 ></TR 664 ><TR 665 ><TD 666 ><CODE 667 CLASS="CONSTANT" 668 >V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</CODE 669 ></TD 670 ><TD 671 >7</TD 672 ><TD 673 >Buffer of a sliced VBI output stream, see <A 674 HREF="x7236.htm" 675 >Section 4.8</A 676 >.</TD 677 ></TR 678 ><TR 679 ><TD 680 ><CODE 681 CLASS="CONSTANT" 682 >V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</CODE 683 ></TD 684 ><TD 685 >8</TD 686 ><TD 687 >Buffer for video output overlay (OSD), see <A 688 HREF="x6909.htm" 689 >Section 4.4</A 690 >. Status: <A 691 HREF="x16453.htm" 692 >Experimental</A 693 >.</TD 694 ></TR 695 ><TR 696 ><TD 697 ><CODE 698 CLASS="CONSTANT" 699 >V4L2_BUF_TYPE_PRIVATE</CODE 700 ></TD 701 ><TD 702 >0x80</TD 703 ><TD 704 >This and higher values are reserved for custom 705 (driver defined) buffer types.</TD 706 ></TR 707 ></TBODY 708 ></TABLE 709 ></DIV 710 ><DIV 711 CLASS="TABLE" 712 ><A 713 NAME="BUFFER-FLAGS" 714 ></A 715 ><P 716 ><B 717 >Table 3-3. Buffer Flags</B 718 ></P 719 ><TABLE 720 BORDER="0" 721 FRAME="void" 722 WIDTH="100%" 723 CLASS="CALSTABLE" 724 ><COL 725 WIDTH="38%" 726 TITLE="C1"><COL 727 WIDTH="12%" 728 TITLE="C2"><COL 729 WIDTH="50%" 730 TITLE="C3"><TBODY 731 VALIGN="TOP" 732 ><TR 733 ><TD 734 ><CODE 735 CLASS="CONSTANT" 736 >V4L2_BUF_FLAG_MAPPED</CODE 737 ></TD 738 ><TD 739 >0x0001</TD 740 ><TD 741 >The buffer resides in device memory and has been mapped 742 into the application's address space, see <A 743 HREF="x5791.htm" 744 >Section 3.2</A 745 > for details. 746 Drivers set or clear this flag when the 747 <A 748 HREF="r13022.htm" 749 >VIDIOC_QUERYBUF</A 750 >, <A 751 HREF="r12878.htm" 752 >VIDIOC_QBUF</A 753 > or <A 754 HREF="r12878.htm" 755 >VIDIOC_DQBUF</A 756 > ioctl is called. Set by the driver.</TD 757 ></TR 758 ><TR 759 ><TD 760 ><CODE 761 CLASS="CONSTANT" 762 >V4L2_BUF_FLAG_QUEUED</CODE 763 ></TD 764 ><TD 765 >0x0002</TD 766 ><TD 767 >Internally drivers maintain two buffer queues, an 768 incoming and outgoing queue. When this flag is set, the buffer is 769 currently on the incoming queue. It automatically moves to the 770 outgoing queue after the buffer has been filled (capture devices) or 771 displayed (output devices). Drivers set or clear this flag when the 772 <CODE 773 CLASS="CONSTANT" 774 >VIDIOC_QUERYBUF</CODE 775 > ioctl is called. After 776 (successful) calling the <CODE 777 CLASS="CONSTANT" 778 >VIDIOC_QBUF </CODE 779 >ioctl it is 780 always set and after <CODE 781 CLASS="CONSTANT" 782 >VIDIOC_DQBUF</CODE 783 > always 784 cleared.</TD 785 ></TR 786 ><TR 787 ><TD 788 ><CODE 789 CLASS="CONSTANT" 790 >V4L2_BUF_FLAG_DONE</CODE 791 ></TD 792 ><TD 793 >0x0004</TD 794 ><TD 795 >When this flag is set, the buffer is currently on 796 the outgoing queue, ready to be dequeued from the driver. Drivers set 797 or clear this flag when the <CODE 798 CLASS="CONSTANT" 799 >VIDIOC_QUERYBUF</CODE 800 > ioctl 801 is called. After calling the <CODE 802 CLASS="CONSTANT" 803 >VIDIOC_QBUF</CODE 804 > or 805 <CODE 806 CLASS="CONSTANT" 807 >VIDIOC_DQBUF</CODE 808 > it is always cleared. Of course a 809 buffer cannot be on both queues at the same time, the 810 <CODE 811 CLASS="CONSTANT" 812 >V4L2_BUF_FLAG_QUEUED</CODE 813 > and 814 <CODE 815 CLASS="CONSTANT" 816 >V4L2_BUF_FLAG_DONE</CODE 817 > flag are mutually exclusive. 818 They can be both cleared however, then the buffer is in "dequeued" 819 state, in the application domain to say so.</TD 820 ></TR 821 ><TR 822 ><TD 823 ><CODE 824 CLASS="CONSTANT" 825 >V4L2_BUF_FLAG_KEYFRAME</CODE 826 ></TD 827 ><TD 828 >0x0008</TD 829 ><TD 830 >Drivers set or clear this flag when calling the 831 <CODE 832 CLASS="CONSTANT" 833 >VIDIOC_DQBUF</CODE 834 > ioctl. It may be set by video 835 capture devices when the buffer contains a compressed image which is a 836 key frame (or field), i. e. can be decompressed on its own.</TD 837 ></TR 838 ><TR 839 ><TD 840 ><CODE 841 CLASS="CONSTANT" 842 >V4L2_BUF_FLAG_PFRAME</CODE 843 ></TD 844 ><TD 845 >0x0010</TD 846 ><TD 847 >Similar to <CODE 848 CLASS="CONSTANT" 849 >V4L2_BUF_FLAG_KEYFRAME</CODE 850 > 851 this flags predicted frames or fields which contain only differences to a 852 previous key frame.</TD 853 ></TR 854 ><TR 855 ><TD 856 ><CODE 857 CLASS="CONSTANT" 858 >V4L2_BUF_FLAG_BFRAME</CODE 859 ></TD 860 ><TD 861 >0x0020</TD 862 ><TD 863 >Similar to <CODE 864 CLASS="CONSTANT" 865 >V4L2_BUF_FLAG_PFRAME</CODE 866 > 867 this is a bidirectional predicted frame or field. [ooc tbd]</TD 868 ></TR 869 ><TR 870 ><TD 871 ><CODE 872 CLASS="CONSTANT" 873 >V4L2_BUF_FLAG_TIMECODE</CODE 874 ></TD 875 ><TD 876 >0x0100</TD 877 ><TD 878 >The <CODE 879 CLASS="STRUCTFIELD" 880 >timecode</CODE 881 > field is valid. 882 Drivers set or clear this flag when the <CODE 883 CLASS="CONSTANT" 884 >VIDIOC_DQBUF</CODE 885 > 886 ioctl is called.</TD 887 ></TR 888 ><TR 889 ><TD 890 ><CODE 891 CLASS="CONSTANT" 892 >V4L2_BUF_FLAG_INPUT</CODE 893 ></TD 894 ><TD 895 >0x0200</TD 896 ><TD 897 >The <CODE 898 CLASS="STRUCTFIELD" 899 >input</CODE 900 > field is valid. 901 Applications set or clear this flag before calling the 902 <CODE 903 CLASS="CONSTANT" 904 >VIDIOC_QBUF</CODE 905 > ioctl.</TD 906 ></TR 907 ></TBODY 908 ></TABLE 909 ></DIV 910 ><DIV 911 CLASS="TABLE" 912 ><A 913 NAME="V4L2-MEMORY" 914 ></A 915 ><P 916 ><B 917 >Table 3-4. enum v4l2_memory</B 918 ></P 919 ><TABLE 920 BORDER="0" 921 FRAME="void" 922 WIDTH="100%" 923 CLASS="CALSTABLE" 924 ><COL 925 WIDTH="38%" 926 TITLE="C1"><COL 927 WIDTH="12%" 928 TITLE="C2"><COL 929 WIDTH="50%" 930 TITLE="C3"><TBODY 931 VALIGN="TOP" 932 ><TR 933 ><TD 934 ><CODE 935 CLASS="CONSTANT" 936 >V4L2_MEMORY_MMAP</CODE 937 ></TD 938 ><TD 939 >1</TD 940 ><TD 941 >The buffer is used for <A 942 HREF="x5791.htm" 943 >memory 944 mapping</A 945 > I/O.</TD 946 ></TR 947 ><TR 948 ><TD 949 ><CODE 950 CLASS="CONSTANT" 951 >V4L2_MEMORY_USERPTR</CODE 952 ></TD 953 ><TD 954 >2</TD 955 ><TD 956 >The buffer is used for <A 957 HREF="x5884.htm" 958 >user 959 pointer</A 960 > I/O.</TD 961 ></TR 962 ><TR 963 ><TD 964 ><CODE 965 CLASS="CONSTANT" 966 >V4L2_MEMORY_OVERLAY</CODE 967 ></TD 968 ><TD 969 >3</TD 970 ><TD 971 >[to do]</TD 972 ></TR 973 ></TBODY 974 ></TABLE 975 ></DIV 976 ><DIV 977 CLASS="SECTION" 978 ><H2 979 CLASS="SECTION" 980 ><A 981 NAME="AEN6266" 982 >3.5.1. Timecodes</A 983 ></H2 984 ><P 985 >The <CODE 986 CLASS="STRUCTNAME" 987 >v4l2_timecode</CODE 988 > structure is 989 designed to hold a <A 990 HREF="b17127.htm#SMPTE12M" 991 ><ABBR 992 CLASS="ABBREV" 993 >SMPTE 12M</ABBR 994 ></A 995 > or similar timecode. 996 (struct <CODE 997 CLASS="STRUCTNAME" 998 >timeval</CODE 999 > timestamps are stored in 1000 struct <A 1001 HREF="x5953.htm#V4L2-BUFFER" 1002 >v4l2_buffer</A 1003 > field <CODE 1004 CLASS="STRUCTFIELD" 1005 >timestamp</CODE 1006 >.)</P 1007 ><DIV 1008 CLASS="TABLE" 1009 ><A 1010 NAME="V4L2-TIMECODE" 1011 ></A 1012 ><P 1013 ><B 1014 >Table 3-5. struct <CODE 1015 CLASS="STRUCTNAME" 1016 >v4l2_timecode</CODE 1017 ></B 1018 ></P 1019 ><TABLE 1020 BORDER="0" 1021 FRAME="void" 1022 WIDTH="100%" 1023 CLASS="CALSTABLE" 1024 ><COL 1025 WIDTH="25%" 1026 TITLE="C1"><COL 1027 WIDTH="25%" 1028 TITLE="C2"><COL 1029 WIDTH="50%" 1030 TITLE="C3"><TBODY 1031 VALIGN="TOP" 1032 ><TR 1033 ><TD 1034 >__u32</TD 1035 ><TD 1036 ><CODE 1037 CLASS="STRUCTFIELD" 1038 >type</CODE 1039 ></TD 1040 ><TD 1041 >Frame rate the timecodes are based on, see <A 1042 HREF="x5953.htm#TIMECODE-TYPE" 1043 >Table 3-6</A 1044 >.</TD 1045 ></TR 1046 ><TR 1047 ><TD 1048 >__u32</TD 1049 ><TD 1050 ><CODE 1051 CLASS="STRUCTFIELD" 1052 >flags</CODE 1053 ></TD 1054 ><TD 1055 >Timecode flags, see <A 1056 HREF="x5953.htm#TIMECODE-FLAGS" 1057 >Table 3-7</A 1058 >.</TD 1059 ></TR 1060 ><TR 1061 ><TD 1062 >__u8</TD 1063 ><TD 1064 ><CODE 1065 CLASS="STRUCTFIELD" 1066 >frames</CODE 1067 ></TD 1068 ><TD 1069 >Frame count, 0 ... 23/24/29/49/59, depending on the 1070 type of timecode.</TD 1071 ></TR 1072 ><TR 1073 ><TD 1074 >__u8</TD 1075 ><TD 1076 ><CODE 1077 CLASS="STRUCTFIELD" 1078 >seconds</CODE 1079 ></TD 1080 ><TD 1081 >Seconds count, 0 ... 59. This is a binary, not BCD number.</TD 1082 ></TR 1083 ><TR 1084 ><TD 1085 >__u8</TD 1086 ><TD 1087 ><CODE 1088 CLASS="STRUCTFIELD" 1089 >minutes</CODE 1090 ></TD 1091 ><TD 1092 >Minutes count, 0 ... 59. This is a binary, not BCD number.</TD 1093 ></TR 1094 ><TR 1095 ><TD 1096 >__u8</TD 1097 ><TD 1098 ><CODE 1099 CLASS="STRUCTFIELD" 1100 >hours</CODE 1101 ></TD 1102 ><TD 1103 >Hours count, 0 ... 29. This is a binary, not BCD number.</TD 1104 ></TR 1105 ><TR 1106 ><TD 1107 >__u8</TD 1108 ><TD 1109 ><CODE 1110 CLASS="STRUCTFIELD" 1111 >userbits</CODE 1112 >[4]</TD 1113 ><TD 1114 >The "user group" bits from the timecode.</TD 1115 ></TR 1116 ></TBODY 1117 ></TABLE 1118 ></DIV 1119 ><DIV 1120 CLASS="TABLE" 1121 ><A 1122 NAME="TIMECODE-TYPE" 1123 ></A 1124 ><P 1125 ><B 1126 >Table 3-6. Timecode Types</B 1127 ></P 1128 ><TABLE 1129 BORDER="0" 1130 FRAME="void" 1131 WIDTH="100%" 1132 CLASS="CALSTABLE" 1133 ><COL 1134 WIDTH="38%" 1135 TITLE="C1"><COL 1136 WIDTH="12%" 1137 TITLE="C2"><COL 1138 WIDTH="50%" 1139 TITLE="C3"><TBODY 1140 VALIGN="TOP" 1141 ><TR 1142 ><TD 1143 ><CODE 1144 CLASS="CONSTANT" 1145 >V4L2_TC_TYPE_24FPS</CODE 1146 ></TD 1147 ><TD 1148 >1</TD 1149 ><TD 1150 >24 frames per second, i. e. film.</TD 1151 ></TR 1152 ><TR 1153 ><TD 1154 ><CODE 1155 CLASS="CONSTANT" 1156 >V4L2_TC_TYPE_25FPS</CODE 1157 ></TD 1158 ><TD 1159 >2</TD 1160 ><TD 1161 >25 frames per second, i. e. PAL or SECAM video.</TD 1162 ></TR 1163 ><TR 1164 ><TD 1165 ><CODE 1166 CLASS="CONSTANT" 1167 >V4L2_TC_TYPE_30FPS</CODE 1168 ></TD 1169 ><TD 1170 >3</TD 1171 ><TD 1172 >30 frames per second, i. e. NTSC video.</TD 1173 ></TR 1174 ><TR 1175 ><TD 1176 ><CODE 1177 CLASS="CONSTANT" 1178 >V4L2_TC_TYPE_50FPS</CODE 1179 ></TD 1180 ><TD 1181 >4</TD 1182 ><TD 1183 > </TD 1184 ></TR 1185 ><TR 1186 ><TD 1187 ><CODE 1188 CLASS="CONSTANT" 1189 >V4L2_TC_TYPE_60FPS</CODE 1190 ></TD 1191 ><TD 1192 >5</TD 1193 ><TD 1194 > </TD 1195 ></TR 1196 ></TBODY 1197 ></TABLE 1198 ></DIV 1199 ><DIV 1200 CLASS="TABLE" 1201 ><A 1202 NAME="TIMECODE-FLAGS" 1203 ></A 1204 ><P 1205 ><B 1206 >Table 3-7. Timecode Flags</B 1207 ></P 1208 ><TABLE 1209 BORDER="0" 1210 FRAME="void" 1211 WIDTH="100%" 1212 CLASS="CALSTABLE" 1213 ><COL 1214 WIDTH="38%" 1215 TITLE="C1"><COL 1216 WIDTH="12%" 1217 TITLE="C2"><COL 1218 WIDTH="50%" 1219 TITLE="C3"><TBODY 1220 VALIGN="TOP" 1221 ><TR 1222 ><TD 1223 ><CODE 1224 CLASS="CONSTANT" 1225 >V4L2_TC_FLAG_DROPFRAME</CODE 1226 ></TD 1227 ><TD 1228 >0x0001</TD 1229 ><TD 1230 >Indicates "drop frame" semantics for counting frames 1231 in 29.97 fps material. When set, frame numbers 0 and 1 at the start of 1232 each minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the 1233 count.</TD 1234 ></TR 1235 ><TR 1236 ><TD 1237 ><CODE 1238 CLASS="CONSTANT" 1239 >V4L2_TC_FLAG_COLORFRAME</CODE 1240 ></TD 1241 ><TD 1242 >0x0002</TD 1243 ><TD 1244 >The "color frame" flag.</TD 1245 ></TR 1246 ><TR 1247 ><TD 1248 ><CODE 1249 CLASS="CONSTANT" 1250 >V4L2_TC_USERBITS_field</CODE 1251 ></TD 1252 ><TD 1253 >0x000C</TD 1254 ><TD 1255 >Field mask for the "binary group flags".</TD 1256 ></TR 1257 ><TR 1258 ><TD 1259 ><CODE 1260 CLASS="CONSTANT" 1261 >V4L2_TC_USERBITS_USERDEFINED</CODE 1262 ></TD 1263 ><TD 1264 >0x0000</TD 1265 ><TD 1266 >Unspecified format.</TD 1267 ></TR 1268 ><TR 1269 ><TD 1270 ><CODE 1271 CLASS="CONSTANT" 1272 >V4L2_TC_USERBITS_8BITCHARS</CODE 1273 ></TD 1274 ><TD 1275 >0x0008</TD 1276 ><TD 1277 >8-bit ISO characters.</TD 1278 ></TR 1279 ></TBODY 1280 ></TABLE 1281 ></DIV 1282 ></DIV 1283 ></DIV 1284 ><H3 1285 CLASS="FOOTNOTES" 1286 >Notes</H3 1287 ><TABLE 1288 BORDER="0" 1289 CLASS="FOOTNOTES" 1290 WIDTH="100%" 1291 ><TR 1292 ><TD 1293 ALIGN="LEFT" 1294 VALIGN="TOP" 1295 WIDTH="5%" 1296 ><A 1297 NAME="FTN.AEN5967" 1298 HREF="x5953.htm#AEN5967" 1299 ><SPAN 1300 CLASS="footnote" 1301 >[1]</SPAN 1302 ></A 1303 ></TD 1304 ><TD 1305 ALIGN="LEFT" 1306 VALIGN="TOP" 1307 WIDTH="95%" 1308 ><P 1309 >Since no other Linux multimedia 1310 API supports unadjusted time it would be foolish to introduce here. We 1311 must use a universally supported clock to synchronize different media, 1312 hence time of day.</P 1313 ></TD 1314 ></TR 1315 ></TABLE 1316 ><DIV 1317 CLASS="NAVFOOTER" 1318 ><HR 1319 ALIGN="LEFT" 1320 WIDTH="100%"><TABLE 1321 SUMMARY="Footer navigation table" 1322 WIDTH="100%" 1323 BORDER="0" 1324 CELLPADDING="0" 1325 CELLSPACING="0" 1326 ><TR 1327 ><TD 1328 WIDTH="33%" 1329 ALIGN="left" 1330 VALIGN="top" 1331 ><A 1332 HREF="x5950.htm" 1333 ACCESSKEY="P" 1334 >Prev</A 1335 ></TD 1336 ><TD 1337 WIDTH="34%" 1338 ALIGN="center" 1339 VALIGN="top" 1340 ><A 1341 HREF="book1.htm" 1342 ACCESSKEY="H" 1343 >Home</A 1344 ></TD 1345 ><TD 1346 WIDTH="33%" 1347 ALIGN="right" 1348 VALIGN="top" 1349 ><A 1350 HREF="x6386.htm" 1351 ACCESSKEY="N" 1352 >Next</A 1353 ></TD 1354 ></TR 1355 ><TR 1356 ><TD 1357 WIDTH="33%" 1358 ALIGN="left" 1359 VALIGN="top" 1360 >Asynchronous I/O</TD 1361 ><TD 1362 WIDTH="34%" 1363 ALIGN="center" 1364 VALIGN="top" 1365 ><A 1366 HREF="c5742.htm" 1367 ACCESSKEY="U" 1368 >Up</A 1369 ></TD 1370 ><TD 1371 WIDTH="33%" 1372 ALIGN="right" 1373 VALIGN="top" 1374 >Field Order</TD 1375 ></TR 1376 ></TABLE 1377 ></DIV 1378 ></BODY 1379 ></HTML 1380 > 1381