75 lines
2.2 KiB
Diff
75 lines
2.2 KiB
Diff
--- configure.ac.orig
|
|
+++ configure.ac
|
|
@@ -147,19 +147,13 @@
|
|
with_video="no"
|
|
AS_IF([test "x$enable_video" != "xno"],
|
|
[AS_IF([test "x$win32" = "xno"],
|
|
- [AC_CHECK_HEADERS([linux/videodev.h], [with_video="v4l1"],
|
|
- [AC_MSG_FAILURE([test for video support failed!
|
|
-rebuild your kernel to include video4linux support or
|
|
-configure --disable-video to skip building video support.])])
|
|
- AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
|
|
+ [AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
|
|
[AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
|
|
[AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
|
|
[AC_MSG_FAILURE([test for VfW video support failed!
|
|
configure --disable-video to skip building vidoe support.])])])
|
|
])
|
|
AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
|
|
-AM_CONDITIONAL([HAVE_V4L1],
|
|
- [test "x$with_video" = "xv4l1" || test "x$with_video" = "xv4l2"])
|
|
AM_CONDITIONAL([HAVE_V4L2], [test "x$with_video" = "xv4l2"])
|
|
|
|
dnl X
|
|
--- zbar/Makefile.am.inc.orig
|
|
+++ zbar/Makefile.am.inc
|
|
@@ -53,12 +53,9 @@
|
|
zbar_libzbar_la_SOURCES += zbar/processor/posix.h zbar/processor/posix.c
|
|
endif
|
|
|
|
-if HAVE_V4L1
|
|
-zbar_libzbar_la_SOURCES += zbar/video/v4l1.c
|
|
if HAVE_V4L2
|
|
zbar_libzbar_la_SOURCES += zbar/video/v4l2.c
|
|
endif
|
|
-endif
|
|
if WIN32
|
|
if HAVE_VIDEO
|
|
zbar_libzbar_la_SOURCES += zbar/video/vfw.c
|
|
--- zbar/video/v4l2.c.orig
|
|
+++ zbar/video/v4l2.c
|
|
@@ -39,6 +39,9 @@
|
|
# include <sys/mman.h>
|
|
#endif
|
|
#include <linux/videodev2.h>
|
|
+#include <sys/stat.h>
|
|
+#include <unistd.h>
|
|
+#include <fcntl.h>
|
|
|
|
#include "video.h"
|
|
#include "image.h"
|
|
@@ -507,3 +507,23 @@
|
|
vdo->dq = v4l2_dq;
|
|
return(0);
|
|
}
|
|
+
|
|
+int _zbar_video_open (zbar_video_t *vdo,
|
|
+ const char *dev)
|
|
+{
|
|
+ vdo->fd = open(dev, O_RDWR);
|
|
+ if(vdo->fd < 0)
|
|
+ return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
|
|
+ "opening video device '%s'", dev));
|
|
+ zprintf(1, "opened camera device %s (fd=%d)\n", dev, vdo->fd);
|
|
+
|
|
+ int rc = -1;
|
|
+ if(vdo->intf != VIDEO_V4L1)
|
|
+ rc = _zbar_v4l2_probe(vdo);
|
|
+
|
|
+ if(rc && vdo->fd >= 0) {
|
|
+ close(vdo->fd);
|
|
+ vdo->fd = -1;
|
|
+ }
|
|
+ return(rc);
|
|
+}
|