【v4l2】vb2_buffer和v4l2_buffer

【v4l2】vb2_buffer和v4l2_buffer,第1张

概述videobuf2-core.h中的vb2_buffer,记录了v4l2_buffer ,驱动可以对vb2_buffer的v4l2_buffer进行 *** 控, vb2_buffer是v4l2框架层的代码,而v4l2_buffer也是用户空间的应用程序,可以读取的一个数据结构。 videobuf2-core.h: 165 166 /**167 * struct vb2_buffer - repres
vIDeobuf2-core.h中的vb2_buffer,记录了v4l2_buffer ,驱动可以对vb2_buffer的v4l2_buffer进行 *** 控,
vb2_buffer是v4l2框架层的代码,而v4l2_buffer也是用户空间的应用程序,可以读取的一个数据结构。
vIDeobuf2-core.h:

165 166 /**167 * struct vb2_buffer - represents a vIDeo buffer168  * @v4l2_buf: struct v4l2_buffer associated with this buffer; can169 * be read by the driver and relevant entrIEs can be170 * changed by the driver in case of CAPTURE types171 * (such as timestamp)172 * @v4l2_planes: struct v4l2_planes associated with this buffer; can173174175 * (such as bytesused); NOTE that even for single-planar176 * types,the v4l2_planes[0] struct should be used177 * instead of v4l2_buf for filling bytesused - drivers178 * should use the vb2_set_plane_payload() function for that179  * @vb2_queue: the queue to which this driver belongs180 * @num_planes: number of planes in the buffer181 * on an internal driver queue182 * @state: current buffer state; do not change183  * @queued_entry: entry on the queued buffers List,which holds all184  * buffers queued from userspace185  * @done_entry: entry on the List that stores all buffers ready to186  * be dequeued to userspace187 * @planes: private per-plane information; do not change188 */189 struct vb2_buffer {190         struct v4l2_buffer      v4l2_buf;191         struct v4l2_plane       v4l2_planes[VIDEO_MAX_PLANES];192 193         struct vb2_queue        *vb2_queue;194 195         unsigned int            num_planes;196 197/* Private: internal use only */198         enum vb2_buffer_state   state;199200         struct list_head        queued_entry;201         struct list_head        done_entry;202 203         struct vb2_plane        planes[];204 };

 
vIDeodev2.h,用户应用程序与驱动交互:
617618 * struct v4l2_buffer - vIDeo buffer info619 * @index: ID number of the buffer620 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for621 * multiplanar buffers);622  * @bytesused: number of bytes occupIEd by data in the buffer (payload);623  * unused (set to 0) for multiplanar buffers624 * @flags: buffer informational flags625 * @fIEld: enum v4l2_fIEld; fIEld order of the image in the buffer626 * @timestamp: frame timestamp627 * @timecode: frame timecode628 * @sequence: sequence count of this frame629 * @memory: enum v4l2_memory; the method,in which the actual vIDeo data is630 * passed631 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;632 * offset from the start of the device memory for this plane,633 * (or a "cookie" that should be passed to mmap() as offset)634 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;635 * a userspace pointer pointing to this buffer636 * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF;637 * a userspace file descriptor associated with this buffer638 * @planes: for multiplanar buffers; userspace pointer to the array of plane639 * info structs for this buffer640 * @length: size in bytes of the buffer (NOT its payload) for single-plane641 * buffers (when type != *_MPLANE); number of elements in the642 * planes array for multi-plane buffers643 * @input: input number from which the vIDeo data has has been captured644 *645 * Contains data exchanged by application and driver using one of the Streaming646 * I/O methods.647648 struct v4l2_buffer {649         __u32                   index;650                   type;651                   bytesused;652                   flags;653                   field;654         struct timeval          timestamp;655         struct v4l2_timecode    timecode;656                   sequence;657 658         /* memory location */659                   memory;660         union {661                            offset;662                 unsigned long   userptr;663                 struct  *planes;664                 __s32           fd;665         } m;666                   length;667                   reserved2;668                   reserved;669 };
vb2_buf维护了两个线性链表,可以参考 http://blog.sina.com.cn/s/blog_602f87700101bmvu.html
总结

以上是内存溢出为你收集整理的【v4l2】vb2_buffer和v4l2_buffer全部内容,希望文章能够帮你解决【v4l2】vb2_buffer和v4l2_buffer所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1275805.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存