mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
Use new GLib API unconditionally
This commit is contained in:
parent
ba2ec3ff98
commit
7cb9b7ab9d
14 changed files with 2 additions and 120 deletions
|
@ -500,13 +500,8 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
|
||||||
g_mutex_lock (&souphttpsink->mutex);
|
g_mutex_lock (&souphttpsink->mutex);
|
||||||
|
|
||||||
/* FIXME: error handling */
|
/* 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",
|
souphttpsink->thread = g_thread_try_new ("souphttpclientsink-thread",
|
||||||
thread_func, souphttpsink, &error);
|
thread_func, souphttpsink, &error);
|
||||||
#endif
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (souphttpsink, "waiting for main loop thread to start up");
|
GST_LOG_OBJECT (souphttpsink, "waiting for main loop thread to start up");
|
||||||
g_cond_wait (&souphttpsink->cond, &souphttpsink->mutex);
|
g_cond_wait (&souphttpsink->cond, &souphttpsink->mutex);
|
||||||
|
|
|
@ -27,43 +27,13 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
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)
|
#if GLIB_CHECK_VERSION(2,26,0)
|
||||||
#define GLIB_HAS_GDATETIME
|
#define GLIB_HAS_GDATETIME
|
||||||
#endif
|
#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 */
|
/* copies */
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 31, 0)
|
#if 0 //GLIB_CHECK_VERSION (2, 31, 0)
|
||||||
#define g_mutex_new gst_g_mutex_new
|
#define g_mutex_new gst_g_mutex_new
|
||||||
static inline GMutex *
|
static inline GMutex *
|
||||||
gst_g_mutex_new (void)
|
gst_g_mutex_new (void)
|
||||||
|
|
|
@ -146,18 +146,6 @@ static GstStaticCaps gst_alpha_alpha_caps =
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, ARGB, BGRA, ABGR, RGBA }"));
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, ARGB, BGRA, ABGR, RGBA }"));
|
||||||
|
|
||||||
/* FIXME: why do we need our own lock for this? */
|
/* 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 { \
|
#define GST_ALPHA_LOCK(alpha) G_STMT_START { \
|
||||||
GST_LOG_OBJECT (alpha, "Locking alpha from thread %p", g_thread_self ()); \
|
GST_LOG_OBJECT (alpha, "Locking alpha from thread %p", g_thread_self ()); \
|
||||||
g_mutex_lock (&alpha->lock); \
|
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 ()); \
|
GST_LOG_OBJECT (alpha, "Unlocking alpha from thread %p", g_thread_self ()); \
|
||||||
g_mutex_unlock (&alpha->lock); \
|
g_mutex_unlock (&alpha->lock); \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
#endif
|
|
||||||
|
|
||||||
static GstCaps *gst_alpha_transform_caps (GstBaseTransform * btrans,
|
static GstCaps *gst_alpha_transform_caps (GstBaseTransform * btrans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
||||||
|
@ -310,11 +297,7 @@ gst_alpha_init (GstAlpha * alpha)
|
||||||
alpha->black_sensitivity = DEFAULT_BLACK_SENSITIVITY;
|
alpha->black_sensitivity = DEFAULT_BLACK_SENSITIVITY;
|
||||||
alpha->white_sensitivity = DEFAULT_WHITE_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);
|
g_mutex_init (&alpha->lock);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -322,11 +305,7 @@ gst_alpha_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstAlpha *alpha = GST_ALPHA (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);
|
g_mutex_clear (&alpha->lock);
|
||||||
#endif
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,11 +69,7 @@ struct _GstAlpha
|
||||||
/* <private> */
|
/* <private> */
|
||||||
|
|
||||||
/* caps */
|
/* caps */
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
GStaticMutex lock;
|
|
||||||
#else
|
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
#endif
|
|
||||||
|
|
||||||
gboolean in_sdtv, out_sdtv;
|
gboolean in_sdtv, out_sdtv;
|
||||||
|
|
||||||
|
|
|
@ -479,13 +479,8 @@ gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||||
if (templ->direction != GST_PAD_SINK)
|
if (templ->direction != GST_PAD_SINK)
|
||||||
goto not_sink_pad;
|
goto not_sink_pad;
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION(2,29,5)
|
|
||||||
channels = g_atomic_int_add (&self->channels, 1);
|
channels = g_atomic_int_add (&self->channels, 1);
|
||||||
padnumber = g_atomic_int_add (&self->padcounter, 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);
|
pad_name = g_strdup_printf ("sink_%u", padnumber);
|
||||||
new_pad = GST_PAD_CAST (g_object_new (GST_TYPE_INTERLEAVE_PAD,
|
new_pad = GST_PAD_CAST (g_object_new (GST_TYPE_INTERLEAVE_PAD,
|
||||||
|
|
|
@ -910,13 +910,8 @@ start_rtcp_thread (GstRtpSession * rtpsession)
|
||||||
g_thread_join (rtpsession->priv->thread);
|
g_thread_join (rtpsession->priv->thread);
|
||||||
/* only create a new thread if the old one was stopped. Otherwise we can
|
/* only create a new thread if the old one was stopped. Otherwise we can
|
||||||
* just reuse the currently running one. */
|
* 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",
|
rtpsession->priv->thread = g_thread_try_new ("rtpsession-rtcp-thread",
|
||||||
(GThreadFunc) rtcp_thread, rtpsession, &error);
|
(GThreadFunc) rtcp_thread, rtpsession, &error);
|
||||||
#endif
|
|
||||||
rtpsession->priv->thread_stopped = FALSE;
|
rtpsession->priv->thread_stopped = FALSE;
|
||||||
}
|
}
|
||||||
GST_RTP_SESSION_UNLOCK (rtpsession);
|
GST_RTP_SESSION_UNLOCK (rtpsession);
|
||||||
|
|
|
@ -542,13 +542,8 @@ gst_oss4_mixer_start_watch_task (GstOss4Mixer * mixer)
|
||||||
mixer->watch_cond = g_cond_new ();
|
mixer->watch_cond = g_cond_new ();
|
||||||
mixer->watch_shutdown = FALSE;
|
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",
|
mixer->watch_thread = g_thread_try_new ("oss4-mixer-thread",
|
||||||
gst_oss4_mixer_watch_thread, gst_object_ref (mixer), &err);
|
gst_oss4_mixer_watch_thread, gst_object_ref (mixer), &err);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mixer->watch_thread == NULL) {
|
if (mixer->watch_thread == NULL) {
|
||||||
GST_ERROR_OBJECT (mixer, "Could not create watch thread: %s", err->message);
|
GST_ERROR_OBJECT (mixer, "Could not create watch thread: %s", err->message);
|
||||||
|
|
|
@ -41,20 +41,6 @@ run_pipeline (GstElement * pipeline)
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
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)
|
GST_START_TEST (test_multifilesink_key_frame)
|
||||||
{
|
{
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
|
|
|
@ -447,11 +447,6 @@ souphttpsrc_suite (void)
|
||||||
|
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s = suite_create ("souphttpsrc");
|
s = suite_create ("souphttpsrc");
|
||||||
tc_chain = tcase_create ("general");
|
tc_chain = tcase_create ("general");
|
||||||
tc_internet = tcase_create ("internet");
|
tc_internet = tcase_create ("internet");
|
||||||
|
|
|
@ -179,11 +179,6 @@ main (int argc, char **argv)
|
||||||
GstPad *eq_sinkpad;
|
GstPad *eq_sinkpad;
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* command line option parsing */
|
/* command line option parsing */
|
||||||
ctx = g_option_context_new ("FILENAME");
|
ctx = g_option_context_new ("FILENAME");
|
||||||
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
||||||
|
|
|
@ -330,11 +330,6 @@ main (int argc, char **argv)
|
||||||
GOptionContext *ctx;
|
GOptionContext *ctx;
|
||||||
GError *opt_err = NULL;
|
GError *opt_err = NULL;
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
/* command line option parsing */
|
/* command line option parsing */
|
||||||
|
|
|
@ -233,11 +233,6 @@ main (int argc, char **argv)
|
||||||
GOptionContext *ctx;
|
GOptionContext *ctx;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ctx = g_option_context_new ("");
|
ctx = g_option_context_new ("");
|
||||||
g_option_context_add_main_entries (ctx, options, NULL);
|
g_option_context_add_main_entries (ctx, options, NULL);
|
||||||
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
||||||
|
|
|
@ -491,14 +491,10 @@ main (int argc, char *argv[])
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
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);
|
input_thread = g_thread_try_new ("v4l2src-test", read_user, source, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (input_thread == NULL) {
|
if (input_thread == NULL) {
|
||||||
fprintf (stderr, "error: g_thread_create return NULL");
|
fprintf (stderr, "error: g_thread_try_new() failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,11 +193,6 @@ main (int argc, char **argv)
|
||||||
GstCaps *filter_caps = NULL;
|
GstCaps *filter_caps = NULL;
|
||||||
GList *caps_list, *l;
|
GList *caps_list, *l;
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 31, 0)
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* command line option parsing */
|
/* command line option parsing */
|
||||||
ctx = g_option_context_new ("");
|
ctx = g_option_context_new ("");
|
||||||
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
||||||
|
|
Loading…
Reference in a new issue