1
2
3
4
5
6
7
8
9
10
11
12#ifndef _MEDIA_VIDEOBUF2_V4L2_H
13#define _MEDIA_VIDEOBUF2_V4L2_H
14
15#include <linux/videodev2.h>
16#include <media/videobuf2-core.h>
17
18#if VB2_MAX_FRAME != VIDEO_MAX_FRAME
19#error VB2_MAX_FRAME != VIDEO_MAX_FRAME
20#endif
21
22#if VB2_MAX_PLANES != VIDEO_MAX_PLANES
23#error VB2_MAX_PLANES != VIDEO_MAX_PLANES
24#endif
25
26
27
28
29
30
31
32
33
34
35
36struct vb2_v4l2_buffer {
37 struct vb2_buffer vb2_buf;
38
39 __u32 flags;
40 __u32 field;
41 struct v4l2_timecode timecode;
42 __u32 sequence;
43};
44
45
46
47
48#define to_vb2_v4l2_buffer(vb) \
49 container_of(vb, struct vb2_v4l2_buffer, vb2_buf)
50
51int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
52int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
53
54int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
55int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
56
57int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
58int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb);
59int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
60
61int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
62int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type);
63
64int __must_check vb2_queue_init(struct vb2_queue *q);
65void vb2_queue_release(struct vb2_queue *q);
66unsigned int vb2_poll(struct vb2_queue *q, struct file *file,
67 poll_table *wait);
68
69
70
71
72
73
74
75
76
77
78
79int vb2_ioctl_reqbufs(struct file *file, void *priv,
80 struct v4l2_requestbuffers *p);
81int vb2_ioctl_create_bufs(struct file *file, void *priv,
82 struct v4l2_create_buffers *p);
83int vb2_ioctl_prepare_buf(struct file *file, void *priv,
84 struct v4l2_buffer *p);
85int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p);
86int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
87int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
88int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
89int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);
90int vb2_ioctl_expbuf(struct file *file, void *priv,
91 struct v4l2_exportbuffer *p);
92
93
94
95int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma);
96int vb2_fop_release(struct file *file);
97int _vb2_fop_release(struct file *file, struct mutex *lock);
98ssize_t vb2_fop_write(struct file *file, const char __user *buf,
99 size_t count, loff_t *ppos);
100ssize_t vb2_fop_read(struct file *file, char __user *buf,
101 size_t count, loff_t *ppos);
102unsigned int vb2_fop_poll(struct file *file, poll_table *wait);
103#ifndef CONFIG_MMU
104unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr,
105 unsigned long len, unsigned long pgoff, unsigned long flags);
106#endif
107
108
109
110void vb2_ops_wait_prepare(struct vb2_queue *vq);
111void vb2_ops_wait_finish(struct vb2_queue *vq);
112
113#endif
114