From 0d98aa25b8a163625281b0b1d7f05dd0ed345218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 4 Dec 2011 16:43:38 +0000 Subject: [PATCH] Work around deprecated thread API in glib master Add private replacements for deprecated functions such as g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly to avoid the deprecation warnings. We'll change these over to the new API once we depend on glib >= 2.32. Replace g_thread_create() with g_thread_try_new(). --- ext/alsa/gstalsadeviceprobe.c | 6 +- ext/alsa/gstalsamixer.c | 1 + ext/alsa/gstalsasink.c | 1 + ext/alsa/gstalsasrc.c | 1 + ext/ogg/gstoggdemux.c | 2 + ext/pango/gsttextoverlay.c | 2 + gst-libs/gst/Makefile.am | 2 +- gst-libs/gst/app/gstappsink.c | 2 + gst-libs/gst/app/gstappsrc.c | 2 + gst-libs/gst/audio/gstaudiosink.c | 9 ++ gst-libs/gst/audio/gstaudiosrc.c | 9 ++ gst-libs/gst/audio/gstringbuffer.c | 2 + gst-libs/gst/glib-compat-private.h | 120 ++++++++++++++++++++++++++ gst-libs/gst/pbutils/gstdiscoverer.c | 2 + gst-libs/gst/rtsp/gstrtspconnection.c | 2 + gst-libs/gst/video/convertframe.c | 2 + gst/encoding/gststreamcombiner.c | 7 +- gst/encoding/gststreamsplitter.c | 7 +- gst/playback/gstdecodebin.c | 1 + gst/playback/gstdecodebin2.c | 2 + gst/playback/gstplaybasebin.c | 2 + gst/playback/gstplaybin2.c | 2 + gst/playback/gstplaysinkconvertbin.c | 1 + gst/playback/gststreamsynchronizer.c | 7 +- gst/playback/gstsubtitleoverlay.c | 5 +- gst/playback/gsturidecodebin.c | 5 +- gst/tcp/gstmultifdsink.c | 6 ++ sys/ximage/ximagesink.c | 7 ++ sys/xvimage/xvimagesink.c | 8 ++ 29 files changed, 206 insertions(+), 19 deletions(-) create mode 100644 gst-libs/gst/glib-compat-private.h diff --git a/ext/alsa/gstalsadeviceprobe.c b/ext/alsa/gstalsadeviceprobe.c index 83596a3f5d..4b22d34104 100644 --- a/ext/alsa/gstalsadeviceprobe.c +++ b/ext/alsa/gstalsadeviceprobe.c @@ -26,6 +26,8 @@ #include "gstalsadeviceprobe.h" #include "gst/interfaces/propertyprobe.h" +G_LOCK_DEFINE_STATIC (probe_lock); + static const GList * gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe) { @@ -34,7 +36,7 @@ gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe) /* well, not perfect, but better than no locking at all. * In the worst case we leak a list node, so who cares? */ - GST_CLASS_LOCK (GST_OBJECT_CLASS (klass)); + G_LOCK (probe_lock); if (!list) { GParamSpec *pspec; @@ -43,7 +45,7 @@ gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe) list = g_list_append (NULL, pspec); } - GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass)); + G_UNLOCK (probe_lock); return list; } diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c index 46c10c44c4..84e0654843 100644 --- a/ext/alsa/gstalsamixer.c +++ b/ext/alsa/gstalsamixer.c @@ -35,6 +35,7 @@ #endif #include "gstalsamixer.h" +#include "gst/glib-compat-private.h" #include static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer, diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index a878b5ef08..24b1d8aac2 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -52,6 +52,7 @@ #include "gstalsadeviceprobe.h" #include +#include "gst/glib-compat-private.h" #define DEFAULT_DEVICE "default" #define DEFAULT_DEVICE_NAME "" diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 1a99a68f90..917f0dc323 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -48,6 +48,7 @@ #include "gstalsasrc.h" #include "gstalsadeviceprobe.h" +#include "gst/glib-compat-private.h" #include diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 6e924f9dd6..ba5fc2095e 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -45,6 +45,8 @@ #include "gstoggdemux.h" +#include "gst/glib-compat-private.h" + #define CHUNKSIZE (8500) /* this is out of vorbisfile */ /* we hope we get a granpos within this many bytes off the end */ diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 6abff7dbc5..76b8f7448b 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -92,6 +92,8 @@ #include "gsttextrender.h" #include +#include "gst/glib-compat-private.h" + /* FIXME: * - use proper strides and offset for I420 * - if text is wider than the video picture, it does not get diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am index 6f261b3d6e..0984251621 100644 --- a/gst-libs/gst/Makefile.am +++ b/gst-libs/gst/Makefile.am @@ -18,7 +18,7 @@ SUBDIRS = \ riff \ app -noinst_HEADERS = gettext.h gst-i18n-plugin.h +noinst_HEADERS = gettext.h gst-i18n-plugin.h glib-compat-private.h # dependencies: audio: interfaces pbutils diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index a1a20a5b06..9a891b6c9e 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -76,6 +76,8 @@ #include "gstappsink.h" +#include "gst/glib-compat-private.h" + struct _GstAppSinkPrivate { GstCaps *caps; diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c index 6ae59e5931..543a2ad043 100644 --- a/gst-libs/gst/app/gstappsrc.c +++ b/gst-libs/gst/app/gstappsrc.c @@ -102,6 +102,8 @@ #include "gstapp-marshal.h" #include "gstappsrc.h" +#include "gst/glib-compat-private.h" + struct _GstAppSrcPrivate { GCond *cond; diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c index ac39cb1bfa..c5fec7367c 100644 --- a/gst-libs/gst/audio/gstaudiosink.c +++ b/gst-libs/gst/audio/gstaudiosink.c @@ -71,6 +71,8 @@ #include "gstaudiosink.h" +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug); #define GST_CAT_DEFAULT gst_audio_sink_debug @@ -426,9 +428,16 @@ gst_audioringbuffer_activate (GstRingBuffer * buf, gboolean active) abuf->running = TRUE; GST_DEBUG_OBJECT (sink, "starting thread"); + +#if !GLIB_CHECK_VERSION (2, 31, 0) sink->thread = g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE, &error); +#else + sink->thread = g_thread_try_new ("audiosink-ringbuffer", + (GThreadFunc) audioringbuffer_thread_func, buf, &error); +#endif + if (!sink->thread || error != NULL) goto thread_failed; diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c index d7a6b547db..004153e6ce 100644 --- a/gst-libs/gst/audio/gstaudiosrc.c +++ b/gst-libs/gst/audio/gstaudiosrc.c @@ -71,6 +71,8 @@ #include "gstaudiosrc.h" +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_audio_src_debug); #define GST_CAT_DEFAULT gst_audio_src_debug @@ -382,9 +384,16 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) abuf = GST_AUDIORING_BUFFER (buf); abuf->running = TRUE; + /* FIXME: handle thread creation failure */ +#if !GLIB_CHECK_VERSION (2, 31, 0) src->thread = g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE, NULL); +#else + src->thread = g_thread_try_new ("audiosrc-ringbuffer", + (GThreadFunc) audioringbuffer_thread_func, buf, NULL); +#endif + GST_AUDIORING_BUFFER_WAIT (buf); return result; diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index ab1880c687..50693045cf 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -43,6 +43,8 @@ #include "gstringbuffer.h" +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_ring_buffer_debug); #define GST_CAT_DEFAULT gst_ring_buffer_debug diff --git a/gst-libs/gst/glib-compat-private.h b/gst-libs/gst/glib-compat-private.h new file mode 100644 index 0000000000..d143d3257d --- /dev/null +++ b/gst-libs/gst/glib-compat-private.h @@ -0,0 +1,120 @@ +/* + * glib-compat.c + * Functions copied from glib 2.10 + * + * Copyright 2005 David Schleef + */ + +#ifndef __GLIB_COMPAT_PRIVATE_H__ +#define __GLIB_COMPAT_PRIVATE_H__ + +#include + +G_BEGIN_DECLS + +#if !GLIB_CHECK_VERSION(2,25,0) + +#if defined (_MSC_VER) && !defined(_WIN64) +typedef struct _stat32 GStatBuf; +#else +typedef struct stat GStatBuf; +#endif + +#endif + +#if GLIB_CHECK_VERSION(2,26,0) +#define GLIB_HAS_GDATETIME +#endif + +/* See bug #651514 */ +#if GLIB_CHECK_VERSION(2,29,5) +#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \ + g_atomic_pointer_compare_and_exchange ((a),(b),(c)) +#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \ + g_atomic_int_compare_and_exchange ((a),(b),(c)) +#else +#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \ + g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c)) +#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \ + g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c)) +#endif + +/* See bug #651514 */ +#if GLIB_CHECK_VERSION(2,29,5) +#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b)) +#else +#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b)) +#endif + +/* copies */ + +#if GLIB_CHECK_VERSION (2, 31, 0) +#define g_mutex_new gst_g_mutex_new +static inline GMutex * +gst_g_mutex_new (void) +{ + GMutex *mutex = g_slice_new (GMutex); + g_mutex_init (mutex); + return mutex; +} +#define g_mutex_free gst_g_mutex_free +static inline void +gst_g_mutex_free (GMutex *mutex) +{ + g_mutex_clear (mutex); + g_slice_free (GMutex, mutex); +} +#define g_static_rec_mutex_init gst_g_static_rec_mutex_init +static inline void +gst_g_static_rec_mutex_init (GStaticRecMutex *mutex) +{ + static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT; + + *mutex = init_mutex; +} +#define g_cond_new gst_g_cond_new +static inline GCond * +gst_g_cond_new (void) +{ + GCond *cond = g_slice_new (GCond); + g_cond_init (cond); + return cond; +} +#define g_cond_free gst_g_cond_free +static inline void +gst_g_cond_free (GCond *cond) +{ + g_cond_clear (cond); + g_slice_free (GCond, cond); +} +#define g_cond_timed_wait gst_g_cond_timed_wait +static inline gboolean +gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time) +{ + gint64 end_time; + + if (abs_time == NULL) { + g_cond_wait (cond, mutex); + return TRUE; + } + + end_time = abs_time->tv_sec; + end_time *= 1000000; + end_time += abs_time->tv_usec; + + /* would be nice if we had clock_rtoffset, but that didn't seem to + * make it into the kernel yet... + */ + /* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and + * g_get_real_time() are returning the same clock and we'd add ~0 + */ + end_time += g_get_monotonic_time () - g_get_real_time (); + return g_cond_wait_until (cond, mutex, end_time); +} +#endif /* GLIB_CHECK_VERSION (2, 31, 0) */ + +/* adaptations */ + +G_END_DECLS + +#endif diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index bce956edbe..6af71dca4a 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -48,6 +48,8 @@ #include "pbutils-marshal.h" #include "pbutils-private.h" +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (discoverer_debug); #define GST_CAT_DEFAULT discoverer_debug diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index da39c21cd2..5fcfa252d3 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -93,6 +93,8 @@ #include "gstrtspconnection.h" #include "gstrtspbase64.h" +#include "gst/glib-compat-private.h" + union gst_sockaddr { struct sockaddr sa; diff --git a/gst-libs/gst/video/convertframe.c b/gst-libs/gst/video/convertframe.c index 58dc426258..756ce71979 100644 --- a/gst-libs/gst/video/convertframe.c +++ b/gst-libs/gst/video/convertframe.c @@ -22,6 +22,8 @@ #include #include "video.h" +#include "gst/glib-compat-private.h" + static gboolean caps_are_raw (const GstCaps * caps) { diff --git a/gst/encoding/gststreamcombiner.c b/gst/encoding/gststreamcombiner.c index 7328695917..c601cf8811 100644 --- a/gst/encoding/gststreamcombiner.c +++ b/gst/encoding/gststreamcombiner.c @@ -23,6 +23,7 @@ #endif #include "gststreamcombiner.h" +#include "gst/glib-compat-private.h" static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -62,10 +63,8 @@ gst_stream_combiner_class_init (GstStreamCombinerClass * klass) GST_DEBUG_CATEGORY_INIT (gst_stream_combiner_debug, "streamcombiner", 0, "Stream Combiner"); - gst_element_class_add_static_pad_template (gstelement_klass, - &src_template); - gst_element_class_add_static_pad_template (gstelement_klass, - &sink_template); + gst_element_class_add_static_pad_template (gstelement_klass, &src_template); + gst_element_class_add_static_pad_template (gstelement_klass, &sink_template); gstelement_klass->request_new_pad = GST_DEBUG_FUNCPTR (gst_stream_combiner_request_new_pad); diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c index 9221b353a2..8c568a9630 100644 --- a/gst/encoding/gststreamsplitter.c +++ b/gst/encoding/gststreamsplitter.c @@ -23,6 +23,7 @@ #endif #include "gststreamsplitter.h" +#include "gst/glib-compat-private.h" static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src_%d", GST_PAD_SRC, GST_PAD_REQUEST, @@ -62,10 +63,8 @@ gst_stream_splitter_class_init (GstStreamSplitterClass * klass) GST_DEBUG_CATEGORY_INIT (gst_stream_splitter_debug, "streamsplitter", 0, "Stream Splitter"); - gst_element_class_add_static_pad_template (gstelement_klass, - &src_template); - gst_element_class_add_static_pad_template (gstelement_klass, - &sink_template); + gst_element_class_add_static_pad_template (gstelement_klass, &src_template); + gst_element_class_add_static_pad_template (gstelement_klass, &sink_template); gstelement_klass->request_new_pad = GST_DEBUG_FUNCPTR (gst_stream_splitter_request_new_pad); diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 7ce222fb48..771a1db618 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -45,6 +45,7 @@ #include #include #include +#include "gst/glib-compat-private.h" #include "gstplay-marshal.h" diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 45ff2b14bb..187221eb51 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -96,6 +96,8 @@ #include "gstplayback.h" #include "gstrawcaps.h" +#include "gst/glib-compat-private.h" + /* generic templates */ static GstStaticPadTemplate decoder_bin_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 2d26aad88d..7ab2c29ac1 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -29,6 +29,8 @@ #include +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug); #define GST_CAT_DEFAULT gst_play_base_bin_debug diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 9f86e3e3ec..f9478e266e 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -233,6 +233,8 @@ #include "gstplaysink.h" #include "gstsubtitleoverlay.h" +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug); #define GST_CAT_DEFAULT gst_play_bin_debug diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c index d05f2ac517..51ede9bb46 100644 --- a/gst/playback/gstplaysinkconvertbin.c +++ b/gst/playback/gstplaysinkconvertbin.c @@ -26,6 +26,7 @@ #include #include +#include "gst/glib-compat-private.h" GST_DEBUG_CATEGORY_STATIC (gst_play_sink_convert_bin_debug); #define GST_CAT_DEFAULT gst_play_sink_convert_bin_debug diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c index 594b4b2be1..c6c53dbc81 100644 --- a/gst/playback/gststreamsynchronizer.c +++ b/gst/playback/gststreamsynchronizer.c @@ -22,6 +22,7 @@ #endif #include "gststreamsynchronizer.h" +#include "gst/glib-compat-private.h" GST_DEBUG_CATEGORY_STATIC (stream_synchronizer_debug); #define GST_CAT_DEFAULT stream_synchronizer_debug @@ -955,10 +956,8 @@ gst_stream_synchronizer_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_static_pad_template (gstelement_class, - &srctemplate); - gst_element_class_add_static_pad_template (gstelement_class, - &sinktemplate); + gst_element_class_add_static_pad_template (gstelement_class, &srctemplate); + gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate); gst_element_class_set_details_simple (gstelement_class, "Stream Synchronizer", "Generic", diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index 2828a8c610..8ca5184bf0 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -45,6 +45,8 @@ #include #include +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (subtitle_overlay_debug); #define GST_CAT_DEFAULT subtitle_overlay_debug @@ -1617,8 +1619,7 @@ gst_subtitle_overlay_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_static_pad_template (gstelement_class, - &srctemplate); + gst_element_class_add_static_pad_template (gstelement_class, &srctemplate); gst_element_class_add_static_pad_template (gstelement_class, &video_sinktemplate); diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index e0660b5e2e..2a5026f972 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -38,6 +38,8 @@ #include "gstplay-enum.h" #include "gstrawcaps.h" +#include "gst/glib-compat-private.h" + #define GST_TYPE_URI_DECODE_BIN \ (gst_uri_decode_bin_get_type()) #define GST_URI_DECODE_BIN(obj) \ @@ -213,8 +215,7 @@ gst_uri_decode_bin_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_static_pad_template (gstelement_class, - &srctemplate); + gst_element_class_add_static_pad_template (gstelement_class, &srctemplate); gst_element_class_set_details_simple (gstelement_class, "URI Decoder", "Generic/Bin/Decoder", "Autoplug and decode an URI to raw media", diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index 912c2738e2..a52dabdecb 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -2883,8 +2883,14 @@ gst_multi_fd_sink_start (GstBaseSink * bsink) } this->running = TRUE; + +#if !GLIB_CHECK_VERSION (2, 31, 0) this->thread = g_thread_create ((GThreadFunc) gst_multi_fd_sink_thread, this, TRUE, NULL); +#else + this->thread = g_thread_new ("multifdsink", + (GThreadFunc) gst_multi_fd_sink_thread, this); +#endif GST_OBJECT_FLAG_SET (this, GST_MULTI_FD_SINK_OPEN); diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 7e5cb1a7c3..2adcc735c0 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -113,6 +113,8 @@ /* Debugging category */ #include +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink); #define GST_CAT_DEFAULT gst_debug_ximagesink @@ -1171,8 +1173,13 @@ gst_ximagesink_manage_event_thread (GstXImageSink * ximagesink) 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) { diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index d0cc4a832c..8a7913b6ac 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -126,6 +126,9 @@ /* Debugging category */ #include + +#include "gst/glib-compat-private.h" + GST_DEBUG_CATEGORY_STATIC (gst_debug_xvimagesink); #define GST_CAT_DEFAULT gst_debug_xvimagesink GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); @@ -1685,8 +1688,13 @@ gst_xvimagesink_manage_event_thread (GstXvImageSink * xvimagesink) GST_DEBUG_OBJECT (xvimagesink, "run xevent thread, expose %d, events %d", xvimagesink->handle_expose, xvimagesink->handle_events); xvimagesink->running = TRUE; +#if !GLIB_CHECK_VERSION (2, 31, 0) xvimagesink->event_thread = g_thread_create ( (GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, TRUE, NULL); +#else + xvimagesink->event_thread = g_thread_try_new ("xvimagesink-events", + (GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, NULL); +#endif } } else { if (xvimagesink->event_thread) {