[packages] libv4l: update to 0.8.6, add v4l-utils package
git-svn-id: svn://svn.openwrt.org/openwrt/packages@30735 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@ -1,48 +1,57 @@
|
||||
--- a/libv4lconvert/control/libv4lcontrol.c
|
||||
+++ b/libv4lconvert/control/libv4lcontrol.c
|
||||
@@ -338,7 +338,7 @@ static void v4lcontrol_init_flags(struct
|
||||
--- 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, init = 0;
|
||||
char *s, shm_name[256], pwd_buf[1024];
|
||||
struct v4l2_capability cap;
|
||||
@@ -392,25 +392,31 @@ struct v4lcontrol_data *v4lcontrol_creat
|
||||
}
|
||||
- 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) {
|
||||
- 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");
|
||||
- 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);
|
||||
}
|
||||
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] = '-';
|
||||
/* / 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 */
|
||||
- if ((shm_fd = shm_open(shm_name, (O_CREAT | O_EXCL | O_RDWR),
|
||||
+ if ((shm_fd = open(shm_name, (O_CREAT | O_EXCL | O_RDWR),
|
||||
(S_IREAD | S_IWRITE))) >= 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));
|
||||
/* 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);
|
||||
+ /* 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 */
|
||||
if (shm_fd >= 0) {
|
||||
/* Set the shared memory size */
|
||||
|
160
libs/libv4l/patches/002-allow-disabling-libjpeg.patch
Normal file
160
libs/libv4l/patches/002-allow-disabling-libjpeg.patch
Normal file
@ -0,0 +1,160 @@
|
||||
--- 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;
|
66
libs/libv4l/patches/003-add-missing-libs.patch
Normal file
66
libs/libv4l/patches/003-add-missing-libs.patch
Normal file
@ -0,0 +1,66 @@
|
||||
--- 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
|
Reference in New Issue
Block a user