Use new GLib API unconditionally

This commit is contained in:
Tim-Philipp Müller 2012-01-22 23:15:19 +00:00
parent ba2ec3ff98
commit 7cb9b7ab9d
14 changed files with 2 additions and 120 deletions

View file

@ -500,13 +500,8 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
g_mutex_lock (&souphttpsink->mutex);
/* FIXME: error handling */
#if !GLIB_CHECK_VERSION (2, 31, 0)
souphttpsink->thread = g_thread_create (thread_func, souphttpsink,
TRUE, &error);
#else
souphttpsink->thread = g_thread_try_new ("souphttpclientsink-thread",
thread_func, souphttpsink, &error);
#endif
GST_LOG_OBJECT (souphttpsink, "waiting for main loop thread to start up");
g_cond_wait (&souphttpsink->cond, &souphttpsink->mutex);

View file

@ -27,43 +27,13 @@
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)
#if 0 //GLIB_CHECK_VERSION (2, 31, 0)
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)

View file

@ -146,18 +146,6 @@ static GstStaticCaps gst_alpha_alpha_caps =
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, ARGB, BGRA, ABGR, RGBA }"));
/* FIXME: why do we need our own lock for this? */
#if !GLIB_CHECK_VERSION (2, 31, 0)
#define GST_ALPHA_LOCK(alpha) G_STMT_START { \
GST_LOG_OBJECT (alpha, "Locking alpha from thread %p", g_thread_self ()); \
g_static_mutex_lock (&alpha->lock); \
GST_LOG_OBJECT (alpha, "Locked alpha from thread %p", g_thread_self ()); \
} G_STMT_END
#define GST_ALPHA_UNLOCK(alpha) G_STMT_START { \
GST_LOG_OBJECT (alpha, "Unlocking alpha from thread %p", g_thread_self ()); \
g_static_mutex_unlock (&alpha->lock); \
} G_STMT_END
#else
#define GST_ALPHA_LOCK(alpha) G_STMT_START { \
GST_LOG_OBJECT (alpha, "Locking alpha from thread %p", g_thread_self ()); \
g_mutex_lock (&alpha->lock); \
@ -168,7 +156,6 @@ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, ARGB, BGRA, ABGR, RGBA }"));
GST_LOG_OBJECT (alpha, "Unlocking alpha from thread %p", g_thread_self ()); \
g_mutex_unlock (&alpha->lock); \
} G_STMT_END
#endif
static GstCaps *gst_alpha_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
@ -310,11 +297,7 @@ gst_alpha_init (GstAlpha * alpha)
alpha->black_sensitivity = DEFAULT_BLACK_SENSITIVITY;
alpha->white_sensitivity = DEFAULT_WHITE_SENSITIVITY;
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_init (&alpha->lock);
#else
g_mutex_init (&alpha->lock);
#endif
}
static void
@ -322,11 +305,7 @@ gst_alpha_finalize (GObject * object)
{
GstAlpha *alpha = GST_ALPHA (object);
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_free (&alpha->lock);
#else
g_mutex_clear (&alpha->lock);
#endif
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View file

@ -69,11 +69,7 @@ struct _GstAlpha
/* <private> */
/* caps */
#if !GLIB_CHECK_VERSION (2, 31, 0)
GStaticMutex lock;
#else
GMutex lock;
#endif
gboolean in_sdtv, out_sdtv;

View file

@ -479,13 +479,8 @@ gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ,
if (templ->direction != GST_PAD_SINK)
goto not_sink_pad;
#if GLIB_CHECK_VERSION(2,29,5)
channels = g_atomic_int_add (&self->channels, 1);
padnumber = g_atomic_int_add (&self->padcounter, 1);
#else
channels = g_atomic_int_exchange_and_add (&self->channels, 1);
padnumber = g_atomic_int_exchange_and_add (&self->padcounter, 1);
#endif
pad_name = g_strdup_printf ("sink_%u", padnumber);
new_pad = GST_PAD_CAST (g_object_new (GST_TYPE_INTERLEAVE_PAD,

View file

@ -910,13 +910,8 @@ start_rtcp_thread (GstRtpSession * rtpsession)
g_thread_join (rtpsession->priv->thread);
/* only create a new thread if the old one was stopped. Otherwise we can
* just reuse the currently running one. */
#if !GLIB_CHECK_VERSION (2, 31, 0)
rtpsession->priv->thread =
g_thread_create ((GThreadFunc) rtcp_thread, rtpsession, TRUE, &error);
#else
rtpsession->priv->thread = g_thread_try_new ("rtpsession-rtcp-thread",
(GThreadFunc) rtcp_thread, rtpsession, &error);
#endif
rtpsession->priv->thread_stopped = FALSE;
}
GST_RTP_SESSION_UNLOCK (rtpsession);

View file

@ -542,13 +542,8 @@ gst_oss4_mixer_start_watch_task (GstOss4Mixer * mixer)
mixer->watch_cond = g_cond_new ();
mixer->watch_shutdown = FALSE;
#if !GLIB_CHECK_VERSION (2, 31, 0)
mixer->watch_thread = g_thread_create (gst_oss4_mixer_watch_thread,
gst_object_ref (mixer), TRUE, &err);
#else
mixer->watch_thread = g_thread_try_new ("oss4-mixer-thread",
gst_oss4_mixer_watch_thread, gst_object_ref (mixer), &err);
#endif
if (mixer->watch_thread == NULL) {
GST_ERROR_OBJECT (mixer, "Could not create watch thread: %s", err->message);

View file

@ -41,20 +41,6 @@ run_pipeline (GstElement * pipeline)
gst_element_set_state (pipeline, GST_STATE_NULL);
}
#if !GLIB_CHECK_VERSION(2,30,0)
static gchar *
g_mkdtemp (gchar * template)
{
gchar *tmpdir;
tmpdir = mkdtemp (template);
if (tmpdir == NULL) {
g_free (template);
}
return tmpdir;
}
#endif
GST_START_TEST (test_multifilesink_key_frame)
{
GstElement *pipeline;

View file

@ -447,11 +447,6 @@ souphttpsrc_suite (void)
g_type_init ();
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
s = suite_create ("souphttpsrc");
tc_chain = tcase_create ("general");
tc_internet = tcase_create ("internet");

View file

@ -179,11 +179,6 @@ main (int argc, char **argv)
GstPad *eq_sinkpad;
gchar *uri;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
/* command line option parsing */
ctx = g_option_context_new ("FILENAME");
g_option_context_add_group (ctx, gst_init_get_option_group ());

View file

@ -330,11 +330,6 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *opt_err = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
gtk_init (&argc, &argv);
/* command line option parsing */

View file

@ -233,11 +233,6 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());

View file

@ -491,14 +491,10 @@ main (int argc, char *argv[])
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
loop = g_main_loop_new (NULL, FALSE);
#if !GLIB_CHECK_VERSION (2, 31, 0)
input_thread = g_thread_create (read_user, source, TRUE, NULL);
#else
input_thread = g_thread_try_new ("v4l2src-test", read_user, source, NULL);
#endif
if (input_thread == NULL) {
fprintf (stderr, "error: g_thread_create return NULL");
fprintf (stderr, "error: g_thread_try_new() failed");
return -1;
}

View file

@ -193,11 +193,6 @@ main (int argc, char **argv)
GstCaps *filter_caps = NULL;
GList *caps_list, *l;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
/* command line option parsing */
ctx = g_option_context_new ("");
g_option_context_add_group (ctx, gst_init_get_option_group ());