From e6a853deb196982b1b857f651195a41695c324dd Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:06:48 +0100 Subject: libv4l: Do not link the wrapper libs against libphread From: Gregor Jasny libv4l: Do not link the wrapper libs against libphread Priority: normal Signed-off-by: Gregor Jasny Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index 27848477e..7687a0a7c 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -3,7 +3,7 @@ override CPPFLAGS += -I../include -I../../../include -fvisibility=hidden CFLAGS := -g -O1 CFLAGS += -Wall -Wno-unused -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -LIBS = -lpthread +LIBS_libv4l1 = -lpthread V4L1_OBJS = libv4l1.o log.o V4L1COMPAT = v4l1compat.so @@ -75,7 +75,7 @@ clean:: $(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $< %.so: - $(CC) -shared $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ $(LIBS) + $(CC) -shared $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ $(LIBS_$*) ln -f -s $@.$(LIB_RELEASE) $@ %.a: -- cgit v1.2.3 From 093f82628ef903225b639005aaf13516e5144db1 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:17:15 +0100 Subject: libv4l: Use Requires.private where appropiate in .pc files From: Gregor Jasny Use Requires.private where appropiate in .pc files. Priority: normal Signed-off-by: Gregor Jasny Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index 7687a0a7c..80ba282a5 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -46,7 +46,7 @@ libv4l1.pc: @echo 'Name: libv4l1' >> libv4l1.pc @echo 'Description: v4l1 compatibility library' >> libv4l1.pc @echo 'Version: '$(V4L2_LIB_VERSION) >> libv4l1.pc - @echo 'Requires: libv4l2' >> libv4l1.pc + @echo 'Requires.private: libv4l2' >> libv4l1.pc @echo 'Libs: -L$${libdir} -lv4l1' >> libv4l1.pc @echo 'Libs.private: -lpthread' >> libv4l1.pc @echo 'Cflags: -I$${prefix}/include' >> libv4l1.pc -- cgit v1.2.3 From 26c68ea445a12d980b119bf2883329dc1cf801a0 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:27:13 +0100 Subject: libv4l: remove .orig and .rej files on make clean and simplify make export From: Hans de Goede libv4l: remove .orig and .rej files on make clean and simplify make export Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index 80ba282a5..9f30cbb0f 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -69,7 +69,7 @@ endif install -m 644 libv4l1.pc $(DESTDIR)$(LIBDIR)/pkgconfig clean:: - rm -f *.a *.so* *.o *.d libv4l1.pc log *~ + rm -f *.a *.so* *.o *.d libv4l1.pc log *~ *.orig *.rej %.o: %.c $(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $< -- cgit v1.2.3 From 8fabb280152af70dddc25fd3c57a346b94326a33 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Fri, 10 Apr 2009 13:29:11 +0200 Subject: libv4l: Adds Makefile pre-requisites to libv4l From: Gilles Gigan This patch update libv4l's Makefiles so they automatically update and include dependency information for each source file. Priority: normal Signed-off-by: Gilles Gigan Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index 9f30cbb0f..d228cc916 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -13,9 +13,10 @@ INCLUDES = ../include/libv4l1.h ifeq ($(LINKTYPE),static) V4L1_LIB = libv4l1.a +V4L1_DEPS = $(V4L1_OBJS) else V4L1_LIB = libv4l1.so -V4L1_OBJS += ../libv4l2/libv4l2.so +V4L1_DEPS += $(V4L1_OBJS) ../libv4l2/libv4l2.so TARGETS += $(V4L1COMPAT) override CPPFLAGS += -fPIC endif @@ -34,8 +35,9 @@ endif all: $(TARGETS) +include $(V4L1_OBJS:.o=.d) -$(V4L1_LIB): $(V4L1_OBJS) +$(V4L1_LIB): $(V4L1_DEPS) $(V4L1COMPAT): $(V4L1COMPAT_O) $(V4L1_LIB) @@ -71,8 +73,12 @@ endif clean:: rm -f *.a *.so* *.o *.d libv4l1.pc log *~ *.orig *.rej +%.d: %.c + @set -e; rm -f $@; \ + gcc -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ + %.o: %.c - $(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< %.so: $(CC) -shared $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ $(LIBS_$*) -- cgit v1.2.3 From 58d3334b54c207b8e04e7035969e0c2acfa1ce73 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Tue, 14 Apr 2009 15:03:07 +0200 Subject: libv4l: Only allow supported destination formats when doing processing From: Hans de Goede 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 --- v4l2-apps/libv4l/libv4l1/libv4l1.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') 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; -- cgit v1.2.3 From 9fdc384d90d5bfd705bd5d619d2a7fbdd93aeaf0 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Thu, 16 Apr 2009 10:52:39 +0200 Subject: libv4l: Makefiles: better dependency generation From: Gregor Jasny libv4l: Makefiles: better dependency generation Priority: normal Signed-off-by: Gregor Jasny Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index d228cc916..bd6687e1a 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -35,7 +35,7 @@ endif all: $(TARGETS) -include $(V4L1_OBJS:.o=.d) +-include $(V4L1_OBJS:.o=.d) $(V4L1_LIB): $(V4L1_DEPS) @@ -73,12 +73,8 @@ endif clean:: rm -f *.a *.so* *.o *.d libv4l1.pc log *~ *.orig *.rej -%.d: %.c - @set -e; rm -f $@; \ - gcc -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ - %.o: %.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -Wp,-MMD,"$*.d",-MQ,"$@",-MP -c $(CPPFLAGS) $(CFLAGS) -o $@ $< %.so: $(CC) -shared $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ $(LIBS_$*) -- cgit v1.2.3 From 5999b7d164dbf3118a3a75ee3f6f0b48cb8845c1 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Tue, 2 Jun 2009 15:34:34 +0200 Subject: libv4l: initial support for compiling on FreeBSD From: Hans Petter Selasky Add a patch by Hans Petter Selasky , which should lead to allowing use of libv4l (and the Linux webcam drivers ported to userspace usb drivers) on FreeBSd, this is a work in progress Priority: normal Signed-off-by: Hans Petter Selasky Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/libv4l1-priv.h | 9 +------ v4l2-apps/libv4l/libv4l1/libv4l1.c | 46 ++++++++++++++------------------- v4l2-apps/libv4l/libv4l1/log.c | 7 +---- v4l2-apps/libv4l/libv4l1/v4l1compat.c | 5 ++++ 4 files changed, 27 insertions(+), 40 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/libv4l1-priv.h b/v4l2-apps/libv4l/libv4l1/libv4l1-priv.h index 651599255..370686b3a 100644 --- a/v4l2-apps/libv4l/libv4l1/libv4l1-priv.h +++ b/v4l2-apps/libv4l/libv4l1/libv4l1-priv.h @@ -22,14 +22,7 @@ #include #include -/* On 32 bits archs we always use mmap2, on 64 bits archs there is no mmap2 */ -#ifdef __NR_mmap2 -#define SYS_mmap2 __NR_mmap2 -#define MMAP2_PAGE_SHIFT 12 -#else -#define SYS_mmap2 SYS_mmap -#define MMAP2_PAGE_SHIFT 0 -#endif +#include "../libv4lconvert/libv4lsyscall-priv.h" #define V4L1_MAX_DEVICES 16 #define V4L1_NO_FRAMES 4 diff --git a/v4l2-apps/libv4l/libv4l1/libv4l1.c b/v4l2-apps/libv4l/libv4l1/libv4l1.c index a7de0af8e..b676d69ed 100644 --- a/v4l2-apps/libv4l/libv4l1/libv4l1.c +++ b/v4l2-apps/libv4l/libv4l1/libv4l1.c @@ -44,18 +44,12 @@ #include #include #include -#include #include #include #include #include #include -/* These headers are not needed by us, but by linux/videodev2.h, - which is broken on some systems and doesn't include them itself :( */ -#include -#include -#include -/* end broken header workaround includes */ +#include "../libv4lconvert/libv4lsyscall-priv.h" #include #include #include @@ -225,14 +219,14 @@ static void v4l1_find_min_and_max_size(int index, struct v4l2_format *fmt2) for (i = 0; ; i++) { fmtdesc2.index = i; - if (syscall(SYS_ioctl, devices[index].fd, VIDIOC_ENUM_FMT, &fmtdesc2)) + if (SYS_IOCTL(devices[index].fd, VIDIOC_ENUM_FMT, &fmtdesc2)) break; fmt2->fmt.pix.pixelformat = fmtdesc2.pixelformat; fmt2->fmt.pix.width = 48; fmt2->fmt.pix.height = 32; - if (syscall(SYS_ioctl, devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { + if (SYS_IOCTL(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { if (fmt2->fmt.pix.width < devices[index].min_width) devices[index].min_width = fmt2->fmt.pix.width; if (fmt2->fmt.pix.height < devices[index].min_height) @@ -243,7 +237,7 @@ static void v4l1_find_min_and_max_size(int index, struct v4l2_format *fmt2) fmt2->fmt.pix.width = 100000; fmt2->fmt.pix.height = 100000; - if (syscall(SYS_ioctl, devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { + if (SYS_IOCTL(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { if (fmt2->fmt.pix.width > devices[index].max_width) devices[index].max_width = fmt2->fmt.pix.width; if (fmt2->fmt.pix.height > devices[index].max_height) @@ -280,11 +274,12 @@ int v4l1_open (const char *file, int oflag, ...) va_start (ap, oflag); mode = va_arg (ap, mode_t); - fd = syscall(SYS_open, file, oflag, mode); + fd = SYS_OPEN(file, oflag, mode); va_end(ap); } else - fd = syscall(SYS_open, file, oflag); + fd = SYS_OPEN(file, oflag, 0); + /* end of original open code */ if (fd == -1 || !v4l_device) @@ -292,7 +287,7 @@ int v4l1_open (const char *file, int oflag, ...) /* check that this is an v4l2 device, no need to emulate v4l1 on a v4l1 device */ - if (syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap2)) + if (SYS_IOCTL(fd, VIDIOC_QUERYCAP, &cap2)) return fd; /* IMPROVEME */ @@ -314,7 +309,7 @@ int v4l1_open (const char *file, int oflag, ...) emulation for us */ if (v4l2_fd_open(fd, V4L2_ENABLE_ENUM_FMT_EMULATION) == -1) { int saved_err = errno; - syscall(SYS_close, fd); + SYS_CLOSE(fd); errno = saved_err; return -1; } @@ -323,7 +318,7 @@ int v4l1_open (const char *file, int oflag, ...) fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(fd, VIDIOC_G_FMT, &fmt2)) { int saved_err = errno; - syscall(SYS_close, fd); + SYS_CLOSE(fd); errno = saved_err; return -1; } @@ -400,7 +395,7 @@ int v4l1_close(int fd) { int index, result; if ((index = v4l1_get_index(fd)) == -1) - return syscall(SYS_close, fd); + return SYS_CLOSE(fd); /* Abuse stream_lock to stop 2 closes from racing and trying to free the resources twice */ @@ -418,7 +413,7 @@ int v4l1_close(int fd) { V4L1_LOG("v4l1 capture buffer still mapped: %d times on close()\n", devices[index].v4l1_frame_buf_map_count); else - syscall(SYS_munmap, devices[index].v4l1_frame_pointer, + SYS_MUNMAP(devices[index].v4l1_frame_pointer, V4L1_NO_FRAMES * V4L1_FRAME_BUF_SIZE); devices[index].v4l1_frame_pointer = MAP_FAILED; } @@ -447,7 +442,6 @@ int v4l1_dup(int fd) return v4l2_dup(fd); } - int v4l1_ioctl (int fd, unsigned long int request, ...) { void *arg; @@ -459,7 +453,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) va_end (ap); if ((index = v4l1_get_index(fd)) == -1) - return syscall(SYS_ioctl, fd, request, arg); + return SYS_IOCTL(fd, request, arg); /* Appearantly the kernel and / or glibc ignore the 32 most significant bits when long = 64 bits, and some applications pass an int holding the req to @@ -486,7 +480,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) { struct video_capability *cap = arg; - result = syscall(SYS_ioctl, fd, request, arg); + result = SYS_IOCTL(fd, request, arg); /* override kernel v4l1 compat min / max size with our own more accurate values */ @@ -563,7 +557,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) case VIDIOCGWIN: devices[index].flags |= V4L1_PIX_SIZE_TOUCHED; - result = syscall(SYS_ioctl, fd, request, arg); + result = SYS_IOCTL(fd, request, arg); break; case VIDIOCGCHAN: @@ -573,7 +567,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) if ((devices[index].flags & V4L1_SUPPORTS_ENUMINPUT) && (devices[index].flags & V4L1_SUPPORTS_ENUMSTD)) { - result = syscall(SYS_ioctl, fd, request, arg); + result = SYS_IOCTL(fd, request, arg); break; } @@ -615,7 +609,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) struct video_channel *chan = arg; if ((devices[index].flags & V4L1_SUPPORTS_ENUMINPUT) && (devices[index].flags & V4L1_SUPPORTS_ENUMSTD)) { - result = syscall(SYS_ioctl, fd, request, arg); + result = SYS_IOCTL(fd, request, arg); break; } /* In case of no ENUMSTD support, ignore the norm member of the @@ -651,7 +645,7 @@ int v4l1_ioctl (int fd, unsigned long int request, ...) } if (devices[index].v4l1_frame_pointer == MAP_FAILED) { - devices[index].v4l1_frame_pointer = (void *)syscall(SYS_mmap2, NULL, + devices[index].v4l1_frame_pointer = (void *)SYS_MMAP(NULL, (size_t)mbuf->size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); @@ -748,7 +742,7 @@ ssize_t v4l1_read(int fd, void* buffer, size_t n) ssize_t result; if ((index = v4l1_get_index(fd)) == -1) - return syscall(SYS_read, fd, buffer, n); + return SYS_READ(fd, buffer, n); pthread_mutex_lock(&devices[index].stream_lock); result = v4l2_read(fd, buffer, n); @@ -759,7 +753,7 @@ ssize_t v4l1_read(int fd, void* buffer, size_t n) void *v4l1_mmap(void *start, size_t length, int prot, int flags, int fd, - __off64_t offset) + int64_t offset) { int index; void *result; diff --git a/v4l2-apps/libv4l/libv4l1/log.c b/v4l2-apps/libv4l/libv4l1/log.c index 9ff0cea46..fd095817f 100644 --- a/v4l2-apps/libv4l/libv4l1/log.c +++ b/v4l2-apps/libv4l/libv4l1/log.c @@ -18,12 +18,7 @@ #include #include -#include -/* These headers are not needed by us, but by linux/videodev2.h, - which is broken on some systems and doesn't include them itself :( */ -#include -#include -/* end broken header workaround includes */ +#include "../libv4lconvert/libv4lsyscall-priv.h" #include #include "libv4l1-priv.h" diff --git a/v4l2-apps/libv4l/libv4l1/v4l1compat.c b/v4l2-apps/libv4l/libv4l1/v4l1compat.c index e4293d2f9..704ec22dd 100644 --- a/v4l2-apps/libv4l/libv4l1/v4l1compat.c +++ b/v4l2-apps/libv4l/libv4l1/v4l1compat.c @@ -25,6 +25,7 @@ #include #include #include +#include "../libv4lconvert/libv4lsyscall-priv.h" /* for __off_t */ #include #include @@ -61,6 +62,7 @@ LIBV4L_PUBLIC int open (const char *file, int oflag, ...) return fd; } +#ifdef linux LIBV4L_PUBLIC int open64 (const char *file, int oflag, ...) { int fd; @@ -81,6 +83,7 @@ LIBV4L_PUBLIC int open64 (const char *file, int oflag, ...) return fd; } +#endif LIBV4L_PUBLIC int close(int fd) { return v4l1_close(fd); @@ -114,11 +117,13 @@ LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fd return v4l1_mmap(start, length, prot, flags, fd, offset); } +#ifdef linux LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd, __off64_t offset) { return v4l1_mmap(start, length, prot, flags, fd, offset); } +#endif LIBV4L_PUBLIC int munmap(void *start, size_t length) { -- cgit v1.2.3 From f78597ecea4ce107d99124eca84df338bfcbb29a Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Mon, 8 Jun 2009 11:22:32 +0200 Subject: libv4l: remove DEADJOE files during make clean From: Gregor Jasny libv4l: remove DEADJOE files during make clean Priority: normal Signed-off-by: Gregor Jasny Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/Makefile b/v4l2-apps/libv4l/libv4l1/Makefile index bd6687e1a..e6d306055 100644 --- a/v4l2-apps/libv4l/libv4l1/Makefile +++ b/v4l2-apps/libv4l/libv4l1/Makefile @@ -71,7 +71,7 @@ endif install -m 644 libv4l1.pc $(DESTDIR)$(LIBDIR)/pkgconfig clean:: - rm -f *.a *.so* *.o *.d libv4l1.pc log *~ *.orig *.rej + rm -f *.a *.so* *.o *.d libv4l1.pc log *~ *.orig *.rej DEADJOE %.o: %.c $(CC) -Wp,-MMD,"$*.d",-MQ,"$@",-MP -c $(CPPFLAGS) $(CFLAGS) -o $@ $< -- cgit v1.2.3 From 7a7d2c3791928d88ef83f28a7d1fd3095f0bb459 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 17 Jun 2009 14:56:29 +0200 Subject: libv4l1: Use v4l2_ioctl when determining min/max size From: Hans de Goede Use v4l2_ioctl instead of native ioctl's when finding out what the minimum / maximum size is, so that we take the resolution aligment done by libv4l2 into account for the minimum / maximum size. Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4l1/libv4l1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'v4l2-apps/libv4l/libv4l1') diff --git a/v4l2-apps/libv4l/libv4l1/libv4l1.c b/v4l2-apps/libv4l/libv4l1/libv4l1.c index b676d69ed..4d251a481 100644 --- a/v4l2-apps/libv4l/libv4l1/libv4l1.c +++ b/v4l2-apps/libv4l/libv4l1/libv4l1.c @@ -219,14 +219,14 @@ static void v4l1_find_min_and_max_size(int index, struct v4l2_format *fmt2) for (i = 0; ; i++) { fmtdesc2.index = i; - if (SYS_IOCTL(devices[index].fd, VIDIOC_ENUM_FMT, &fmtdesc2)) + if (v4l2_ioctl(devices[index].fd, VIDIOC_ENUM_FMT, &fmtdesc2)) break; fmt2->fmt.pix.pixelformat = fmtdesc2.pixelformat; fmt2->fmt.pix.width = 48; fmt2->fmt.pix.height = 32; - if (SYS_IOCTL(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { + if (v4l2_ioctl(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { if (fmt2->fmt.pix.width < devices[index].min_width) devices[index].min_width = fmt2->fmt.pix.width; if (fmt2->fmt.pix.height < devices[index].min_height) @@ -237,7 +237,7 @@ static void v4l1_find_min_and_max_size(int index, struct v4l2_format *fmt2) fmt2->fmt.pix.width = 100000; fmt2->fmt.pix.height = 100000; - if (SYS_IOCTL(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { + if (v4l2_ioctl(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { if (fmt2->fmt.pix.width > devices[index].max_width) devices[index].max_width = fmt2->fmt.pix.width; if (fmt2->fmt.pix.height > devices[index].max_height) -- cgit v1.2.3 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/libv4l/libv4l1') 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