Commit ca425d4e authored by André Almeida's avatar André Almeida

Incapsulate query buffer

parent aebc5d37
......@@ -124,7 +124,18 @@ void v4l2_reqbuf(int fd, struct context ctx){
}
}
void v4l2_querybuf(int fd, struct context ctx){
void v4l2_querybuf(int fd, struct context ctx, int i, struct v4l2_plane *planes, struct v4l2_buffer *buf){
CLEAR(*buf);
CLEAR(*planes);
buf->type = ctx.buf_type;
buf->memory = ctx.mem_type;
buf->index = i;
buf->m.planes = planes;
buf->length = ctx.num_planes;
xioctl(fd, VIDIOC_QUERYBUF, buf);
}
......@@ -213,15 +224,7 @@ int main(int argc, char **argv)
/* for each buffer, allocate and set the planes */
for (i = 0; i < ctx.num_buffers; i++){
/* query the requested buffers */
CLEAR(buf);
CLEAR(planes);
buf.type = ctx.buf_type;
buf.memory = ctx.mem_type;
buf.index = i;
buf.m.planes = planes;
buf.length = ctx.num_planes;
xioctl(fd, VIDIOC_QUERYBUF, &buf);
v4l2_querybuf(fd, ctx, i, planes, &buf);
/* map planes offsets to buffers pointers */
for(j = 0; j < ctx.num_planes; j++){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment