avicap32: drop v4l1 support

Rafał Mużyło galtgendo at gmail.com
Wed Jul 13 15:01:20 CDT 2011


Following bug 27074 and IRC discussion, this patch removes the code
using v4l1 API and uses exising code for v4l2 API.

-------------- next part --------------
--- dlls/avicap32_main.c	2011-07-13 18:07:26.000000000 +0200
+++ dlls/avicap32_main.c	2011-07-13 18:18:08.000000000 +0200
@@ -38,8 +38,8 @@
 #ifdef HAVE_ASM_TYPES_H
 # include <asm/types.h>
 #endif
-#ifdef HAVE_LINUX_VIDEODEV_H
-# include <linux/videodev.h>
+#ifdef HAVE_LINUX_VIDEODEV2_H
+# include <linux/videodev2.h>
 #endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
@@ -91,7 +91,7 @@
     return retW;
 }
 
-#ifdef HAVE_LINUX_VIDEODEV_H
+#ifdef HAVE_LINUX_VIDEODEV2_H
 
 static int xioctl(int fd, int request, void * arg)
 {
@@ -108,10 +108,7 @@
    int fd;
    char device[16];
    struct stat st;
-   struct video_capability capa;
-#ifdef HAVE_V4L2
    struct v4l2_capability caps;
-#endif
 
    snprintf(device, sizeof(device), "/dev/video%i", devnum);
 
@@ -132,7 +129,6 @@
       return FALSE;
    }
 
-#ifdef HAVE_V4L2
    memset(&caps, 0, sizeof(caps));
    if (xioctl(fd, VIDIOC_QUERYCAP, &caps) != -1) {
       lstrcpynA(name, (char *)caps.card, namesize);
@@ -143,27 +139,15 @@
    }
 
    if (errno != EINVAL && errno != 515)
-      WARN("%s: ioctl failed: %s -- Falling back to V4L\n", device, strerror(errno));
-   else WARN("%s: Not a V4L2 compatible device, trying V4l 1\n", device);
-#endif /* HAVE_V4L2 */
-
-   memset(&capa, 0, sizeof(capa));
-   if (xioctl(fd, VIDIOCGCAP, &capa) == -1) {
 /* errno 515 is used by some webcam drivers for unknown IOICTL command */
-      if (errno != EINVAL && errno != 515)
-         ERR("%s: Querying failed: %s\n", device, strerror(errno));
-      else ERR("%s: Querying failed: Not a V4L compatible device\n", device);
-      close(fd);
-      return FALSE;
-   }
+      ERR("%s: Querying failed: %s\n", device, strerror(errno));
+   else ERR("%s: Querying failed: Not a V4L compatible device\n", device);
 
-   lstrcpynA(name, capa.name, namesize);
-   lstrcpynA(version, device, versionsize);
    close(fd);
-   return TRUE;
+   return FALSE;
 }
 
-#else /* HAVE_LINUX_VIDEODEV_H */
+#else /* HAVE_LINUX_VIDEODEV2_H */
 
 static BOOL query_video_device(int devnum, char *name, int namesize, char *version, int versionsize)
 {
@@ -171,7 +155,7 @@
    return FALSE;
 }
 
-#endif /* HAVE_LINUX_VIDEODEV_H */
+#endif /* HAVE_LINUX_VIDEODEV2_H */
 
 /***********************************************************************
  *             capGetDriverDescriptionA   (AVICAP32.@)
--- configure.ac	2011-07-13 21:53:48.000000000 +0200
+++ configure.ac	2011-07-13 21:54:36.000000000 +0200
@@ -651,6 +651,15 @@
 #include <asm/types.h>
 #endif])
 
+AC_CHECK_HEADERS([linux/videodev2.h],,,
+[#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_ASM_TYPES_H
+#include <asm/types.h>
+#endif])
+
 dnl Check for broken kernel header that doesn't define __user
 AC_CHECK_HEADERS([linux/capi.h],,,[#define __user])
 


More information about the wine-patches mailing list