fix build system for X, XShm and Xv

Original commit message from CVS:
fix build system for X, XShm and Xv
This commit is contained in:
Benjamin Otte 2003-11-12 03:06:07 +00:00
parent 908cbecf56
commit fb844d50ec
6 changed files with 75 additions and 59 deletions

View file

@ -254,19 +254,6 @@ AC_SUBST(GTK_CFLAGS)
AC_SUBST(HAVE_GTK) AC_SUBST(HAVE_GTK)
AM_CONDITIONAL(HAVE_GDK_LOADERS, test "x$HAVE_GTK_22" = "xyes") AM_CONDITIONAL(HAVE_GDK_LOADERS, test "x$HAVE_GTK_22" = "xyes")
dnl Check for X11 extensions
AC_PATH_XTRA
if test "-DX_DISPLAY_MISSING" = "$X_CFLAGS"; then
AC_MSG_NOTICE([cannot find X11, the build system needs fixage])
fi
dnl AC_PATH_XTRA only defines the path needed to find the X libs, not the libs
dnl therefore we add them here
X_LIBS="$X_LIBS -lX11"
AC_SUBST(X_CFLAGS)
AC_SUBST(X_PRE_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(X_LIBS)
dnl =========================================================================== dnl ===========================================================================
dnl ============================= gst plug-ins ================================ dnl ============================= gst plug-ins ================================
dnl =========================================================================== dnl ===========================================================================
@ -477,16 +464,23 @@ dnl ;;
fi fi
]) ])
dnl *** X check *** dnl Check for X11
translit(dnm, m, l) AM_CONDITIONAL(USE_XFREE, true) AC_PATH_XTRA
GST_CHECK_FEATURE(XFREE, [X11 XFree86], if test "-DX_DISPLAY_MISSING" = "$X_CFLAGS"; then
[ximagesink xvideosink], [ AC_MSG_NOTICE([cannot find X11, the build system needs fixage])
if test "$X_CFLAGS" = "-DX_DISPLAY_MISSING"; then HAVE_X="no"
HAVE_XFREE=no else
else dnl this is much more than we want
HAVE_XFREE=yes X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
fi dnl AC_PATH_XTRA only defines the path needed to find the X libs, not the libs
]) dnl therefore we add them here
X_LIBS="$X_LIBS -lX11"
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
HAVE_X="yes";
fi
AC_SUBST(HAVE_X)
AM_CONDITIONAL(USE_X, test "-DX_DISPLAY_MISSING" != "$X_CFLAGS")
dnl *** XVideo *** dnl *** XVideo ***
dnl Look for the PIC library first, Debian requires it. dnl Look for the PIC library first, Debian requires it.
@ -507,10 +501,10 @@ dnl Check for Xv extension
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true) translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
[xvimagesink xvideosink], [ [xvimagesink xvideosink], [
if test x$HAVE_XFREE = xyes; then if test x$HAVE_X = xyes; then
AC_CHECK_LIB(Xv_pic, XvQueryExtension, AC_CHECK_LIB(Xv_pic, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no", HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS) $X_LIBS -lXext)
if test x$HAVE_XVIDEO = xyes; then if test x$HAVE_XVIDEO = xyes; then
XVIDEO_LIBS="-lXv_pic -lXext" XVIDEO_LIBS="-lXv_pic -lXext"
@ -520,7 +514,7 @@ GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
if test x$HAVE_XVIDEO = xno; then if test x$HAVE_XVIDEO = xno; then
AC_CHECK_LIB(Xv, XvQueryExtension, AC_CHECK_LIB(Xv, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no", HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS) $X_LIBS -lXext)
if test x$HAVE_XVIDEO = xyes; then if test x$HAVE_XVIDEO = xyes; then
XVIDEO_LIBS="-lXv -lXext" XVIDEO_LIBS="-lXv -lXext"
@ -531,11 +525,29 @@ GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
fi fi
]) ])
dnl check for Shm dnl check for X Shm
translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true) translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
GST_CHECK_FEATURE(SHM, [Shared Memory], ximage with shm, [ GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], xshm, [
AC_CHECK_HEADER(sys/shm.h, HAVE_SHM="yes", HAVE_SHM="no") if test x$HAVE_X = xyes; then
]) AC_CHECK_LIB(Xext, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
$X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext"
else
dnl On AIX, it is in XextSam instead, but we still need -lXext
AC_CHECK_LIB(XextSam, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
$X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext -lXextSam"
fi
fi
fi
], , [
AC_SUBST(HAVE_XSHM)
AC_SUBST(XSHM_LIBS)
] )
dnl Next, check for the optional libraries: dnl Next, check for the optional libraries:
dnl These are all libraries used in building plug-ins dnl These are all libraries used in building plug-ins
@ -1341,14 +1353,15 @@ gst/y4m/Makefile
sys/Makefile sys/Makefile
sys/cdrom/Makefile sys/cdrom/Makefile
sys/dxr3/Makefile sys/dxr3/Makefile
sys/glsink/Makefile
sys/oss/Makefile sys/oss/Makefile
sys/qcam/Makefile sys/qcam/Makefile
sys/v4l/Makefile sys/v4l/Makefile
sys/v4l2/Makefile sys/v4l2/Makefile
sys/vcd/Makefile sys/vcd/Makefile
sys/xvideo/Makefile
sys/ximage/Makefile sys/ximage/Makefile
sys/glsink/Makefile sys/xvimage/Makefile
sys/xvideo/Makefile
ext/Makefile ext/Makefile
ext/a52dec/Makefile ext/a52dec/Makefile
ext/aalib/Makefile ext/aalib/Makefile

View file

@ -4,7 +4,7 @@ else
GCONF_DIR= GCONF_DIR=
endif endif
if USE_XFREE if USE_X
X_DIR=xwindowlistener X_DIR=xwindowlistener
else else
X_DIR= X_DIR=

View file

@ -34,14 +34,17 @@ else
VCD_DIR= VCD_DIR=
endif endif
# doesn't work if USE_X
#if USE_XFREE X_DIR=ximage xvideo
#XVIDEO_DIR=xvideo else
#XIMAGE_DIR=ximage X_DIR=
#else endif
#XVIDEO_DIR=
#XIMAGE_DIR= if USE_XVIDEO
#endif XV_DIR=xvimage
else
XV_DIR=
endif
if USE_CDROM if USE_CDROM
CDROM_DIR=cdrom CDROM_DIR=cdrom
@ -50,6 +53,6 @@ CDROM_DIR=
endif endif
SUBDIRS=$(DXR3_DIR) $(OSS_DIR) $(QCAM_DIR) $(V4L_DIR) $(V4L2_DIR) \ SUBDIRS=$(DXR3_DIR) $(OSS_DIR) $(QCAM_DIR) $(V4L_DIR) $(V4L2_DIR) \
$(VCD_DIR) $(CDROM_DIR) $(VCD_DIR) $(CDROM_DIR) $(X_DIR) $(XV_DIR)
DIST_SUBDIRS=dxr3 oss qcam v4l v4l2 vcd xvideo ximage glsink cdrom DIST_SUBDIRS=dxr3 oss qcam v4l v4l2 vcd xvideo ximage glsink cdrom

View file

@ -3,7 +3,7 @@ plugin_LTLIBRARIES = libgstximagesink.la
libgstximagesink_la_SOURCES = ximagesink.c libgstximagesink_la_SOURCES = ximagesink.c
libgstximagesink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) libgstximagesink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS)
libgstximagesink_la_LIBADD = $(X_LIBS) libgstximagesink_la_LIBADD = $(X_LIBS) $(XSHM_LIBS)
libgstximagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \ libgstximagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
$(top_builddir)/gst-libs/gst/navigation/libgstnavigation.la \ $(top_builddir)/gst-libs/gst/navigation/libgstnavigation.la \
$(top_builddir)/gst-libs/gst/xoverlay/libgstxoverlay.la $(top_builddir)/gst-libs/gst/xoverlay/libgstxoverlay.la

