From f475df33ab13799d25650081e64fd0f6e59d3792 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 17 Jun 2009 21:57:05 +0200 Subject: libv4l1: Emulate VIDIOCGWIN instead of passing it through to the kernel From: Hans de Goede Emulate VIDIOCGWIN instead of passing it through to the kernel, this fixes us reporting a wrong size to the app when libv4l2 / libv4lconvert is cropping / downsampling the image. Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/libv4l1.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'v4l2-apps') diff --git a/v4l2-apps/libv4l/libv4l1/libv4l1.c b/v4l2-apps/libv4l/libv4l1/libv4l1.c index 4d251a481..9b23926be 100644 --- a/v4l2-apps/libv4l/libv4l1/libv4l1.c +++ b/v4l2-apps/libv4l/libv4l1/libv4l1.c @@ -307,7 +307,7 @@ int v4l1_open (const char *file, int oflag, ...) /* Register with libv4l2, as we use that todo format conversion and read() emulation for us */ - if (v4l2_fd_open(fd, V4L2_ENABLE_ENUM_FMT_EMULATION) == -1) { + if (v4l2_fd_open(fd, 0) == -1) { int saved_err = errno; SYS_CLOSE(fd); errno = saved_err; @@ -542,24 +542,27 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) break; case VIDIOCSWIN: + case VIDIOCGWIN: { struct video_window *win = arg; devices[index].flags |= V4L1_PIX_SIZE_TOUCHED; - result = v4l1_set_format(index, win->width, win->height, -1, 1); + if (request == VIDIOCSWIN) + result = v4l1_set_format(index, win->width, win->height, -1, 1); + else + result = 0; + if (result == 0) { + win->x = 0; + win->y = 0; win->width = devices[index].width; win->height = devices[index].height; + win->flags = 0; } } break; - case VIDIOCGWIN: - devices[index].flags |= V4L1_PIX_SIZE_TOUCHED; - result = SYS_IOCTL(fd, request, arg); - break; - case VIDIOCGCHAN: { struct v4l2_input input2; -- cgit v1.2.3