/* Debugging category */
#include <gst/gstinfo.h>
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
#define GST_CAT_DEFAULT gst_debug_ximagesink
ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height);
if (!ximage->ximage || error_caught) {
g_mutex_unlock (ximagesink->x_lock);
- /* Reset error handler */
+
+ /* Reset error flag */
error_caught = FALSE;
- XSetErrorHandler (handler);
- /* Push an error */
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
+
+ /* Push a warning */
+ GST_ELEMENT_WARNING (ximagesink, RESOURCE, WRITE,
("Failed to create output image buffer of %dx%d pixels",
ximage->width, ximage->height),
("could not XShmCreateImage a %dx%d image",
ximage->width, ximage->height));
- goto beach;
+
+ /* Retry without XShm */
+ ximagesink->xcontext->use_xshm = FALSE;
+
+ /* Hold X mutex again to try without XShm */
+ g_mutex_lock (ximagesink->x_lock);
+ goto no_xshm;
}
/* we have to use the returned bytes_per_line for our shm size */
shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
} else
+ no_xshm:
#endif /* HAVE_XSHM */
{
guint allocsize;
GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
ximagesink->handle_expose, ximagesink->handle_events);
ximagesink->running = TRUE;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
ximagesink->event_thread = g_thread_create (
(GThreadFunc) gst_ximagesink_event_thread, ximagesink, TRUE, NULL);
+#else
+ ximagesink->event_thread = g_thread_try_new ("ximagesink-events",
+ (GThreadFunc) gst_ximagesink_event_thread, ximagesink, NULL);
+#endif
}
} else {
if (ximagesink->event_thread) {
" and offset %" G_GUINT64_FORMAT, size, caps, offset);
/* assume we're going to alloc what was requested, keep track of
- * wheter we need to unref or not. When we suggest a new format
+ * whether we need to unref or not. When we suggest a new format
* upstream we will create a new caps that we need to unref. */
alloc_caps = caps;
alloc_unref = FALSE;
static gboolean
gst_ximagesink_interface_supported (GstImplementsInterface * iface, GType type)
{
- g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY);
- return TRUE;
+ if (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY)
+ return TRUE;
+ else
+ return FALSE;
}
static void
"Video sink", "Sink/Video",
"A standard X based videosink", "Julien Moutte <julien@moutte.net>");
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
+ gst_element_class_add_static_pad_template (element_class,
+ &gst_ximagesink_sink_template_factory);
}
static void
g_param_spec_string ("display", "Display", "X Display name",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS,
- g_param_spec_boolean ("synchronous", "Synchronous", "When enabled, runs "
- "the X display in synchronous mode. (used only for debugging)", FALSE,
+ g_param_spec_boolean ("synchronous", "Synchronous",
+ "When enabled, runs the X display in synchronous mode. "
+ "(unrelated to A/V sync, used only for debugging)", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",