diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-06-12 16:46:25 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-11-12 17:00:50 +0200 |
commit | 30aab83c0433a9c2b51fdeaaf01aba8c8bef259c (patch) | |
tree | 2b48119a6e160c987cae02f89198dacb3b44905e | |
parent | 7aa0337975506ad37fc793e184c52713a2ca411b (diff) |
videoout: Add rotation support
-rw-r--r-- | live.c | 2 | ||||
-rw-r--r-- | videoout.c | 11 | ||||
-rw-r--r-- | videoout.h | 3 |
3 files changed, 13 insertions, 3 deletions
@@ -879,7 +879,7 @@ int main(int argc __attribute__((__unused__)), char *argv[] __attribute__((__unu format.pixelformat = V4L2_PIX_FMT_YUYV; format.width = rect.width; format.height = rect.height; - vo = vo_init(vo_devname, &vo_ops, buffers, &format); + vo = vo_init(vo_devname, &vo_ops, buffers, &format, 0); if (vo == NULL) { printf("error: unable to initialize video output\n"); goto cleanup; @@ -54,11 +54,13 @@ struct videoout struct videoout *vo_init(const char *devname, const struct video_out_operations *ops, unsigned int buffers, - struct v4l2_pix_format *format) + struct v4l2_pix_format *format, + unsigned int rotation) { struct v4l2_pix_format pixfmt; struct v4l2_format fmt; struct videoout *vo; + int32_t ctrl; int ret; /* Allocate the video output object. */ @@ -76,6 +78,13 @@ struct videoout *vo_init(const char *devname, goto error; } + ctrl = rotation; + ret = v4l2_set_control(vo->dev, V4L2_CID_ROTATE, &ctrl); + if (ret < 0) { + perror("failed to configure rotation\n"); + goto error; + } + pixfmt.pixelformat = format->pixelformat; pixfmt.width = format->width; pixfmt.height = format->height; @@ -37,7 +37,8 @@ struct video_out_operations { struct videoout *vo_init(const char *devname, const struct video_out_operations *ops, unsigned int buffers, - struct v4l2_pix_format *format); + struct v4l2_pix_format *format, + unsigned int rotation); void vo_cleanup(struct videoout *vo); int vo_enable_colorkey(struct videoout *vo, unsigned int val); |