Index: gst-plugins-bad/sys/v4l2/gstv4l2object.c
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2object.c	2006-05-17 15:24:30.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2object.c	2006-05-17 15:32:00.000000000 +0300
@@ -33,7 +33,12 @@
 #endif
 #include "gstv4l2colorbalance.h"
 
-OPEN_V4L2OBJECT_PROPS CLOSE_V4L2OBJECT_PROPS const GList *
+enum {
+  PROP_0,
+  V4L2_STD_OBJECT_PROPS,
+};
+
+const GList *
 gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
 {
   GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
@@ -60,7 +65,7 @@
   static GList *devices = NULL;
 
   if (!init && !check) {
-    gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
+    const gchar *dev_base[] = { "/dev/video", "/dev/v4l2/video", NULL };
     gint base, n, fd;
 
     while (devices) {
Index: gst-plugins-bad/sys/v4l2/gstv4l2object.h
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2object.h	2006-05-17 15:24:30.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2object.h	2006-05-18 10:20:53.000000000 +0300
@@ -49,6 +49,8 @@
 
 G_BEGIN_DECLS
 
+#define GST_V4L2OBJECT(obj) (GstV4l2Object *)(obj)
+
 typedef struct _GstV4l2Object GstV4l2Object;
 typedef struct _GstV4l2ObjectClassHelper GstV4l2ObjectClassHelper;
 typedef struct _GstV4l2Xv GstV4l2Xv;
@@ -110,17 +112,14 @@
 GType gst_v4l2object_get_type(void);
 
 
-#define OPEN_V4L2OBJECT_PROPS			\
-  enum {					\
-    PROP_0,					\
-    PROP_DEVICE,				\
+#define V4L2_STD_OBJECT_PROPS			\
+    PROP_DEVICE,					\
     PROP_DEVICE_NAME,				\
     PROP_FLAGS,					\
     PROP_STD,					\
     PROP_INPUT,					\
     PROP_FREQUENCY
 
-#define CLOSE_V4L2OBJECT_PROPS   };
 
 extern GstV4l2Object *
 gst_v4l2object_new (GstElement * element,
Index: gst-plugins-bad/sys/v4l2/gstv4l2src.c
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2src.c	2006-05-17 15:24:31.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2src.c	2006-05-17 15:32:51.000000000 +0300
@@ -67,8 +67,13 @@
 #define GST_CAT_DEFAULT v4l2src_debug
 
 
-OPEN_V4L2OBJECT_PROPS, PROP_USE_FIXED_FPS
-    CLOSE_V4L2OBJECT_PROPS static guint32 gst_v4l2_formats[] = {
+enum {
+  PROP_0,
+  V4L2_STD_OBJECT_PROPS,
+  PROP_USE_FIXED_FPS
+};
+    
+static const guint32 gst_v4l2_formats[] = {
   /* from Linux 2.6.15 videodev2.h */
   V4L2_PIX_FMT_RGB332,
   V4L2_PIX_FMT_RGB555,
@@ -126,17 +131,15 @@
 
 #define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats))
 
-GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src)
-
-    GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src)
-
-    GST_IMPLEMENT_V4L2_TUNER_METHODS (GstV4l2Src, gst_v4l2src)
+GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src);
+GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src);
+GST_IMPLEMENT_V4L2_TUNER_METHODS (GstV4l2Src, gst_v4l2src);
 #ifdef HAVE_XVIDEO
-    GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Src, gst_v4l2src)
+    GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Src, gst_v4l2src);
 #endif
-     static gboolean
-         gst_v4l2src_iface_supported (GstImplementsInterface * iface,
-    GType iface_type)
+
+static gboolean
+gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type)
 {
   GstV4l2Object *v4l2object = GST_V4L2SRC (iface)->v4l2object;
 
@@ -225,9 +228,8 @@
 
 static void gst_v4l2src_fixate (GstPad * pad, GstCaps * caps);
 
-static void
-gst_v4l2src_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_v4l2src_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
 static void gst_v4l2src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
Index: gst-plugins-bad/sys/v4l2/gstv4l2src.h
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2src.h	2006-05-17 15:39:09.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2src.h	2006-05-18 10:21:01.000000000 +0300
@@ -33,6 +33,7 @@
 #define GST_V4L2_MIN_BUFFERS 2
 
 G_BEGIN_DECLS
+
 #define GST_TYPE_V4L2SRC			\
   (gst_v4l2src_get_type())
 #define GST_V4L2SRC(obj)						\
@@ -41,8 +42,9 @@
   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4L2SRC,GstV4l2SrcClass))
 #define GST_IS_V4L2SRC(obj)				\
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4L2SRC))
-#define GST_IS_V4L2SRC_CLASS(obj)			\
+#define GST_IS_V4L2SRC_CLASS(klass)			\
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4L2SRC))
+
 typedef struct _GstV4l2BufferPool GstV4l2BufferPool;
 typedef struct _GstV4l2Buffer GstV4l2Buffer;
 typedef struct _GstV4l2Src GstV4l2Src;
