diff --git a/ChangeLog b/ChangeLog index 96db7c60e6..ef0148e400 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-05-18 Stefan Kost + + * configure.ac: + Check for X11 + * sys/v4l2/gstv4l2object.c: (gst_v4l2_class_probe_devices): + * sys/v4l2/gstv4l2object.h: + * sys/v4l2/gstv4l2src.c: (gst_v4l2src_iface_supported): + * sys/v4l2/gstv4l2src.h: + * sys/v4l2/gstv4l2xoverlay.c: (gst_v4l2_xoverlay_open): + * sys/v4l2/gstv4l2xoverlay.h: + Code cleanups, fix debug macros + 2006-05-18 Michael Smith * ext/Makefile.am: diff --git a/common b/common index a5b66304e7..6811863fce 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit a5b66304e7abe1440a0f8b0ed232ffbc56e8f3de +Subproject commit 6811863fce665ce0a466bc03ee2ac5e2d5f47d28 diff --git a/configure.ac b/configure.ac index edec3d7cac..7fae772aad 100644 --- a/configure.ac +++ b/configure.ac @@ -204,6 +204,36 @@ GST_CHECK_FEATURE(OPENGL, [Open GL], glsink, [ 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 diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 941f9a6ac0..e7485ebf8d 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -33,7 +33,13 @@ #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 +66,7 @@ gst_v4l2_class_probe_devices (GstElementClass * klass, gboolean check, 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) { diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 37552185c2..5692b26eae 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -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 @@ struct _GstV4l2ObjectClassHelper { 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, diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index b38d34eaa9..6dfbf0b370 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -67,8 +67,14 @@ GST_DEBUG_CATEGORY (v4l2src_debug); #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 +132,15 @@ OPEN_V4L2OBJECT_PROPS, PROP_USE_FIXED_FPS #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 +229,8 @@ static GstFlowReturn gst_v4l2src_create (GstPushSrc * src, GstBuffer ** out); 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); diff --git a/sys/v4l2/gstv4l2src.h b/sys/v4l2/gstv4l2src.h index 54500ac08d..c20ee22c3b 100644 --- a/sys/v4l2/gstv4l2src.h +++ b/sys/v4l2/gstv4l2src.h @@ -33,6 +33,7 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug); #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_BEGIN_DECLS (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; diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c index bcf095e7b4..fa2154fa86 100644 --- a/sys/v4l2/gstv4l2xoverlay.c +++ b/sys/v4l2/gstv4l2xoverlay.c @@ -46,6 +46,11 @@ struct _GstV4l2Xv 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 @@ gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object) 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,8 @@ gst_v4l2_xoverlay_open (GstV4l2Object * v4l2object) 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; } diff --git a/sys/v4l2/gstv4l2xoverlay.h b/sys/v4l2/gstv4l2xoverlay.h index 1f39cc7595..d8add592d1 100644 --- a/sys/v4l2/gstv4l2xoverlay.h +++ b/sys/v4l2/gstv4l2xoverlay.h @@ -35,9 +35,6 @@ G_BEGIN_DECLS 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);