View file

@ -129,7 +129,7 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
ximage->size = (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height; ximage->size = (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height;
#ifdef HAVE_SHM #ifdef HAVE_XSHM
if (ximagesink->xcontext->use_xshm) if (ximagesink->xcontext->use_xshm)
{ {
ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp, ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp,
@ -170,7 +170,7 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
ximage->width, ximage->height, ximage->width, ximage->height,
ximagesink->xcontext->bpp, ximagesink->xcontext->bpp,
ximage->width * (ximagesink->xcontext->bpp / 8)); ximage->width * (ximagesink->xcontext->bpp / 8));
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
if (ximage->ximage) if (ximage->ximage)
{ {
@ -201,7 +201,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
g_mutex_lock (ximagesink->x_lock); g_mutex_lock (ximagesink->x_lock);
#ifdef HAVE_SHM #ifdef HAVE_XSHM
if (ximagesink->xcontext->use_xshm) if (ximagesink->xcontext->use_xshm)
{ {
if (ximage->SHMInfo.shmaddr) if (ximage->SHMInfo.shmaddr)
@ -224,7 +224,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
#else #else
if (ximage->ximage) if (ximage->ximage)
XDestroyImage (ximage->ximage); XDestroyImage (ximage->ximage);
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
g_mutex_unlock (ximagesink->x_lock); g_mutex_unlock (ximagesink->x_lock);
@ -251,7 +251,7 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
x = MAX (0, (attr.width - ximage->width) / 2); x = MAX (0, (attr.width - ximage->width) / 2);
y = MAX (0, (attr.height - ximage->height) / 2); y = MAX (0, (attr.height - ximage->height) / 2);
#ifdef HAVE_SHM #ifdef HAVE_XSHM
if (ximagesink->xcontext->use_xshm) if (ximagesink->xcontext->use_xshm)
{ {
XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
@ -269,7 +269,7 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
ximagesink->xwindow->gc, ximage->ximage, ximagesink->xwindow->gc, ximage->ximage,
0, 0, x, y, ximage->width, ximage->height); 0, 0, x, y, ximage->width, ximage->height);
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
XSync(ximagesink->xcontext->disp, FALSE); XSync(ximagesink->xcontext->disp, FALSE);
@ -507,7 +507,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN:G_BIG_ENDIAN; xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN:G_BIG_ENDIAN;
#ifdef HAVE_SHM #ifdef HAVE_XSHM
/* Search for XShm extension support */ /* Search for XShm extension support */
if (XQueryExtension (xcontext->disp, "MIT-SHM", &i, &i, &i)) if (XQueryExtension (xcontext->disp, "MIT-SHM", &i, &i, &i))
{ {
@ -519,7 +519,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
xcontext->use_xshm = FALSE; xcontext->use_xshm = FALSE;
GST_DEBUG ("ximagesink is not using XShm extension"); GST_DEBUG ("ximagesink is not using XShm extension");
} }
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
/* What the hell is that ? */ /* What the hell is that ? */
if (xcontext->endianness == G_LITTLE_ENDIAN && xcontext->depth == 24) if (xcontext->endianness == G_LITTLE_ENDIAN && xcontext->depth == 24)

View file

@ -23,19 +23,19 @@
#include <gst/gst.h> #include <gst/gst.h>
/* FIXME : We should have a configure test for shm support */ /* FIXME : We should have a configure test for shm support */
#define HAVE_SHM #define HAVE_XSHM
#ifdef HAVE_SHM #ifdef HAVE_XSHM
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef HAVE_SHM #ifdef HAVE_XSHM
#include <X11/extensions/XShm.h> #include <X11/extensions/XShm.h>
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -93,9 +93,9 @@ struct _GstXWindow {
struct _GstXImage { struct _GstXImage {
XImage *ximage; XImage *ximage;
#ifdef HAVE_SHM #ifdef HAVE_XSHM
XShmSegmentInfo SHMInfo; XShmSegmentInfo SHMInfo;
#endif /* HAVE_SHM */ #endif /* HAVE_XSHM */
char *data; char *data;
gint width, height, size; gint width, height, size;