test and define HAVE_XSHM build ximage plugin
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 7 Nov 2003 00:53:32 +0000 (00:53 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 7 Nov 2003 00:53:32 +0000 (00:53 +0000)
Original commit message from CVS:
test and define HAVE_XSHM
build ximage plugin

configure.ac
sys/Makefile.am
sys/ximage/ximagesink.c
sys/ximage/ximagesink.h

index ce7f3a0..e495220 100644 (file)
@@ -520,6 +520,13 @@ GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], xvideosink-Xv, [
   fi
 ])
 
+dnl check for XShm
+translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
+GST_CHECK_FEATURE(XSHM, [X11 Shared Memory], ximage, [
+  AC_CHECK_HEADER(X11/extensions/XShm.h,
+                  HAVE_XSHM=yes, HAVE_XSHM=no)
+])
+
 dnl Next, check for the optional libraries:
 dnl These are all libraries used in building plug-ins
 dnl ================================================
@@ -1330,6 +1337,7 @@ sys/v4l/Makefile
 sys/v4l2/Makefile
 sys/vcd/Makefile
 sys/xvideo/Makefile
+sys/ximage/Makefile
 sys/glsink/Makefile
 ext/Makefile
 ext/a52dec/Makefile
index 074a5bd..e47dc0e 100644 (file)
@@ -35,7 +35,7 @@ VCD_DIR=
 endif
 
 if USE_XFREE
-XVIDEO_DIR=xvideo
+XVIDEO_DIR=xvideo ximage
 else
 XVIDEO_DIR=
 endif
index db2f71e..e99711c 100644 (file)
@@ -116,7 +116,7 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
 
   ximage->size =  (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height;
   
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
   if (ximagesink->xcontext->use_xshm)
     {
       ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp,
@@ -163,7 +163,7 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
                                  ximage->width * (ximagesink->xcontext->bpp / 8));
     
   GST_DEBUG ("ximagesink creating an image without XShm");
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
   
   if (ximage->ximage)
     {
@@ -193,7 +193,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
   
   g_mutex_lock (ximagesink->x_lock);
   
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
   if (ximagesink->xcontext->use_xshm)
     {
       if (ximage->SHMInfo.shmaddr)
@@ -216,7 +216,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
 #else
   if (ximage->ximage)
     XDestroyImage(ximage->ximage);
-#endif /* USE_SHM */ 
+#endif /* HAVE_XSHM */ 
   
   g_mutex_unlock (ximagesink->x_lock);
   
@@ -242,7 +242,7 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
   x = MAX (0, (attr.width - ximage->width) / 2);
   y = MAX (0, (attr.height - ximage->height) / 2);
 
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
   if (ximagesink->xcontext->use_xshm)
     {  
       XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, 
@@ -260,7 +260,7 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
   XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, 
              ximagesink->xwindow->gc, ximage->ximage,  
              0, 0, x, y, ximage->width, ximage->height);
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
   
   XSync(ximagesink->xcontext->disp, FALSE);
   
@@ -384,7 +384,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
     
   xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN:G_BIG_ENDIAN;
   
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
   /* Search for XShm extension support */
   if (XQueryExtension (xcontext->disp, "MIT-SHM", &i, &i, &i))
     {
@@ -396,7 +396,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
       xcontext->use_xshm = FALSE;
       GST_DEBUG ("ximagesink is not using XShm extension");
     }
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
   
   if (xcontext->endianness == G_LITTLE_ENDIAN && xcontext->depth == 24) {
     xcontext->endianness = G_BIG_ENDIAN;
index 10314a3..84ea0e0 100644 (file)
 #include <gst/gst.h>
 
 /* FIXME : We should have a configure test for shm support */
-#define USE_SHM
+#define HAVE_XSHM
 
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
 #include <sys/ipc.h>
 #include <sys/shm.h>
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
 #include <X11/extensions/XShm.h>
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
 
 #include <string.h>
 #include <math.h>
@@ -93,9 +93,9 @@ struct _GstXWindow {
 struct _GstXImage {
   XImage *ximage;
   
-#ifdef USE_SHM
+#ifdef HAVE_XSHM
   XShmSegmentInfo SHMInfo;
-#endif /* USE_SHM */
+#endif /* HAVE_XSHM */
   
   char *data;
   gint width, height, size;