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