summaryrefslogtreecommitdiff
path: root/v4l2-apps/libv4l/libv4l1
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-04-14 15:03:07 +0200
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-04-14 15:03:07 +0200
commit58d3334b54c207b8e04e7035969e0c2acfa1ce73 (patch)
tree79bfcb91241d0468871696b189ac8ee344ea1ed0 /v4l2-apps/libv4l/libv4l1
parent10a09b9ec6e08fb95c36f26d7f69834b0387386b (diff)
downloadmediapointer-dvb-s2-58d3334b54c207b8e04e7035969e0c2acfa1ce73.tar.gz
mediapointer-dvb-s2-58d3334b54c207b8e04e7035969e0c2acfa1ce73.tar.bz2
libv4l: Only allow supported destination formats when doing processing
From: Hans de Goede <hdegoede@redhat.com> Only report / allow supported destination formats in enum_fmt / try_fmt / g_fmt / s_fmt when processing, rotating or flipping. Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l/libv4l1')
-rw-r--r--v4l2-apps/libv4l/libv4l1/libv4l1.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/v4l2-apps/libv4l/libv4l1/libv4l1.c b/v4l2-apps/libv4l/libv4l1/libv4l1.c
index 797c8768a..a7de0af8e 100644
--- a/v4l2-apps/libv4l/libv4l1/libv4l1.c
+++ b/v4l2-apps/libv4l/libv4l1/libv4l1.c
@@ -155,8 +155,10 @@ static int v4l1_set_format(int index, unsigned int width,
/* Do we need to change the resolution / format ? */
if (width == devices[index].width && height == devices[index].height &&
- v4l2_pixfmt == devices[index].v4l2_pixfmt)
+ v4l2_pixfmt == devices[index].v4l2_pixfmt) {
+ devices[index].v4l1_pal = v4l1_pal;
return 0;
+ }
/* Get current settings, apply our changes and try the new setting */
if ((result = v4l2_ioctl(devices[index].fd, VIDIOC_G_FMT, &fmt2))) {
@@ -308,19 +310,18 @@ int v4l1_open (const char *file, int oflag, ...)
if (!v4l2_log_file)
v4l2_log_file = v4l1_log_file;
- /* Get initial width, height and pixelformat */
- fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (syscall(SYS_ioctl, fd, VIDIOC_G_FMT, &fmt2)) {
+ /* 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) {
int saved_err = errno;
- V4L1_LOG_ERR("getting pixformat: %s\n", strerror(errno));
syscall(SYS_close, fd);
errno = saved_err;
return -1;
}
- /* 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) {
+ /* Get initial width, height and pixelformat */
+ fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ if (v4l2_ioctl(fd, VIDIOC_G_FMT, &fmt2)) {
int saved_err = errno;
syscall(SYS_close, fd);
errno = saved_err;