Index: gst-plugins-bad/configure.ac
===================================================================
--- gst-plugins-bad.orig/configure.ac	2006-05-12 12:02:00.000000000 +0300
+++ gst-plugins-bad/configure.ac	2006-05-18 13:25:56.000000000 +0300
@@ -204,6 +204,36 @@
 CPPFLAGS="$save_CPPFLAGS"
 LIBS="$save_LIBS"
 
+dnl Check for X11
+translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
+GST_CHECK_FEATURE(X, [X libraries and plugins],
+                  [ximagesrc], [
+  AC_PATH_XTRA
+
+  dnl now try to find the HEADER
+  ac_cflags_save="$CFLAGS"
+  ac_cppflags_save="$CPPFLAGS"
+  CFLAGS="$CFLAGS $X_CFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  AC_CHECK_HEADER(X11/X.h, HAVE_X="yes", HAVE_X="no")
+
+  if test "x$HAVE_X" = "xno"
+  then
+    AC_MSG_NOTICE([cannot find X11 development files])
+  else
+    dnl this is much more than we want
+    X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
+    dnl AC_PATH_XTRA only defines the path needed to find the X libs,
+    dnl it does not add the libs; therefore we add them here
+    X_LIBS="$X_LIBS -lX11"
+    AC_SUBST(X_CFLAGS)
+    AC_SUBST(X_LIBS)
+  fi
+  AC_SUBST(HAVE_X)
+  CFLAGS="$ac_cflags_save"
+  CPPFLAGS="$ac_cppflags_save"
+])
+
 dnl *** Video 4 Linux 2 ***
 dnl for information about the header/define, see sys/v4l2/gstv4l2element.h
 dnl renamed to GST_V4L2 because of some conflict with kernel headers
Index: gst-plugins-bad/sys/v4l2/gstv4l2xoverlay.c
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2xoverlay.c	2006-05-12 12:02:09.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2xoverlay.c	2006-05-18 10:37:32.000000000 +0300
@@ -46,6 +46,11 @@
 GST_DEBUG_CATEGORY_STATIC (v4l2xv_debug);
 #define GST_CAT_DEFAULT v4l2xv_debug
 
+static void gst_v4l2_xoverlay_set_xwindow_id (GstV4l2Object  *v4l2object,
+                                              XID xwindow_id);
+
+
+
 void
 gst_v4l2_xoverlay_interface_init (GstXOverlayClass * klass)
 {
@@ -92,9 +97,9 @@
     return;
   }
   if (fstat (v4l2object->video_fd, &s) < 0) {
-    GST_ELEMENT_ERROR (v4l2object, RESOURCE, GST_RESOURCE_ERROR_NOT_FOUND,
-        (_("Cannot identify '%s': %d, %s\n"),
-            v4l2object->videodev, errno, strerror (errno)), GST_ERROR_SYSTEM);
+    GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND,
+        (_("Cannot identify '%s': %d, %s\n"), v4l2object->videodev, errno, strerror (errno)),
+        (NULL));
     XCloseDisplay (dpy);
     return;
   }
@@ -112,7 +117,7 @@
   XvFreeAdaptorInfo (ai);
 
   if (id == 0) {
-    GST_WARNING (v4l2object, "Did not find XvPortID for device - no overlay");
+    GST_WARNING_OBJECT (v4l2object->element, "Did not find XvPortID for device - no overlay");
     XCloseDisplay (dpy);
     return;
   }
Index: gst-plugins-bad/sys/v4l2/gstv4l2xoverlay.h
===================================================================
--- gst-plugins-bad.orig/sys/v4l2/gstv4l2xoverlay.h	2006-05-12 12:02:09.000000000 +0300
+++ gst-plugins-bad/sys/v4l2/gstv4l2xoverlay.h	2006-05-18 10:35:17.000000000 +0300
@@ -35,9 +35,6 @@
 void gst_v4l2_xoverlay_start (GstV4l2Object  *v4l2object);
 void gst_v4l2_xoverlay_stop  (GstV4l2Object  *v4l2object);
 
-extern void gst_v4l2_xoverlay_set_xwindow_id (GstV4l2Object  *v4l2object,
-                                              XID xwindow_id);
-
 extern void
 gst_v4l2_xoverlay_interface_init (GstXOverlayClass * klass);
 
