[vlc-devel] [PATCH] - Autotools support for libv4l2

Nicolas Chauvet (kwizart) kwizart at gmail.com
Thu Oct 16 13:48:15 CEST 2008


---
 configure.ac               |    5 +++++
 modules/access/v4l2/v4l2.c |   10 ++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index c4ad736..728ce2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2365,6 +2365,11 @@ then
     AC_DEFINE(HAVE_ALSA, 1, Define if ALSA is present.)
   fi
 
+  PKG_CHECK_MODULES(LIBV4L2,libv4l2,
+        VLC_ADD_LIBS([v4l2],[$LIBV4L2_LIBS])
+        VLC_ADD_CFLAGS([v4l2],[$LIBV4L2_CFLAGS])
+        AC_DEFINE(HAVE_LIBV4L2, 1, Define if LIBV4L2 is available),
+        AC_MSG_WARN([LIBV4L2 support disabled because libv4l2 development headers not found]))
   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l2}"
   AC_CHECK_HEADERS(linux/videodev2.h, [
     VLC_ADD_PLUGIN([v4l2])
diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c
index d942efc..19dc63f 100644
--- a/modules/access/v4l2/v4l2.c
+++ b/modules/access/v4l2/v4l2.c
@@ -68,7 +68,17 @@
 #include <poll.h>
 
 
+#ifdef HAVE_LIBV4L2
 #include <libv4l2.h>
+#else
+#define v4l2_fd_open(fd, flags) (fd)
+#define v4l2_close close
+#define v4l2_dup dup
+#define v4l2_ioctl ioctl
+#define v4l2_read read
+#define v4l2_mmap mmap
+#define v4l2_munmap munmap
+#endif
 
 /*****************************************************************************
  * Module descriptior
-- 
1.5.4.3




More information about the vlc-devel mailing list