doc-rst: customize RTD theme, captions & inline literal
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / buffer.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _buffer:
4
5 *******
6 Buffers
7 *******
8
9 A buffer contains data exchanged by application and driver using one of
10 the Streaming I/O methods. In the multi-planar API, the data is held in
11 planes, while the buffer structure acts as a container for the planes.
12 Only pointers to buffers (planes) are exchanged, the data itself is not
13 copied. These pointers, together with meta-information like timestamps
14 or field parity, are stored in a struct :ref:`struct v4l2_buffer <v4l2-buffer>`,
15 argument to the :ref:`VIDIOC_QUERYBUF`,
16 :ref:`VIDIOC_QBUF` and
17 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl. In the multi-planar API,
18 some plane-specific members of struct :ref:`struct v4l2_buffer <v4l2-buffer>`,
19 such as pointers and sizes for each plane, are stored in struct
20 :ref:`struct v4l2_plane <v4l2-plane>` instead. In that case, struct
21 :ref:`struct v4l2_buffer <v4l2-buffer>` contains an array of plane structures.
22
23 Dequeued video buffers come with timestamps. The driver decides at which
24 part of the frame and with which clock the timestamp is taken. Please
25 see flags in the masks ``V4L2_BUF_FLAG_TIMESTAMP_MASK`` and
26 ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` in :ref:`buffer-flags`. These flags
27 are always valid and constant across all buffers during the whole video
28 stream. Changes in these flags may take place as a side effect of
29 :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` or
30 :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` however. The
31 ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` timestamp type which is used by e.g. on
32 mem-to-mem devices is an exception to the rule: the timestamp source
33 flags are copied from the OUTPUT video buffer to the CAPTURE video
34 buffer.
35
36
37 .. _v4l2-buffer:
38
39 struct v4l2_buffer
40 ==================
41
42 .. flat-table:: struct v4l2_buffer
43 :header-rows: 0
44 :stub-columns: 0
45 :widths: 1 1 1 2
46
47
48 - .. row 1
49
50 - __u32
51
52 - ``index``
53
54 -
55 - Number of the buffer, set by the application except when calling
56 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>`, then it is set by the
57 driver. This field can range from zero to the number of buffers
58 allocated with the :ref:`VIDIOC_REQBUFS` ioctl
59 (struct :ref:`v4l2_requestbuffers <v4l2-requestbuffers>`
60 ``count``), plus any buffers allocated with
61 :ref:`VIDIOC_CREATE_BUFS` minus one.
62
63 - .. row 2
64
65 - __u32
66
67 - ``type``
68
69 -
70 - Type of the buffer, same as struct
71 :ref:`v4l2_format <v4l2-format>` ``type`` or struct
72 :ref:`v4l2_requestbuffers <v4l2-requestbuffers>` ``type``, set
73 by the application. See :ref:`v4l2-buf-type`
74
75 - .. row 3
76
77 - __u32
78
79 - ``bytesused``
80
81 -
82 - The number of bytes occupied by the data in the buffer. It depends
83 on the negotiated data format and may change with each buffer for
84 compressed variable size data like JPEG images. Drivers must set
85 this field when ``type`` refers to a capture stream, applications
86 when it refers to an output stream. If the application sets this
87 to 0 for an output stream, then ``bytesused`` will be set to the
88 size of the buffer (see the ``length`` field of this struct) by
89 the driver. For multiplanar formats this field is ignored and the
90 ``planes`` pointer is used instead.
91
92 - .. row 4
93
94 - __u32
95
96 - ``flags``
97
98 -
99 - Flags set by the application or driver, see :ref:`buffer-flags`.
100
101 - .. row 5
102
103 - __u32
104
105 - ``field``
106
107 -
108 - Indicates the field order of the image in the buffer, see
109 :ref:`v4l2-field`. This field is not used when the buffer
110 contains VBI data. Drivers must set it when ``type`` refers to a
111 capture stream, applications when it refers to an output stream.
112
113 - .. row 6
114
115 - struct timeval
116
117 - ``timestamp``
118
119 -
120 - For capture streams this is time when the first data byte was
121 captured, as returned by the :c:func:`clock_gettime()` function
122 for the relevant clock id; see ``V4L2_BUF_FLAG_TIMESTAMP_*`` in
123 :ref:`buffer-flags`. For output streams the driver stores the
124 time at which the last data byte was actually sent out in the
125 ``timestamp`` field. This permits applications to monitor the
126 drift between the video and system clock. For output streams that
127 use ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` the application has to fill
128 in the timestamp which will be copied by the driver to the capture
129 stream.
130
131 - .. row 7
132
133 - struct :ref:`v4l2_timecode <v4l2-timecode>`
134
135 - ``timecode``
136
137 -
138 - When ``type`` is ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` and the
139 ``V4L2_BUF_FLAG_TIMECODE`` flag is set in ``flags``, this
140 structure contains a frame timecode. In
141 :ref:`V4L2_FIELD_ALTERNATE <v4l2-field>` mode the top and
142 bottom field contain the same timecode. Timecodes are intended to
143 help video editing and are typically recorded on video tapes, but
144 also embedded in compressed formats like MPEG. This field is
145 independent of the ``timestamp`` and ``sequence`` fields.
146
147 - .. row 8
148
149 - __u32
150
151 - ``sequence``
152
153 -
154 - Set by the driver, counting the frames (not fields!) in sequence.
155 This field is set for both input and output devices.
156
157 - .. row 9
158
159 - :cspan:`3`
160
161 In :ref:`V4L2_FIELD_ALTERNATE <v4l2-field>` mode the top and
162 bottom field have the same sequence number. The count starts at
163 zero and includes dropped or repeated frames. A dropped frame was
164 received by an input device but could not be stored due to lack of
165 free buffer space. A repeated frame was displayed again by an
166 output device because the application did not pass new data in
167 time.
168
169 Note this may count the frames received e.g. over USB, without
170 taking into account the frames dropped by the remote hardware due
171 to limited compression throughput or bus bandwidth. These devices
172 identify by not enumerating any video standards, see
173 :ref:`standard`.
174
175 - .. row 10
176
177 - __u32
178
179 - ``memory``
180
181 -
182 - This field must be set by applications and/or drivers in
183 accordance with the selected I/O method. See :ref:`v4l2-memory`
184
185 - .. row 11
186
187 - union
188
189 - ``m``
190
191 - .. row 12
192
193 -
194 - __u32
195
196 - ``offset``
197
198 - For the single-planar API and when ``memory`` is
199 ``V4L2_MEMORY_MMAP`` this is the offset of the buffer from the
200 start of the device memory. The value is returned by the driver
201 and apart of serving as parameter to the
202 :ref:`mmap() <func-mmap>` function not useful for applications.
203 See :ref:`mmap` for details
204
205 - .. row 13
206
207 -
208 - unsigned long
209
210 - ``userptr``
211
212 - For the single-planar API and when ``memory`` is
213 ``V4L2_MEMORY_USERPTR`` this is a pointer to the buffer (casted to
214 unsigned long type) in virtual memory, set by the application. See
215 :ref:`userp` for details.
216
217 - .. row 14
218
219 -
220 - struct v4l2_plane
221
222 - ``*planes``
223
224 - When using the multi-planar API, contains a userspace pointer to
225 an array of struct :ref:`v4l2_plane <v4l2-plane>`. The size of
226 the array should be put in the ``length`` field of this
227 :ref:`struct v4l2_buffer <v4l2-buffer>` structure.
228
229 - .. row 15
230
231 -
232 - int
233
234 - ``fd``
235
236 - For the single-plane API and when ``memory`` is
237 ``V4L2_MEMORY_DMABUF`` this is the file descriptor associated with
238 a DMABUF buffer.
239
240 - .. row 16
241
242 - __u32
243
244 - ``length``
245
246 -
247 - Size of the buffer (not the payload) in bytes for the
248 single-planar API. This is set by the driver based on the calls to
249 :ref:`VIDIOC_REQBUFS` and/or
250 :ref:`VIDIOC_CREATE_BUFS`. For the
251 multi-planar API the application sets this to the number of
252 elements in the ``planes`` array. The driver will fill in the
253 actual number of valid elements in that array.
254
255 - .. row 17
256
257 - __u32
258
259 - ``reserved2``
260
261 -
262 - A place holder for future extensions. Drivers and applications
263 must set this to 0.
264
265 - .. row 18
266
267 - __u32
268
269 - ``reserved``
270
271 -
272 - A place holder for future extensions. Drivers and applications
273 must set this to 0.
274
275
276
277 .. _v4l2-plane:
278
279 struct v4l2_plane
280 =================
281
282 .. flat-table::
283 :header-rows: 0
284 :stub-columns: 0
285 :widths: 1 1 1 2
286
287
288 - .. row 1
289
290 - __u32
291
292 - ``bytesused``
293
294 -
295 - The number of bytes occupied by data in the plane (its payload).
296 Drivers must set this field when ``type`` refers to a capture
297 stream, applications when it refers to an output stream. If the
298 application sets this to 0 for an output stream, then
299 ``bytesused`` will be set to the size of the plane (see the
300 ``length`` field of this struct) by the driver. Note that the
301 actual image data starts at ``data_offset`` which may not be 0.
302
303 - .. row 2
304
305 - __u32
306
307 - ``length``
308
309 -
310 - Size in bytes of the plane (not its payload). This is set by the
311 driver based on the calls to
312 :ref:`VIDIOC_REQBUFS` and/or
313 :ref:`VIDIOC_CREATE_BUFS`.
314
315 - .. row 3
316
317 - union
318
319 - ``m``
320
321 -
322 -
323
324 - .. row 4
325
326 -
327 - __u32
328
329 - ``mem_offset``
330
331 - When the memory type in the containing struct
332 :ref:`v4l2_buffer <v4l2-buffer>` is ``V4L2_MEMORY_MMAP``, this
333 is the value that should be passed to :ref:`mmap() <func-mmap>`,
334 similar to the ``offset`` field in struct
335 :ref:`v4l2_buffer <v4l2-buffer>`.
336
337 - .. row 5
338
339 -
340 - unsigned long
341
342 - ``userptr``
343
344 - When the memory type in the containing struct
345 :ref:`v4l2_buffer <v4l2-buffer>` is ``V4L2_MEMORY_USERPTR``,
346 this is a userspace pointer to the memory allocated for this plane
347 by an application.
348
349 - .. row 6
350
351 -
352 - int
353
354 - ``fd``
355
356 - When the memory type in the containing struct
357 :ref:`v4l2_buffer <v4l2-buffer>` is ``V4L2_MEMORY_DMABUF``,
358 this is a file descriptor associated with a DMABUF buffer, similar
359 to the ``fd`` field in struct :ref:`v4l2_buffer <v4l2-buffer>`.
360
361 - .. row 7
362
363 - __u32
364
365 - ``data_offset``
366
367 -
368 - Offset in bytes to video data in the plane. Drivers must set this
369 field when ``type`` refers to a capture stream, applications when
370 it refers to an output stream. Note that data_offset is included
371 in ``bytesused``. So the size of the image in the plane is
372 ``bytesused``-``data_offset`` at offset ``data_offset`` from the
373 start of the plane.
374
375 - .. row 8
376
377 - __u32
378
379 - ``reserved[11]``
380
381 -
382 - Reserved for future use. Should be zeroed by drivers and
383 applications.
384
385
386
387 .. _v4l2-buf-type:
388
389 enum v4l2_buf_type
390 ==================
391
392 .. flat-table::
393 :header-rows: 0
394 :stub-columns: 0
395 :widths: 3 1 4
396
397
398 - .. row 1
399
400 - ``V4L2_BUF_TYPE_VIDEO_CAPTURE``
401
402 - 1
403
404 - Buffer of a single-planar video capture stream, see
405 :ref:`capture`.
406
407 - .. row 2
408
409 - ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``
410
411 - 9
412
413 - Buffer of a multi-planar video capture stream, see
414 :ref:`capture`.
415
416 - .. row 3
417
418 - ``V4L2_BUF_TYPE_VIDEO_OUTPUT``
419
420 - 2
421
422 - Buffer of a single-planar video output stream, see
423 :ref:`output`.
424
425 - .. row 4
426
427 - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``
428
429 - 10
430
431 - Buffer of a multi-planar video output stream, see :ref:`output`.
432
433 - .. row 5
434
435 - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``
436
437 - 3
438
439 - Buffer for video overlay, see :ref:`overlay`.
440
441 - .. row 6
442
443 - ``V4L2_BUF_TYPE_VBI_CAPTURE``
444
445 - 4
446
447 - Buffer of a raw VBI capture stream, see :ref:`raw-vbi`.
448
449 - .. row 7
450
451 - ``V4L2_BUF_TYPE_VBI_OUTPUT``
452
453 - 5
454
455 - Buffer of a raw VBI output stream, see :ref:`raw-vbi`.
456
457 - .. row 8
458
459 - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE``
460
461 - 6
462
463 - Buffer of a sliced VBI capture stream, see :ref:`sliced`.
464
465 - .. row 9
466
467 - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT``
468
469 - 7
470
471 - Buffer of a sliced VBI output stream, see :ref:`sliced`.
472
473 - .. row 10
474
475 - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY``
476
477 - 8
478
479 - Buffer for video output overlay (OSD), see :ref:`osd`.
480
481 - .. row 11
482
483 - ``V4L2_BUF_TYPE_SDR_CAPTURE``
484
485 - 11
486
487 - Buffer for Software Defined Radio (SDR) capture stream, see
488 :ref:`sdr`.
489
490 - .. row 12
491
492 - ``V4L2_BUF_TYPE_SDR_OUTPUT``
493
494 - 12
495
496 - Buffer for Software Defined Radio (SDR) output stream, see
497 :ref:`sdr`.
498
499
500
501 .. _buffer-flags:
502
503 Buffer Flags
504 ============
505
506 .. flat-table::
507 :header-rows: 0
508 :stub-columns: 0
509 :widths: 3 1 4
510
511
512 - .. row 1
513
514 - ``V4L2_BUF_FLAG_MAPPED``
515
516 - 0x00000001
517
518 - The buffer resides in device memory and has been mapped into the
519 application's address space, see :ref:`mmap` for details.
520 Drivers set or clear this flag when the
521 :ref:`VIDIOC_QUERYBUF`,
522 :ref:`VIDIOC_QBUF` or
523 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl is called. Set by the
524 driver.
525
526 - .. row 2
527
528 - ``V4L2_BUF_FLAG_QUEUED``
529
530 - 0x00000002
531
532 - Internally drivers maintain two buffer queues, an incoming and
533 outgoing queue. When this flag is set, the buffer is currently on
534 the incoming queue. It automatically moves to the outgoing queue
535 after the buffer has been filled (capture devices) or displayed
536 (output devices). Drivers set or clear this flag when the
537 ``VIDIOC_QUERYBUF`` ioctl is called. After (successful) calling
538 the ``VIDIOC_QBUF``\ ioctl it is always set and after
539 ``VIDIOC_DQBUF`` always cleared.
540
541 - .. row 3
542
543 - ``V4L2_BUF_FLAG_DONE``
544
545 - 0x00000004
546
547 - When this flag is set, the buffer is currently on the outgoing
548 queue, ready to be dequeued from the driver. Drivers set or clear
549 this flag when the ``VIDIOC_QUERYBUF`` ioctl is called. After
550 calling the ``VIDIOC_QBUF`` or ``VIDIOC_DQBUF`` it is always
551 cleared. Of course a buffer cannot be on both queues at the same
552 time, the ``V4L2_BUF_FLAG_QUEUED`` and ``V4L2_BUF_FLAG_DONE`` flag
553 are mutually exclusive. They can be both cleared however, then the
554 buffer is in "dequeued" state, in the application domain so to
555 say.
556
557 - .. row 4
558
559 - ``V4L2_BUF_FLAG_ERROR``
560
561 - 0x00000040
562
563 - When this flag is set, the buffer has been dequeued successfully,
564 although the data might have been corrupted. This is recoverable,
565 streaming may continue as normal and the buffer may be reused
566 normally. Drivers set this flag when the ``VIDIOC_DQBUF`` ioctl is
567 called.
568
569 - .. row 5
570
571 - ``V4L2_BUF_FLAG_KEYFRAME``
572
573 - 0x00000008
574
575 - Drivers set or clear this flag when calling the ``VIDIOC_DQBUF``
576 ioctl. It may be set by video capture devices when the buffer
577 contains a compressed image which is a key frame (or field), i. e.
578 can be decompressed on its own. Also known as an I-frame.
579 Applications can set this bit when ``type`` refers to an output
580 stream.
581
582 - .. row 6
583
584 - ``V4L2_BUF_FLAG_PFRAME``
585
586 - 0x00000010
587
588 - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` this flags predicted frames
589 or fields which contain only differences to a previous key frame.
590 Applications can set this bit when ``type`` refers to an output
591 stream.
592
593 - .. row 7
594
595 - ``V4L2_BUF_FLAG_BFRAME``
596
597 - 0x00000020
598
599 - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` this flags a bi-directional
600 predicted frame or field which contains only the differences
601 between the current frame and both the preceding and following key
602 frames to specify its content. Applications can set this bit when
603 ``type`` refers to an output stream.
604
605 - .. row 8
606
607 - ``V4L2_BUF_FLAG_TIMECODE``
608
609 - 0x00000100
610
611 - The ``timecode`` field is valid. Drivers set or clear this flag
612 when the ``VIDIOC_DQBUF`` ioctl is called. Applications can set
613 this bit and the corresponding ``timecode`` structure when
614 ``type`` refers to an output stream.
615
616 - .. row 9
617
618 - ``V4L2_BUF_FLAG_PREPARED``
619
620 - 0x00000400
621
622 - The buffer has been prepared for I/O and can be queued by the
623 application. Drivers set or clear this flag when the
624 :ref:`VIDIOC_QUERYBUF`,
625 :ref:`VIDIOC_PREPARE_BUF <VIDIOC_QBUF>`,
626 :ref:`VIDIOC_QBUF` or
627 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl is called.
628
629 - .. row 10
630
631 - ``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE``
632
633 - 0x00000800
634
635 - Caches do not have to be invalidated for this buffer. Typically
636 applications shall use this flag if the data captured in the
637 buffer is not going to be touched by the CPU, instead the buffer
638 will, probably, be passed on to a DMA-capable hardware unit for
639 further processing or output.
640
641 - .. row 11
642
643 - ``V4L2_BUF_FLAG_NO_CACHE_CLEAN``
644
645 - 0x00001000
646
647 - Caches do not have to be cleaned for this buffer. Typically
648 applications shall use this flag for output buffers if the data in
649 this buffer has not been created by the CPU but by some
650 DMA-capable unit, in which case caches have not been used.
651
652 - .. row 12
653
654 - ``V4L2_BUF_FLAG_LAST``
655
656 - 0x00100000
657
658 - Last buffer produced by the hardware. mem2mem codec drivers set
659 this flag on the capture queue for the last buffer when the
660 :ref:`VIDIOC_QUERYBUF` or
661 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl is called. Due to
662 hardware limitations, the last buffer may be empty. In this case
663 the driver will set the ``bytesused`` field to 0, regardless of
664 the format. Any Any subsequent call to the
665 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl will not block anymore,
666 but return an ``EPIPE`` error code.
667
668 - .. row 13
669
670 - ``V4L2_BUF_FLAG_TIMESTAMP_MASK``
671
672 - 0x0000e000
673
674 - Mask for timestamp types below. To test the timestamp type, mask
675 out bits not belonging to timestamp type by performing a logical
676 and operation with buffer flags and timestamp mask.
677
678 - .. row 14
679
680 - ``V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN``
681
682 - 0x00000000
683
684 - Unknown timestamp type. This type is used by drivers before Linux
685 3.9 and may be either monotonic (see below) or realtime (wall
686 clock). Monotonic clock has been favoured in embedded systems
687 whereas most of the drivers use the realtime clock. Either kinds
688 of timestamps are available in user space via
689 :c:func:`clock_gettime(2)` using clock IDs ``CLOCK_MONOTONIC``
690 and ``CLOCK_REALTIME``, respectively.
691
692 - .. row 15
693
694 - ``V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC``
695
696 - 0x00002000
697
698 - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC``
699 clock. To access the same clock outside V4L2, use
700 :c:func:`clock_gettime(2)`.
701
702 - .. row 16
703
704 - ``V4L2_BUF_FLAG_TIMESTAMP_COPY``
705
706 - 0x00004000
707
708 - The CAPTURE buffer timestamp has been taken from the corresponding
709 OUTPUT buffer. This flag applies only to mem2mem devices.
710
711 - .. row 17
712
713 - ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK``
714
715 - 0x00070000
716
717 - Mask for timestamp sources below. The timestamp source defines the
718 point of time the timestamp is taken in relation to the frame.
719 Logical 'and' operation between the ``flags`` field and
720 ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` produces the value of the
721 timestamp source. Applications must set the timestamp source when
722 ``type`` refers to an output stream and
723 ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` is set.
724
725 - .. row 18
726
727 - ``V4L2_BUF_FLAG_TSTAMP_SRC_EOF``
728
729 - 0x00000000
730
731 - End Of Frame. The buffer timestamp has been taken when the last
732 pixel of the frame has been received or the last pixel of the
733 frame has been transmitted. In practice, software generated
734 timestamps will typically be read from the clock a small amount of
735 time after the last pixel has been received or transmitten,
736 depending on the system and other activity in it.
737
738 - .. row 19
739
740 - ``V4L2_BUF_FLAG_TSTAMP_SRC_SOE``
741
742 - 0x00010000
743
744 - Start Of Exposure. The buffer timestamp has been taken when the
745 exposure of the frame has begun. This is only valid for the
746 ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` buffer type.
747
748
749
750 .. _v4l2-memory:
751
752 enum v4l2_memory
753 ================
754
755 .. flat-table::
756 :header-rows: 0
757 :stub-columns: 0
758 :widths: 3 1 4
759
760
761 - .. row 1
762
763 - ``V4L2_MEMORY_MMAP``
764
765 - 1
766
767 - The buffer is used for :ref:`memory mapping <mmap>` I/O.
768
769 - .. row 2
770
771 - ``V4L2_MEMORY_USERPTR``
772
773 - 2
774
775 - The buffer is used for :ref:`user pointer <userp>` I/O.
776
777 - .. row 3
778
779 - ``V4L2_MEMORY_OVERLAY``
780
781 - 3
782
783 - [to do]
784
785 - .. row 4
786
787 - ``V4L2_MEMORY_DMABUF``
788
789 - 4
790
791 - The buffer is used for :ref:`DMA shared buffer <dmabuf>` I/O.
792
793
794
795 Timecodes
796 =========
797
798 The :ref:`struct v4l2_timecode <v4l2-timecode>` structure is designed to hold a
799 :ref:`smpte12m` or similar timecode. (struct
800 :c:type:`struct timeval` timestamps are stored in struct
801 :ref:`v4l2_buffer <v4l2-buffer>` field ``timestamp``.)
802
803
804 .. _v4l2-timecode:
805
806 struct v4l2_timecode
807 --------------------
808
809 .. flat-table::
810 :header-rows: 0
811 :stub-columns: 0
812 :widths: 1 1 2
813
814
815 - .. row 1
816
817 - __u32
818
819 - ``type``
820
821 - Frame rate the timecodes are based on, see :ref:`timecode-type`.
822
823 - .. row 2
824
825 - __u32
826
827 - ``flags``
828
829 - Timecode flags, see :ref:`timecode-flags`.
830
831 - .. row 3
832
833 - __u8
834
835 - ``frames``
836
837 - Frame count, 0 ... 23/24/29/49/59, depending on the type of
838 timecode.
839
840 - .. row 4
841
842 - __u8
843
844 - ``seconds``
845
846 - Seconds count, 0 ... 59. This is a binary, not BCD number.
847
848 - .. row 5
849
850 - __u8
851
852 - ``minutes``
853
854 - Minutes count, 0 ... 59. This is a binary, not BCD number.
855
856 - .. row 6
857
858 - __u8
859
860 - ``hours``
861
862 - Hours count, 0 ... 29. This is a binary, not BCD number.
863
864 - .. row 7
865
866 - __u8
867
868 - ``userbits``\ [4]
869
870 - The "user group" bits from the timecode.
871
872
873
874 .. _timecode-type:
875
876 Timecode Types
877 --------------
878
879 .. flat-table::
880 :header-rows: 0
881 :stub-columns: 0
882 :widths: 3 1 4
883
884
885 - .. row 1
886
887 - ``V4L2_TC_TYPE_24FPS``
888
889 - 1
890
891 - 24 frames per second, i. e. film.
892
893 - .. row 2
894
895 - ``V4L2_TC_TYPE_25FPS``
896
897 - 2
898
899 - 25 frames per second, i. e. PAL or SECAM video.
900
901 - .. row 3
902
903 - ``V4L2_TC_TYPE_30FPS``
904
905 - 3
906
907 - 30 frames per second, i. e. NTSC video.
908
909 - .. row 4
910
911 - ``V4L2_TC_TYPE_50FPS``
912
913 - 4
914
915 -
916
917 - .. row 5
918
919 - ``V4L2_TC_TYPE_60FPS``
920
921 - 5
922
923 -
924
925
926
927 .. _timecode-flags:
928
929 Timecode Flags
930 --------------
931
932 .. flat-table::
933 :header-rows: 0
934 :stub-columns: 0
935 :widths: 3 1 4
936
937
938 - .. row 1
939
940 - ``V4L2_TC_FLAG_DROPFRAME``
941
942 - 0x0001
943
944 - Indicates "drop frame" semantics for counting frames in 29.97 fps
945 material. When set, frame numbers 0 and 1 at the start of each
946 minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the
947 count.
948
949 - .. row 2
950
951 - ``V4L2_TC_FLAG_COLORFRAME``
952
953 - 0x0002
954
955 - The "color frame" flag.
956
957 - .. row 3
958
959 - ``V4L2_TC_USERBITS_field``
960
961 - 0x000C
962
963 - Field mask for the "binary group flags".
964
965 - .. row 4
966
967 - ``V4L2_TC_USERBITS_USERDEFINED``
968
969 - 0x0000
970
971 - Unspecified format.
972
973 - .. row 5
974
975 - ``V4L2_TC_USERBITS_8BITCHARS``
976
977 - 0x0008
978
979 - 8-bit ISO characters.
This page took 0.064081 seconds and 5 git commands to generate.