diff options
author | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-08-07 19:34:10 +0200 |
---|---|---|
committer | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-08-07 19:34:10 +0200 |
commit | a63e58c8101caacfc5f82b66de79e794adf0ca3a (patch) | |
tree | eb3169564733ab43c9bef40c22596adafef820a7 /v4l2-apps/lib/libv4l/libv4l2 | |
parent | cfbd2d6622d7a75929f34972ca407acb4437d3d2 (diff) | |
download | mediapointer-dvb-s2-a63e58c8101caacfc5f82b66de79e794adf0ca3a.tar.gz mediapointer-dvb-s2-a63e58c8101caacfc5f82b66de79e794adf0ca3a.tar.bz2 |
libv4l: add support for fixing upside down images to libv4lconvert
From: Hans de Goede <j.w.r.degoede@hhs.nl>
Add support to libv4lconvert to flipping the image for upside down mounted
sensors, libv4lconvert will do this automatically if the webcam sets a
flag in its query_fmt reply indicating that this is necessary, this fixes
the upside down image on Philips SPC200NC images
Priority: normal
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l2')
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l2/libv4l2.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c b/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c index a40ab4ffe..dd43d938f 100644 --- a/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c +++ b/v4l2-apps/lib/libv4l/libv4l2/libv4l2.c @@ -614,7 +614,8 @@ int v4l2_ioctl (int fd, unsigned long int request, ...) is_capture_request = 1; break; case VIDIOC_ENUM_FMT: - if (((struct v4l2_fmtdesc *)arg)->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (((struct v4l2_fmtdesc *)arg)->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && + (devices[index].flags & V4L2_ENABLE_ENUM_FMT_EMULATION)) is_capture_request = 1; break; case VIDIOC_TRY_FMT: @@ -663,9 +664,8 @@ int v4l2_ioctl (int fd, unsigned long int request, ...) if (stream_needs_locking) pthread_mutex_lock(&devices[index].stream_lock); - converting = devices[index].src_fmt.fmt.pix.pixelformat != - devices[index].dest_fmt.fmt.pix.pixelformat; - + converting = v4lconvert_needs_conversion(devices[index].convert, + &devices[index].src_fmt, &devices[index].dest_fmt); switch (request) { case VIDIOC_QUERYCAP: @@ -914,8 +914,8 @@ ssize_t v4l2_read (int fd, void* buffer, size_t n) /* When not converting and the device supports read let the kernel handle it */ if ((devices[index].flags & V4L2_SUPPORTS_READ) && - devices[index].src_fmt.fmt.pix.pixelformat == - devices[index].dest_fmt.fmt.pix.pixelformat) { + !v4lconvert_needs_conversion(devices[index].convert, + &devices[index].src_fmt, &devices[index].dest_fmt)) { result = syscall(SYS_read, fd, buffer, n); goto leave; } @@ -988,8 +988,8 @@ void *v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, buffer_index = offset & 0xff; if (buffer_index >= devices[index].no_frames || /* Got magic offset and not converting ?? */ - devices[index].src_fmt.fmt.pix.pixelformat == - devices[index].dest_fmt.fmt.pix.pixelformat) { + !v4lconvert_needs_conversion(devices[index].convert, + &devices[index].src_fmt, &devices[index].dest_fmt)) { errno = EINVAL; result = MAP_FAILED; goto leave; |