[ekiga] Fixed V4L/V4L2 detection for hal-dbus with recent kernels.



commit 66aca143c5c5fc5a27596b41050c4f770109c79d
Author: Damien Sandras <dsandras beip be>
Date:   Sat May 12 17:14:29 2012 +0200

    Fixed V4L/V4L2 detection for hal-dbus with recent kernels.
    
    Due to the old videodev.h requirement, video device hotplug was
    not detected anymore.

 configure.ac                                    |   22 +++++++++++++++++++---
 lib/engine/components/hal-dbus/hal-v4l-helper.c |   19 ++++++++++++-------
 2 files changed, 31 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e397a1e..5b20ff1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,15 +479,27 @@ dnl   V4L headers
 dnl   These are only necessary until HAL has a decent V4L support...
 dnl ###############################
 
+OLDV4L="disabled"
 V4L="disabled"
+V4L2="disabled"
+VIDEO4LINUX="disabled"
 if test "x${win32}" != "x1"; then
-  AC_CHECK_HEADER(linux/videodev.h, V4L="enabled")
+  AC_CHECK_HEADER(libv4l1-videodev.h, V4L="enabled")
+  AC_CHECK_HEADER(linux/videodev2.h, V4L2="enabled")
+  AC_CHECK_HEADER(linux/videodev.h, OLDV4L="enabled")
 
-  if test "x${V4L}" != "xdisabled"; then
+  if test "x${V4L}" != "xdisabled" -a "x${V4L2}" != "xdisabled"; then
     AC_DEFINE(HAVE_V4L,1,[V4L support])
+    VIDEO4LINUX="enabled"
+  else
+    if test "x${OLDV4L}" != "xdisabled"; then
+      AC_DEFINE(HAVE_V4L,1,[V4L support])
+      AC_DEFINE(HAVE_OLD_V4L,1,[V4L is old style])
+      VIDEO4LINUX="enabled"
+    fi
   fi
 fi
-AM_CONDITIONAL(HAVE_V4L, test "x${V4L}" != "xdisabled")
+AM_CONDITIONAL(HAVE_V4L, test "x${VIDEO4LINUX}" = "xenabled")
 
 dnl ###############################
 dnl   Avahi / mDNS Support
@@ -881,6 +893,10 @@ echo "   Evolution-Data-Server support  :  $EDS"
 echo "                  NOTIFY support  :  $NOTIFY"
 fi
 echo "                    LDAP support  :  $LDAP"
+if test "x${gm_platform}" != "xmingw" ; then
+echo ""
+echo "             Video4Linux support  :  $VIDEO4LINUX"
+fi
 echo ""
 echo "                  XVideo support  :  $XV"
 echo "           Shared Memory support  :  $SHM"
diff --git a/lib/engine/components/hal-dbus/hal-v4l-helper.c b/lib/engine/components/hal-dbus/hal-v4l-helper.c
index d48d1fb..6264739 100644
--- a/lib/engine/components/hal-dbus/hal-v4l-helper.c
+++ b/lib/engine/components/hal-dbus/hal-v4l-helper.c
@@ -31,31 +31,37 @@
  *                         ------------------------------------------
  *   begin                : written in 2008 by Matthias Schneider
  *   copyright            : (c) 2008 by Matthias Schneider
- *   description          : Used to detect the names and supported V4L 
- *                          interfaces of a new video4linux device (this 
+ *   description          : Used to detect the names and supported V4L
+ *                          interfaces of a new video4linux device (this
  *                          should really be in HALd itself.
  *
  */
 
-#include <fcntl.h>	// for open() 
-#include <unistd.h>	// for read(), write(), close() 
+#include <fcntl.h>	// for open()
+#include <unistd.h>	// for read(), write(), close()
 #include <sys/ioctl.h>	// for ioctl()
 #include <stdlib.h>     // for free(), malloc()
 #include <string.h>     // for strlen()
 #include <stdio.h>
+
+#ifdef HAVE_OLD_V4L
 #include <linux/videodev.h>
+#else
+#include <linux/videodev2.h>
+#include <libv4l1-videodev.h>
+#endif
 
 int v4l_get_device_names (const char* device, char** v4l1_name, char** v4l2_name) {
   int fp;
   unsigned ret = 0; // Device not valid
-  
+
   *v4l1_name = NULL;
   *v4l2_name = NULL;
 
   if((fp = open(device, O_RDONLY)) == 0) {
     return -1;  // Unable to open device
   }
- 
+
   struct video_capability  v4l1_caps;
   if (ioctl(fp, VIDIOCGCAP, &v4l1_caps) >= 0 && (v4l1_caps.type & VID_TYPE_CAPTURE) != 0) {
     ret |= 1;
@@ -84,4 +90,3 @@ void v4l_free_device_name (char** name)
 
   *name = NULL;
 }
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]