test and define HAVE_XSHM build ximage plugin

Original commit message from CVS:
test and define HAVE_XSHM
build ximage plugin
parent da927356
......@@ -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
......
......@@ -35,7 +35,7 @@ VCD_DIR=
endif
if USE_XFREE
XVIDEO_DIR=xvideo
XVIDEO_DIR=xvideo ximage
else
XVIDEO_DIR=
endif
......
......@@ -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;
......
......@@ -23,19 +23,19 @@
#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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment