sys/: Fix compilation when XShm is not available.

Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_xcontext_get):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_init),
(gst_xvimagesink_check_xshm_calls):
Fix compilation when XShm is not available.
This commit is contained in:
Jan Schmidt 2005-09-08 16:38:30 +00:00
parent 8e296da9dd
commit 0ba2f79cb5
3 changed files with 24 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2005-09-08 Jan Schmidt <thaytan@mad.scientist.com>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_check_xshm_calls), (gst_ximagesink_xcontext_get):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_init),
(gst_xvimagesink_check_xshm_calls):
Fix compilation when XShm is not available.
2005-09-07 Jan Schmidt <thaytan@mad.scientist.com> 2005-09-07 Jan Schmidt <thaytan@mad.scientist.com>
* ext/libvisual/visual.c: (gst_visual_dispose), * ext/libvisual/visual.c: (gst_visual_dispose),

View File

@ -81,7 +81,6 @@ enum
}; };
static GstVideoSinkClass *parent_class = NULL; static GstVideoSinkClass *parent_class = NULL;
static gboolean error_caught = FALSE;
/* ============================================================= */ /* ============================================================= */
/* */ /* */
@ -143,8 +142,10 @@ gst_ximage_buffer_finalize (GstXImageBuffer * ximage_buffer)
static void static void
gst_ximage_buffer_init (GstXImageBuffer * ximage_buffer, gpointer g_class) gst_ximage_buffer_init (GstXImageBuffer * ximage_buffer, gpointer g_class)
{ {
#ifdef HAVE_XSHM
ximage_buffer->SHMInfo.shmaddr = ((void *) -1); ximage_buffer->SHMInfo.shmaddr = ((void *) -1);
ximage_buffer->SHMInfo.shmid = -1; ximage_buffer->SHMInfo.shmid = -1;
#endif
} }
static void static void
@ -182,6 +183,9 @@ gst_ximage_buffer_get_type (void)
/* X11 stuff */ /* X11 stuff */
#ifdef HAVE_XSHM
static gboolean error_caught = FALSE;
static int static int
gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent) gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
{ {
@ -198,9 +202,6 @@ gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
static gboolean static gboolean
gst_ximagesink_check_xshm_calls (GstXContext * xcontext) gst_ximagesink_check_xshm_calls (GstXContext * xcontext)
{ {
#ifndef HAVE_XSHM
return FALSE;
#else
GstXImageBuffer *ximage = NULL; GstXImageBuffer *ximage = NULL;
int (*handler) (Display *, XErrorEvent *); int (*handler) (Display *, XErrorEvent *);
gboolean result = FALSE; gboolean result = FALSE;
@ -267,8 +268,8 @@ beach:
XSync (xcontext->disp, FALSE); XSync (xcontext->disp, FALSE);
return result; return result;
#endif /* HAVE_XSHM */
} }
#endif /* HAVE_XSHM */
/* This function handles GstXImageBuffer creation depending on XShm availability */ /* This function handles GstXImageBuffer creation depending on XShm availability */
static GstXImageBuffer * static GstXImageBuffer *
@ -881,17 +882,18 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
(ImageByteOrder (xcontext->disp) == (ImageByteOrder (xcontext->disp) ==
LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
#ifdef HAVE_XSHM
/* Search for XShm extension support */ /* Search for XShm extension support */
#ifdef HAVE_XSHM
if (XShmQueryExtension (xcontext->disp) && if (XShmQueryExtension (xcontext->disp) &&
gst_ximagesink_check_xshm_calls (xcontext)) { gst_ximagesink_check_xshm_calls (xcontext)) {
xcontext->use_xshm = TRUE; xcontext->use_xshm = TRUE;
GST_DEBUG ("ximagesink is using XShm extension"); GST_DEBUG ("ximagesink is using XShm extension");
} else { } else
#endif
{
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_XSHM */
/* our caps system handles 24/32bpp RGB as big-endian. */ /* our caps system handles 24/32bpp RGB as big-endian. */
if ((xcontext->bpp == 24 || xcontext->bpp == 32) && if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&

View File

@ -86,7 +86,6 @@ enum
}; };
static GstVideoSinkClass *parent_class = NULL; static GstVideoSinkClass *parent_class = NULL;
static gboolean error_caught = FALSE;
/* ============================================================= */ /* ============================================================= */
/* */ /* */
@ -204,8 +203,10 @@ gst_xvimage_buffer_free (GstXvImageBuffer * xvimage)
static void static void
gst_xvimage_buffer_init (GstXvImageBuffer * xvimage, gpointer g_class) gst_xvimage_buffer_init (GstXvImageBuffer * xvimage, gpointer g_class)
{ {
#ifdef HAVE_XSHM
xvimage->SHMInfo.shmaddr = ((void *) -1); xvimage->SHMInfo.shmaddr = ((void *) -1);
xvimage->SHMInfo.shmid = -1; xvimage->SHMInfo.shmid = -1;
#endif
} }
static void static void
@ -243,6 +244,9 @@ gst_xvimage_buffer_get_type (void)
/* X11 stuff */ /* X11 stuff */
#ifdef HAVE_XSHM
static gboolean error_caught = FALSE;
static int static int
gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent) gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent)
{ {
@ -259,9 +263,6 @@ gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent)
static gboolean static gboolean
gst_xvimagesink_check_xshm_calls (GstXContext * xcontext) gst_xvimagesink_check_xshm_calls (GstXContext * xcontext)
{ {
#ifndef HAVE_XSHM
return FALSE;
#else
XvImage *xvimage; XvImage *xvimage;
XShmSegmentInfo SHMInfo; XShmSegmentInfo SHMInfo;
gint size; gint size;
@ -322,8 +323,8 @@ beach:
if (xvimage) if (xvimage)
XFree (xvimage); XFree (xvimage);
return result; return result;
#endif /* HAVE_XSHM */
} }
#endif /* HAVE_XSHM */
/* This function handles GstXvImage creation depending on XShm availability */ /* This function handles GstXvImage creation depending on XShm availability */
static GstXvImageBuffer * static GstXvImageBuffer *