summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-04-10 13:34:07 +0200
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-04-10 13:34:07 +0200
commit47b68b12ace2d6414547991a02fda32a4ae748f7 (patch)
treeb352edecbc1cfbf3eae7efff6390ce4063791edb
parent8fabb280152af70dddc25fd3c57a346b94326a33 (diff)
downloadmediapointer-dvb-s2-47b68b12ace2d6414547991a02fda32a4ae748f7.tar.gz
mediapointer-dvb-s2-47b68b12ace2d6414547991a02fda32a4ae748f7.tar.bz2
libv4l: Add support to use orientation from VIDIOC_ENUMINPUT
From: Adam Baker <linux@baker-net.org.uk> Add check to libv4l of the sensor orientation as reported by VIDIOC_ENUMINPUT Priority: normal Signed-off-by: Adam Baker <linux@baker-net.org.uk> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--v4l2-apps/libv4l/ChangeLog6
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/v4l2-apps/libv4l/ChangeLog b/v4l2-apps/libv4l/ChangeLog
index 9b029d68b..9c9a5a3b2 100644
--- a/v4l2-apps/libv4l/ChangeLog
+++ b/v4l2-apps/libv4l/ChangeLog
@@ -1,3 +1,9 @@
+libv4l-0.5.11
+-------------
+* Add dependency generation to libv4l by: Gilles Gigan <gilles.gigan@gmail.com>
+* Add support to use orientation from VIDIOC_ENUMINPUT by:
+ Adam Baker <linux@baker-net.org.uk>
+
libv4l-0.5.10
-------------
* sn9c20x cams have occasional bad jpeg frames, drop these to avoid the
diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
index f11922f3d..f3191f1d9 100644
--- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
+++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
@@ -29,6 +29,11 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ARRAY_SIZE(x) ((int)sizeof(x)/(int)sizeof((x)[0]))
+/* Workaround this potentially being missing from videodev2.h */
+#ifndef V4L2_IN_ST_VFLIP
+#define V4L2_IN_ST_VFLIP 0x00000020 /* Output is flipped vertically */
+#endif
+
/* Note for proper functioning of v4lconvert_enum_fmt the first entries in
supported_src_pixfmts must match with the entries in supported_dst_pixfmts */
#define SUPPORTED_DST_PIXFMTS \
@@ -179,6 +184,7 @@ struct v4lconvert_data *v4lconvert_create(int fd)
int i, j;
struct v4lconvert_data *data = calloc(1, sizeof(struct v4lconvert_data));
struct v4l2_capability cap;
+ struct v4l2_input input;
if (!data)
return NULL;
@@ -206,6 +212,13 @@ struct v4lconvert_data *v4lconvert_create(int fd)
/* Check if this cam has any special flags */
data->flags = v4lconvert_get_flags(data->fd);
+ if ((syscall(SYS_ioctl, fd, VIDIOC_G_INPUT, &input.index) == 0) &&
+ (syscall(SYS_ioctl, fd, VIDIOC_ENUMINPUT, &input) == 0)) {
+ /* Don't yet support independent HFLIP and VFLIP so getting
+ * image the right way up is highest priority. */
+ if (input.status & V4L2_IN_ST_VFLIP)
+ data->flags |= V4LCONVERT_ROTATE_180;
+ }
if (syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap) == 0) {
if (!strcmp((char *)cap.driver, "uvcvideo"))
data->flags |= V4LCONVERT_IS_UVC;