diff options
author | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-03-11 13:12:08 +0100 |
---|---|---|
committer | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-03-11 13:12:08 +0100 |
commit | 17bb671ca3461d5aacfe3ca34adb4694a3b25949 (patch) | |
tree | 1a7ba11f5d526109f0d063cfb6c1bc7d4ed435bf /v4l2-apps/libv4l/libv4l2 | |
parent | 5f90628a20098c6dcde990310eaaabec2cef4694 (diff) | |
download | mediapointer-dvb-s2-17bb671ca3461d5aacfe3ca34adb4694a3b25949.tar.gz mediapointer-dvb-s2-17bb671ca3461d5aacfe3ca34adb4694a3b25949.tar.bz2 |
libv4l: avoid try_fmt on UVC cams if possible
From: Hans de Goede <hdegoede@redhat.com>
Avoid the use of try_fmt as much as possible on UVC cams, instead use the
results of the enum_framesizes ioctl. This is because:
1) try_fmt actually causes IO with UVC cams making apps which do lot of
querying of device capabilities slow (cheese)
2) some buggy cams don't like getting lots of UVC video probes and crash
when they do
Priority: normal
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l/libv4l2')
-rw-r--r-- | v4l2-apps/libv4l/libv4l2/libv4l2.c | 6 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4l2/log.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/v4l2-apps/libv4l/libv4l2/libv4l2.c b/v4l2-apps/libv4l/libv4l2/libv4l2.c index 314087255..2685b9e19 100644 --- a/v4l2-apps/libv4l/libv4l2/libv4l2.c +++ b/v4l2-apps/libv4l/libv4l2/libv4l2.c @@ -793,8 +793,12 @@ int v4l2_ioctl (int fd, unsigned long int request, ...) &src_fmt); } - if (result) + if (result) { + saved_err = errno; + V4L2_LOG("S_FMT error trying format: %s\n", strerror(errno)); + errno = saved_err; break; + } if (src_fmt.fmt.pix.pixelformat != dest_fmt->fmt.pix.pixelformat && v4l2_log_file) { diff --git a/v4l2-apps/libv4l/libv4l2/log.c b/v4l2-apps/libv4l/libv4l2/log.c index 6237d55ec..437b51d3e 100644 --- a/v4l2-apps/libv4l/libv4l2/log.c +++ b/v4l2-apps/libv4l/libv4l2/log.c @@ -18,6 +18,8 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <errno.h> #include <linux/ioctl.h> /* These headers are not needed by us, but by linux/videodev2.h, which is broken on some systems and doesn't include them itself :( */ @@ -95,6 +97,7 @@ void v4l2_log_ioctl(unsigned long int request, void *arg, int result) { const char *ioctl_str; char buf[40]; + int saved_errno = errno; if (!v4l2_log_file) return; @@ -143,6 +146,10 @@ void v4l2_log_ioctl(unsigned long int request, void *arg, int result) break; } - fprintf(v4l2_log_file, "result == %d\n", result); + if (result < 0) + fprintf(v4l2_log_file, "result == %d (%s)\n", result, strerror(saved_errno)); + else + fprintf(v4l2_log_file, "result == %d\n", result); + fflush(v4l2_log_file); } |