diff options
-rw-r--r-- | live.c | 7 | ||||
-rw-r--r-- | videoout.c | 12 | ||||
-rw-r--r-- | videoout.h | 4 |
3 files changed, 15 insertions, 8 deletions
@@ -385,6 +385,7 @@ int main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unu { struct v4l2_mbus_framefmt view_format; struct v4l2_buffers_pool *pool = NULL; + struct v4l2_pix_format format; struct timespec start, end; unsigned int buffers = 3; struct v4l2_rect rect; @@ -455,7 +456,11 @@ int main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unu goto cleanup; } - vo = vo_init(vo_devname, &vo_ops, buffers, rect.width, rect.height); + memset(&format, 0, sizeof format); + format.pixelformat = V4L2_PIX_FMT_YUYV; + format.width = rect.width; + format.height = rect.height; + vo = vo_init(vo_devname, &vo_ops, buffers, &format); if (vo == NULL) { printf("error: unable to initialize video output\n"); goto cleanup; @@ -54,7 +54,7 @@ struct videoout struct videoout *vo_init(const char *devname, const struct video_out_operations *ops, unsigned int buffers, - unsigned int width, unsigned int height) + struct v4l2_pix_format *format) { struct v4l2_pix_format pixfmt; struct v4l2_format fmt; @@ -76,9 +76,9 @@ struct videoout *vo_init(const char *devname, goto error; } - pixfmt.pixelformat = V4L2_PIX_FMT_YUYV; - pixfmt.width = width; - pixfmt.height = height; + pixfmt.pixelformat = format->pixelformat; + pixfmt.width = format->width; + pixfmt.height = format->height; pixfmt.field = V4L2_FIELD_ANY; ret = v4l2_set_format(vo->dev, &pixfmt); @@ -90,8 +90,8 @@ struct videoout *vo_init(const char *devname, fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; fmt.fmt.win.w.left = 0; fmt.fmt.win.w.top = 0; - fmt.fmt.win.w.width = width; - fmt.fmt.win.w.height = height; + fmt.fmt.win.w.width = format->width; + fmt.fmt.win.w.height = format->height; ret = ioctl(vo->dev->fd, VIDIOC_S_FMT, &fmt); if (ret < 0) { perror("VIDIOC_S_FMT(overlay)\n"); @@ -23,6 +23,8 @@ #ifndef __VIDEOOUT_H__ #define __VIDEOOUT_H__ +#include <linux/videodev2.h> + #include "isp/v4l2-pool.h" struct videoout; @@ -35,7 +37,7 @@ struct video_out_operations { struct videoout *vo_init(const char *devname, const struct video_out_operations *ops, unsigned int buffers, - unsigned int width, unsigned int height); + struct v4l2_pix_format *format); void vo_cleanup(struct videoout *vo); int vo_enable_colorkey(struct videoout *vo, unsigned int val); struct v4l2_buffers_pool *vo_get_pool(struct videoout *vo); |