Commit 79aa2ba1 authored by André Almeida's avatar André Almeida
Browse files

Incapsulate get format

parent 49c6c629
......@@ -96,6 +96,19 @@ void v4l2_s_fmt(int fd, struct context ctx){
void v4l2_g_fmt(int fd, struct context ctx){
struct v4l2_format fmt;
//fmt.type = ctx.buf_type;
xioctl(fd, VIDIOC_G_FMT, &fmt);
__u8 num_planes = fmt.fmt.pix_mp.num_planes;
printf("Number of planes: %d\n", num_planes);
for(int i = 0; i < num_planes; i++){
__u32 b = fmt.fmt.pix_mp.plane_fmt[i].sizeimage;
printf("Plane[%d].sizeimage = %u\n", i, b);
void v4l2_reqbuf(int fd, struct context ctx){
struct v4l2_requestbuffers req;
......@@ -175,6 +188,11 @@ int main(int argc, char **argv)
/* Setting image format */
v4l2_s_fmt(fd, ctx);
/* Getting image format */
#ifdef DBG_PRINT
v4l2_g_fmt(fd, ctx);
/* Requiring buffers */
v4l2_reqbuf(fd, ctx);
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