+++ /dev/null
-#
-# Copyright (C) 2009-2012 OpenWrt.org
-# Copyright (C) 2009 David Cooper <dave@kupesoft.com>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=v4l-utils
-PKG_VERSION:=0.8.6
-PKG_RELEASE:=2
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://www.linuxtv.org/downloads/v4l-utils
-PKG_MD5SUM:=80062780ae90e5955473b09b31e9828a
-
-PKG_BUILD_DEPENDS:=argp-standalone
-
-include $(INCLUDE_DIR)/uclibc++.mk
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libv4l/Default
- TITLE:=Video 4 Linux
- URL:=http://www.linuxtv.org/
-endef
-
-define Package/libv4l/Default/description
- libv4l is a collection of libraries which adds a thin abstraction layer on
- top of video4linux2 devices. The purpose of this (thin) layer is to make it
- easy for application writers to support a wide variety of devices without
- having to write separate code for different devices in the same class. libv4l
- consists of 3 different libraries: libv4lconvert, libv4l1 and libv4l2.
-
- libv4l1 offers the (deprecated) v4l1 API on top of v4l2 devices, independent
- of the drivers for those devices supporting v4l1 compatibility (which many
- v4l2 drivers do not).
-
- libv4l2 offers the v4l2 API on top of v4l2 devices, while adding for the
- application transparent libv4lconvert conversion where necessary.
-endef
-
-define Package/libv4l
- $(call Package/libv4l/Default)
- SECTION:=libs
- CATEGORY:=Libraries
- TITLE+= wrapper libraries
- DEPENDS := +libpthread +librt
-endef
-
-define Package/libv4l/description
- $(call Package/libv4l/Default/description)
-endef
-
-define Package/v4l-utils
- $(call Package/libv4l/Default)
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE+= utilities
- DEPENDS := +libv4l $(CXX_DEPENDS)
-endef
-
-define Package/v4l-utils/description
- $(call Package/libv4l/Default/description)
- This package contains the video4linux utilities.
-endef
-
-TARGET_CFLAGS += $(FPIC)
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" PREFIX="/usr" \
- DISABLE_LIBJPEG="1" \
- $(CONFIGURE_VARS) \
- all install
- $(MAKE) -C $(PKG_BUILD_DIR) \
- DESTDIR="$(PKG_INSTALL_DIR)" PREFIX="/usr" \
- DISABLE_LIBJPEG="1" \
- $(CONFIGURE_VARS) \
- LINKTYPE="static" \
- all install
-endef
-
-define Build/InstallDev
- $(INSTALL_DIR) $(1)/usr/include
- $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l{1,2,convert}.{a,so*} $(1)/usr/lib/
- $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libv4l{1,2,convert}.pc $(1)/usr/lib/pkgconfig/
-endef
-
-define Package/libv4l/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l{1,2,convert}.so.* $(1)/usr/lib/
- $(INSTALL_DIR) $(1)/usr/lib/libv4l
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libv4l/v4l{1compat,2convert}.so $(1)/usr/lib/libv4l/
-endef
-
-define Package/v4l-utils/install
- $(INSTALL_DIR) $(1)/etc
- $(CP) $(PKG_INSTALL_DIR)/etc/rc_maps.cfg $(1)/etc/
- $(CP) $(PKG_INSTALL_DIR)/etc/rc_keymaps $(1)/etc/
- $(INSTALL_DIR) $(1)/usr/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/{cx18,ivtv}-ctl $(1)/usr/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/decode_tm6000 $(1)/usr/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/ir-keytable $(1)/usr/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/v4l2-{compliance,ctl,sysfs-path} $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,libv4l))
-$(eval $(call BuildPackage,v4l-utils))
+++ /dev/null
---- a/lib/libv4lconvert/control/libv4lcontrol.c
-+++ b/lib/libv4lconvert/control/libv4lcontrol.c
-@@ -525,7 +525,7 @@ static void v4lcontrol_get_flags_from_db
-
- struct v4lcontrol_data *v4lcontrol_create(int fd, int always_needs_conversion)
- {
-- int shm_fd;
-+ int shm_fd, fdflags;
- int i, rc, got_usb_info, speed, init = 0;
- char *s, shm_name[256], pwd_buf[1024];
- struct v4l2_capability cap;
-@@ -638,33 +638,38 @@ struct v4lcontrol_data *v4lcontrol_creat
-
- if (getpwuid_r(geteuid(), &pwd, pwd_buf, sizeof(pwd_buf), &pwd_p) == 0) {
- if (got_usb_info)
-- snprintf(shm_name, 256, "/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
-+ snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
- cap.bus_info, (int)vendor_id, (int)product_id, cap.card);
- else
-- snprintf(shm_name, 256, "/libv4l-%s:%s:%s", pwd.pw_name,
-+ snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%s", pwd.pw_name,
- cap.bus_info, cap.card);
- } else {
- perror("libv4lcontrol: error getting username using uid instead");
- if (got_usb_info)
-- snprintf(shm_name, 256, "/libv4l-%lu:%s:%04x:%04x:%s",
-+ snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%04x:%04x:%s",
- (unsigned long)geteuid(), cap.bus_info,
- (int)vendor_id, (int)product_id, cap.card);
- else
-- snprintf(shm_name, 256, "/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
-+ snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
- cap.bus_info, cap.card);
- }
-
- /* / is not allowed inside shm names */
-- for (i = 1; shm_name[i]; i++)
-+ for (i = 9; shm_name[i]; i++) /* start after "/dev/shm", i = 9 */
- if (shm_name[i] == '/')
- shm_name[i] = '-';
-
- /* Open the shared memory object identified by shm_name */
-- shm_fd = shm_open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
-+ shm_fd = open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
- if (shm_fd >= 0)
- init = 1;
- else
-- shm_fd = shm_open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
-+ shm_fd = open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
-+
-+ /* This is all uClibc > 0.9.30 seems to do for shm_open() in librt/shm.c */
-+ fdflags = fcntl(shm_fd, F_GETFD, 0);
-+ if (fdflags >= 0)
-+ fdflags = fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
-
- if (shm_fd >= 0) {
- /* Set the shared memory size */
+++ /dev/null
---- a/lib/libv4lconvert/Makefile
-+++ b/lib/libv4lconvert/Makefile
-@@ -1,6 +1,6 @@
- override CPPFLAGS += -I../include -fvisibility=hidden
-
--LIBS_libv4lconvert = -lrt -lm -ljpeg
-+LIBS_libv4lconvert = -lrt -lm
-
- ifeq ($(LINKTYPE),static)
- CONVERT_LIB = libv4lconvert.a
-@@ -10,16 +10,22 @@ override CPPFLAGS += -fPIC
- endif
-
- CONVERT_OBJS = libv4lconvert.o tinyjpeg.o sn9c10x.o sn9c20x.o pac207.o \
-- jl2005bcd.o \
- mr97310a.o flip.o crop.o jidctflt.o spca561-decompress.o \
- rgbyuv.o sn9c2028-decomp.o spca501.o sq905c.o bayer.o hm12.o \
-- stv0680.o cpia1.o se401.o jpgl.o jpeg.o jpeg_memsrcdest.o \
-+ stv0680.o cpia1.o se401.o jpgl.o jpeg.o \
- control/libv4lcontrol.o processing/libv4lprocessing.o \
- processing/whitebalance.o processing/autogain.o \
- processing/gamma.o helper.o
- TARGETS = $(CONVERT_LIB) libv4lconvert.pc ov511-decomp ov518-decomp
- INCLUDES = ../include/libv4lconvert.h
-
-+ifeq ($(DISABLE_LIBJPEG),1)
-+override CFLAGS += -DDISABLE_LIBJPEG
-+else
-+LIBS_libv4lconvert += -ljpeg
-+CONVERT_OBJS += jl2005bcd.o jpeg_memsrcdest.o
-+endif
-+
- override CPPFLAGS += -DLIBDIR=\"$(LIBDIR)\" -DLIBSUBDIR=\"$(LIBSUBDIR)\"
-
- all: $(TARGETS)
---- a/lib/libv4lconvert/jpeg.c
-+++ b/lib/libv4lconvert/jpeg.c
-@@ -19,7 +19,9 @@
- #include <errno.h>
- #include <stdlib.h>
- #include "libv4lconvert-priv.h"
-+#ifndef DISABLE_LIBJPEG
- #include "jpeg_memsrcdest.h"
-+#endif
-
- int v4lconvert_decode_jpeg_tinyjpeg(struct v4lconvert_data *data,
- unsigned char *src, int src_size, unsigned char *dest,
-@@ -107,6 +109,8 @@ int v4lconvert_decode_jpeg_tinyjpeg(stru
- return 0;
- }
-
-+#ifndef DISABLE_LIBJPEG
-+
- static void jerr_error_exit(j_common_ptr cinfo)
- {
- struct v4lconvert_data *data = cinfo->client_data;
-@@ -405,3 +409,6 @@ int v4lconvert_decode_jpeg_libjpeg(struc
-
- return result;
- }
-+
-+#endif
-+
---- a/lib/libv4lconvert/libv4lconvert-priv.h
-+++ b/lib/libv4lconvert/libv4lconvert-priv.h
-@@ -22,7 +22,9 @@
- #include <stdio.h>
- #include <stdint.h>
- #include <sys/types.h>
-+#ifndef DISABLE_LIBJPEG
- #include <jpeglib.h>
-+#endif
- #include <setjmp.h>
- #include "libv4lconvert.h"
- #include "control/libv4lcontrol.h"
-@@ -50,11 +52,13 @@ struct v4lconvert_data {
- int64_t supported_src_formats; /* bitfield */
- char error_msg[V4LCONVERT_ERROR_MSG_SIZE];
- struct jdec_private *tinyjpeg;
-+#ifndef DISABLE_LIBJPEG
- struct jpeg_error_mgr jerr;
- int jerr_errno;
- jmp_buf jerr_jmp_state;
- struct jpeg_decompress_struct cinfo;
- int cinfo_initialized;
-+#endif
- struct v4l2_frmsizeenum framesizes[V4LCONVERT_MAX_FRAMESIZES];
- unsigned int no_framesizes;
- int bandwidth;
---- a/lib/libv4lconvert/libv4lconvert.c
-+++ b/lib/libv4lconvert/libv4lconvert.c
-@@ -78,7 +78,9 @@ static const struct v4lconvert_pixfmt su
- { V4L2_PIX_FMT_SN9C2028, 0, 9, 9, 1 },
- { V4L2_PIX_FMT_PAC207, 0, 9, 9, 1 },
- { V4L2_PIX_FMT_MR97310A, 0, 9, 9, 1 },
-+#ifndef DISABLE_LIBJPEG
- { V4L2_PIX_FMT_JL2005BCD, 0, 9, 9, 1 },
-+#endif
- { V4L2_PIX_FMT_SQ905C, 0, 9, 9, 1 },
- /* special */
- { V4L2_PIX_FMT_SE401, 0, 8, 9, 1 },
-@@ -186,8 +188,10 @@ void v4lconvert_destroy(struct v4lconver
- tinyjpeg_set_components(data->tinyjpeg, comps, 3);
- tinyjpeg_free(data->tinyjpeg);
- }
-+#ifndef DISABLE_LIBJPEG
- if (data->cinfo_initialized)
- jpeg_destroy_decompress(&data->cinfo);
-+#endif
- v4lconvert_helper_cleanup(data);
- free(data->convert1_buf);
- free(data->convert2_buf);
-@@ -634,10 +638,13 @@ static int v4lconvert_convert_pixfmt(str
- /* JPG and variants */
- case V4L2_PIX_FMT_MJPEG:
- case V4L2_PIX_FMT_JPEG:
-+#ifndef DISABLE_LIBJPEG
- if (data->flags & V4LCONVERT_USE_TINYJPEG) {
-+#endif
- result = v4lconvert_decode_jpeg_tinyjpeg(data,
- src, src_size, dest,
- fmt, dest_pix_fmt, 0);
-+#ifndef DISABLE_LIBJPEG
- } else {
- result = v4lconvert_decode_jpeg_libjpeg(data,
- src, src_size, dest,
-@@ -652,6 +659,7 @@ static int v4lconvert_convert_pixfmt(str
- fmt, dest_pix_fmt, 0);
- }
- }
-+#endif
- break;
- case V4L2_PIX_FMT_PJPG:
- result = v4lconvert_decode_jpeg_tinyjpeg(data, src, src_size,
-@@ -777,7 +785,9 @@ static int v4lconvert_convert_pixfmt(str
- case V4L2_PIX_FMT_SN9C10X:
- case V4L2_PIX_FMT_PAC207:
- case V4L2_PIX_FMT_MR97310A:
-+#ifndef DISABLE_LIBJPEG
- case V4L2_PIX_FMT_JL2005BCD:
-+#endif
- case V4L2_PIX_FMT_SN9C2028:
- case V4L2_PIX_FMT_SQ905C:
- case V4L2_PIX_FMT_STV0680: { /* Not compressed but needs some shuffling */
-@@ -816,6 +826,7 @@ static int v4lconvert_convert_pixfmt(str
- }
- tmpfmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
- break;
-+#ifndef DISABLE_LIBJPEG
- case V4L2_PIX_FMT_JL2005BCD:
- if (v4lconvert_decode_jl2005bcd(data, src, src_size,
- tmpbuf,
-@@ -826,6 +837,7 @@ static int v4lconvert_convert_pixfmt(str
- }
- tmpfmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SRGGB8;
- break;
-+#endif
- case V4L2_PIX_FMT_SN9C2028:
- v4lconvert_decode_sn9c2028(src, tmpbuf, width, height);
- tmpfmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
+++ /dev/null
---- a/contrib/test/Makefile
-+++ b/contrib/test/Makefile
-@@ -28,7 +28,7 @@ pixfmt-test: pixfmt-test.o
- $(CC) $(LDFLAGS) -o $@ $^ -lX11
-
- v4l2grab: v4l2grab.o ../../lib/libv4l2/libv4l2.so
-- $(CC) $(LDFLAGS) -o $@ $^ -L../../lib/libv4l2 -L../../lib/libv4lconvert -lv4l2 -lv4lconvert
-+ $(CC) $(LDFLAGS) -o $@ $^ -L../../lib/libv4l2 -L../../lib/libv4lconvert -lv4l2 -lv4lconvert -largp
-
- ioctl-test: ioctl-test.o
- $(CC) $(LDFLAGS) -o $@ $^
---- a/utils/decode_tm6000/Makefile
-+++ b/utils/decode_tm6000/Makefile
-@@ -5,7 +5,7 @@ all: $(TARGETS)
- -include *.d
-
- decode_tm6000: decode_tm6000.o ../libv4l2util/libv4l2util.a
-- $(CC) $(LDFLAGS) -o $@ $^
-+ $(CC) $(LDFLAGS) -o $@ $^ -largp
-
- install: $(TARGETS)
- mkdir -p $(DESTDIR)$(PREFIX)/bin
---- a/utils/keytable/Makefile
-+++ b/utils/keytable/Makefile
-@@ -5,7 +5,7 @@ all: $(TARGETS)
- -include *.d
-
- ir-keytable: keytable.o
-- $(CC) $(LDFLAGS) -o $@ $^
-+ $(CC) $(LDFLAGS) -o $@ $^ -largp
-
- keytable.o: keytable.c parse.h
-
---- a/utils/v4l2-compliance/Makefile
-+++ b/utils/v4l2-compliance/Makefile
-@@ -6,7 +6,7 @@ all: $(TARGETS)
-
- v4l2-compliance: v4l2-compliance.o v4l2-test-debug.o v4l2-test-input-output.o \
- v4l2-test-controls.o v4l2-test-io-config.o v4l2-test-formats.o
-- $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
-+ $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt -lpthread
-
- install: $(TARGETS)
- mkdir -p $(DESTDIR)$(PREFIX)/bin
---- a/utils/v4l2-ctl/Makefile
-+++ b/utils/v4l2-ctl/Makefile
-@@ -13,7 +13,7 @@ ivtv-ctl: ivtv-ctl.o
- $(CC) $(LDFLAGS) -o $@ $^ -lm
-
- v4l2-ctl: v4l2-ctl.o
-- $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
-+ $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt -lpthread
-
- install: $(TARGETS)
- mkdir -p $(DESTDIR)$(PREFIX)/bin
---- a/utils/v4l2-sysfs-path/Makefile
-+++ b/utils/v4l2-sysfs-path/Makefile
-@@ -5,7 +5,7 @@ all: $(TARGETS)
- -include *.d
-
- v4l2-sysfs-path: v4l2-sysfs-path.o ../libmedia_dev/libmedia_dev.a
-- $(CC) $(LDFLAGS) -o $@ $^
-+ $(CC) $(LDFLAGS) -o $@ $^ -largp
-
- install: $(TARGETS)
- mkdir -p $(DESTDIR)$(PREFIX)/bin
+++ /dev/null
---- a/utils/Makefile
-+++ b/utils/Makefile
-@@ -5,21 +5,6 @@ all install:
- $(MAKE) -C $$i $@ || exit 1; \
- done
-
-- # Test whether qmake is installed, and whether it is for qt4.
-- @if which qmake-qt4 >/dev/null 2>&1; then \
-- QMAKE=qmake-qt4; \
-- else \
-- QMAKE=qmake; \
-- fi; \
-- if which $$QMAKE >/dev/null 2>&1; then \
-- if $$QMAKE --version 2>&1 | grep '4\.[0-9][0-9]*\.[0-9][0-9]*' >/dev/null; then \
-- if [ ! -f qv4l2/Makefile ]; then \
-- (cd qv4l2 && $$QMAKE) || exit 1; \
-- fi; \
-- $(MAKE) -C qv4l2 -f Makefile.install $@; \
-- fi \
-- fi
--
- sync-with-kernel:
- $(MAKE) -C keytable $@
- $(MAKE) -C v4l2-dbg $@