summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-03-09 15:07:53 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-03-09 15:07:53 +0000
commitc5f3b5e48c326f2c8e4fbf1d34e7ff4711ede0fa (patch)
tree078231873e8cef6ffed3c5cd56792f0fe84d83a6
parent72d53d141da734d2189931558054d0f39b243c1d (diff)
downloadgst-plugins-bad-c5f3b5e48c326f2c8e4fbf1d34e7ff4711ede0fa.tar.gz
gst-plugins-bad-c5f3b5e48c326f2c8e4fbf1d34e7ff4711ede0fa.tar.bz2
gst-plugins-bad-c5f3b5e48c326f2c8e4fbf1d34e7ff4711ede0fa.zip
Fix v4l/v4l2 compilation problems
Original commit message from CVS: Fix v4l/v4l2 compilation problems
-rw-r--r--configure.ac25
-rw-r--r--sys/v4l2/gstv4l2element.h14
2 files changed, 37 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 3521b0b9..0981b9b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,15 +290,36 @@ dnl this one is for hadess, no qcam when no nasm found
])
dnl *** Video 4 Linux ***
+dnl for information about the header/define, see sys/v4l/gstv4lelement.h
translit(dnm, m, l) AM_CONDITIONAL(USE_V4L, true)
GST_CHECK_FEATURE(V4L, [Video 4 Linux], v4lsrc v4lmjpegsrc v4lmjpegsink, [
- AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_V4L="yes", HAVE_V4L="no", [#include <linux/videodev.h>])
+ AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_V4L="yes", HAVE_V4L="no", [
+#include <sys/types.h>
+#define _LINUX_TIME_H
+#include <linux/videodev.h>
+ ])
])
dnl *** Video 4 Linux 2***
+dnl for information about the header/define, see sys/v4l2/gstv4l2element.h
translit(dnm, m, l) AM_CONDITIONAL(USE_V4L2, true)
GST_CHECK_FEATURE(V4L2, [Video 4 Linux 2], v4l2src, [
- AC_CHECK_HEADER(linux/videodev2.h, HAVE_V4L2="yes", HAVE_V4L2="no")
+ AC_MSG_CHECKING([Checking for uptodate v4l2 installation])
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <linux/types.h>
+#define _LINUX_TIME_H
+#include <linux/videodev2.h>
+#if defined(V4L2_MAJOR_VERSION) || defined(V4L2_MINOR_VERSION)
+#error too early v4l2 version or no v4l2 at all
+#endif
+ ], [
+return 0;
+ ], [ HAVE_V4L2="yes" && AC_MSG_RESULT(yes)],
+ [ HAVE_V4L2="no" && AC_MSG_RESULT(no) &&
+ AC_CHECK_HEADER(linux/videodev2.h,
+ [ AC_MSG_WARN([video4linux2 headers were found, but they're old. Please update v4l2 to compile the v4l2 plugins])],
+ [ AC_MSG_WARN([video4linux2 was not found])])])
])
dnl *** Video CD ***
diff --git a/sys/v4l2/gstv4l2element.h b/sys/v4l2/gstv4l2element.h
index 0e462036..76ad04d4 100644
--- a/sys/v4l2/gstv4l2element.h
+++ b/sys/v4l2/gstv4l2element.h
@@ -21,8 +21,22 @@
#define __GST_V4L2ELEMENT_H__
#include <gst/gst.h>
+
+/* Because of some really cool feature in video4linux1, also known as
+ * 'not including sys/types.h and sys/time.h', we had to include it
+ * ourselves. In all their intelligence, these people decided to fix
+ * this in the next version (video4linux2) in such a cool way that it
+ * breaks all compilations of old stuff...
+ * The real problem is actually that linux/time.h doesn't use proper
+ * macro checks before defining types like struct timeval. The proper
+ * fix here is to either fuck the kernel header (which is what we do
+ * by defining _LINUX_TIME_H, an innocent little hack) or by fixing it
+ * upstream, which I'll consider doing later on. If you get compiler
+ * errors here, check your linux/time.h && sys/time.h header setup.
+ */
#include <sys/types.h>
#include <linux/types.h>
+#define _LINUX_TIME_H
#include <linux/videodev2.h>