STRUCT V4L2_BUFFER(9)
struct v4l2_buffer(9) π
okay bestie, welcome to the Kernel API Manual page for struct v4l2_buffer β literally the video buffer info struct, and yes it's giving very "main character data exchange" energy β¨
NAME π
struct v4l2_buffer β video buffer info
SYNOPSIS π¦
struct v4l2_buffer {
__u32 index;
__u32 type;
__u32 bytesused;
__u32 flags;
__u32 field;
#ifdef __KERNEL__;
struct __kernel_v4l2_timeval timestamp;
#else;
struct timeval timestamp;
#endif;
struct v4l2_timecode timecode;
__u32 sequence;
__u32 memory;
union {
__u32 offset;
unsigned long userptr;
struct v4l2_plane *planes;
__s32 fd;
} m;
__u32 length;
__u32 reserved2;
union {
__s32 request_fd;
__u32 reserved;
};
};
Members π
indexβ id number of the buffertypeβenum v4l2_buf_type; buffer type (type == *_MPLANEfor multiplanar buffers)bytesusedβ number of bytes occupied by data in the buffer (payload); unused (set to 0) for multiplanar buffersflagsβ buffer informational flagsfieldβenum v4l2_field; field order of the image in the buffertimestampβ frame timestamptimestampβ frame timestamp (yes bestie, it really is listed twice on this page β we're keeping both, no cap)timecodeβ frame timecodesequenceβ sequence count of this framememoryβenum v4l2_memory; the method, in which the actual video data is passedmβ union ofoffset,userptr,planesandfdm.offsetβ for non-multiplanar buffers withmemory == V4L2_MEMORY_MMAP; offset from the start of the device memory for this plane, (or a "cookie" that should be passed tommapas offset)m.userptrβ for non-multiplanar buffers withmemory == V4L2_MEMORY_USERPTR; a userspace pointer pointing to this bufferm.planesβ for multiplanar buffers; userspace pointer to the array of plane info structs for this bufferm.fdβ for non-multiplanar buffers withmemory == V4L2_MEMORY_DMABUF; a userspace file descriptor associated with this bufferlengthβ size in bytes of the buffer (NOT its payload) for single-plane buffers (whentype != *_MPLANE); number of elements in the planes array for multi-plane buffersreserved2β drivers and applications must zero this field{unnamed_union}β anonymousrequest_fdβ fd of the request that this buffer should usereservedβ for backwards compatibility with applications that do not know aboutrequest_fd
Description πΈ
Contains data exchanged by application and driver using one of the Streaming I/O methods. That's the whole vibe: this struct is the little messenger carrying buffer info back and forth π
SEE ALSO π₯
Kernel file ./include/uapi/linux/videodev2.h, plus these iconic little references:
struct v4l2_capability(9)struct v4l2_plane(9)v4l2_timeval_to_ns(9)struct v4l2_exportbuffer(9)struct v4l2_selection(9)struct v4l2_plane_pix_format(9)struct v4l2_pix_format_mplane(9)struct v4l2_sdr_format(9)struct v4l2_meta_format(9)struct v4l2_format(9)struct v4l2_event_motion_det(9)struct v4l2_create_buffers(9)struct v4l2_remove_buffers(9)
mwah π this page's source/version footer lives in ./include/uapi/linux, dated October 2026 β and honestly? iconic. periodt. π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms