From 9a378dd53e3796e7c3f38b2085e79eda8300225a Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 7 Nov 2003 00:53:32 +0000 Subject: [PATCH] test and define HAVE_XSHM build ximage plugin Original commit message from CVS: test and define HAVE_XSHM build ximage plugin --- configure.ac | 8 ++++++++ sys/Makefile.am | 2 +- sys/ximage/ximagesink.c | 16 ++++++++-------- sys/ximage/ximagesink.h | 14 +++++++------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index ce7f3a0..e495220 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/sys/Makefile.am b/sys/Makefile.am index 074a5bd..e47dc0e 100644 --- a/sys/Makefile.am +++ b/sys/Makefile.am @@ -35,7 +35,7 @@ VCD_DIR= endif if USE_XFREE -XVIDEO_DIR=xvideo +XVIDEO_DIR=xvideo ximage else XVIDEO_DIR= endif diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index db2f71e..e99711c 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -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; diff --git a/sys/ximage/ximagesink.h b/sys/ximage/ximagesink.h index 10314a3..84ea0e0 100644 --- a/sys/ximage/ximagesink.h +++ b/sys/ximage/ximagesink.h @@ -23,19 +23,19 @@ #include /* FIXME : We should have a configure test for shm support */ -#define USE_SHM +#define HAVE_XSHM -#ifdef USE_SHM +#ifdef HAVE_XSHM #include #include -#endif /* USE_SHM */ +#endif /* HAVE_XSHM */ #include #include -#ifdef USE_SHM +#ifdef HAVE_XSHM #include -#endif /* USE_SHM */ +#endif /* HAVE_XSHM */ #include #include @@ -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; -- 2.7.4