summaryrefslogtreecommitdiff
path: root/videoout.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-06-12 16:46:25 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-11-12 17:00:50 +0200
commit30aab83c0433a9c2b51fdeaaf01aba8c8bef259c (patch)
tree2b48119a6e160c987cae02f89198dacb3b44905e /videoout.c
parent7aa0337975506ad37fc793e184c52713a2ca411b (diff)
videoout: Add rotation support
Diffstat (limited to 'videoout.c')
-rw-r--r--videoout.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/videoout.c b/videoout.c
index 51bed8b..f12ee68 100644
--- a/videoout.c
+++ b/videoout.c
@@ -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;