summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/glib-compat-private.h65
-rw-r--r--gst/gstbus.c1
-rw-r--r--gst/gstclock.c1
-rw-r--r--gst/gstelement.c1
-rw-r--r--gst/gstobject.h19
-rw-r--r--gst/gsttask.c14
-rw-r--r--libs/gst/base/gstbaseparse.c45
-rw-r--r--libs/gst/base/gstbasesrc.c1
-rw-r--r--libs/gst/base/gstbasetransform.c1
-rw-r--r--libs/gst/base/gstcollectpads.c1
-rw-r--r--libs/gst/base/gstcollectpads2.c2
-rw-r--r--libs/gst/base/gstdataqueue.c1
-rw-r--r--libs/gst/check/gstcheck.h62
-rw-r--r--libs/gst/controller/gstcontroller.c1
-rw-r--r--libs/gst/controller/gstinterpolationcontrolsource.c1
-rw-r--r--libs/gst/controller/gstlfocontrolsource.c2
-rw-r--r--plugins/elements/gstinputselector.c2
-rw-r--r--plugins/elements/gstqueue.c1
-rw-r--r--plugins/elements/gstqueue2.c1
-rw-r--r--plugins/elements/gsttee.c1
20 files changed, 211 insertions, 12 deletions
diff --git a/gst/glib-compat-private.h b/gst/glib-compat-private.h
index 7b5d6cf860..d143d3257d 100644
--- a/gst/glib-compat-private.h
+++ b/gst/glib-compat-private.h
@@ -48,6 +48,71 @@ typedef struct stat GStatBuf;
/* 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
diff --git a/gst/gstbus.c b/gst/gstbus.c
index 42c66def54..b80420b9de 100644
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
@@ -77,6 +77,7 @@
#include "gstinfo.h"
#include "gstbus.h"
+#include "glib-compat-private.h"
#define GST_CAT_DEFAULT GST_CAT_BUS
/* bus signals */
diff --git a/gst/gstclock.c b/gst/gstclock.c
index 45f503e731..bd2eb8f23c 100644
--- a/gst/gstclock.c
+++ b/gst/gstclock.c
@@ -109,6 +109,7 @@
#include "gstclock.h"
#include "gstinfo.h"
#include "gstutils.h"
+#include "glib-compat-private.h"
#ifndef GST_DISABLE_TRACE
/* #define GST_WITH_ALLOC_TRACE */
diff --git a/gst/gstelement.c b/gst/gstelement.c
index afa25b9d37..6577428d70 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -95,6 +95,7 @@
#include "gstinfo.h"
#include "gstvalue.h"
#include "gst-i18n-lib.h"
+#include "glib-compat-private.h"
/* Element signals and args */
enum
diff --git a/gst/gstobject.h b/gst/gstobject.h
index b9c5206d4b..a522aeebb4 100644
--- a/gst/gstobject.h
+++ b/gst/gstobject.h
@@ -215,29 +215,48 @@ struct _GstObject {
*
* This macro will return the class lock used to protect deep_notify signal
* emission on thread-unsafe glib versions (glib < 2.8).
+ *
+ * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
*/
+#ifndef GST_DISABLE_DEPRECATED
#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
+#endif
+
/**
* GST_CLASS_LOCK:
* @obj: a #GstObjectClass
*
* Lock the class.
+ *
+ * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
*/
+#ifndef GST_DISABLE_DEPRECATED
#define GST_CLASS_LOCK(obj) (g_static_rec_mutex_lock(GST_CLASS_GET_LOCK(obj)))
+#endif
+
/**
* GST_CLASS_TRYLOCK:
* @obj: a #GstObjectClass
*
* Try to lock the class, returns TRUE if class could be locked.
+ *
+ * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
*/
+#ifndef GST_DISABLE_DEPRECATED
#define GST_CLASS_TRYLOCK(obj) (g_static_rec_mutex_trylock(GST_CLASS_GET_LOCK(obj)))
+#endif
+
/**
* GST_CLASS_UNLOCK:
* @obj: a #GstObjectClass
*
* Unlock the class.
+ *
+ * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
*/
+#ifndef GST_DISABLE_DEPRECATED
#define GST_CLASS_UNLOCK(obj) (g_static_rec_mutex_unlock(GST_CLASS_GET_LOCK(obj)))
+#endif
/**
* GstObjectClass:
diff --git a/gst/gsttask.c b/gst/gsttask.c
index e06e0d6917..c66c7b760c 100644
--- a/gst/gsttask.c
+++ b/gst/gsttask.c
@@ -72,6 +72,7 @@
#include "gstinfo.h"
#include "gsttask.h"
+#include "glib-compat-private.h"
#include <stdio.h>
@@ -276,8 +277,13 @@ gst_task_func (GstTask * task)
goto no_lock;
task->abidata.ABI.thread = tself;
/* only update the priority when it was changed */
- if (priv->prio_set)
+ if (priv->prio_set) {
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_set_priority (tself, priv->priority);
+#else
+ GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
+#endif
+ }
GST_OBJECT_UNLOCK (task);
/* fire the enter_thread callback when we need to */
@@ -333,7 +339,9 @@ exit:
} else {
/* restore normal priority when releasing back into the pool, we will not
* touch the priority when a custom callback has been installed. */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_set_priority (tself, G_THREAD_PRIORITY_NORMAL);
+#endif
}
/* now we allow messing with the lock again by setting the running flag to
* FALSE. Together with the SIGNAL this is the sign for the _join() to
@@ -475,7 +483,11 @@ gst_task_set_priority (GstTask * task, GThreadPriority priority)
if (thread != NULL) {
/* if this task already has a thread, we can configure the priority right
* away, else we do that when we assign a thread to the task. */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_set_priority (thread, priority);
+#else
+ GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
+#endif
}
GST_OBJECT_UNLOCK (task);
}
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index 308bb8a895..3cd4db5078 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -284,7 +284,11 @@ struct _GstBaseParsePrivate
GstIndex *index;
gint index_id;
gboolean own_index;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
GStaticMutex index_lock;
+#else
+ GMutex index_lock;
+#endif
/* seek table entries only maintained if upstream is BYTE seekable */
gboolean upstream_seekable;
@@ -333,6 +337,18 @@ typedef struct _GstBaseParseSeek
GstClockTime start_ts;
} GstBaseParseSeek;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+#define GST_BASE_PARSE_INDEX_LOCK(parse) \
+ g_static_mutex_lock (&parse->priv->index_lock);
+#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
+ g_static_mutex_unlock (&parse->priv->index_lock);
+#else
+#define GST_BASE_PARSE_INDEX_LOCK(parse) \
+ g_mutex_lock (&parse->priv->index_lock);
+#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
+ g_mutex_unlock (&parse->priv->index_lock);
+#endif
+
static GstElementClass *parent_class = NULL;
static void gst_base_parse_class_init (GstBaseParseClass * klass);
@@ -474,8 +490,11 @@ gst_base_parse_finalize (GObject * object)
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
}
-
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_free (&parse->priv->index_lock);
+#else
+ g_mutex_clear (&parse->priv->index_lock);
+#endif
gst_base_parse_clear_queues (parse);
@@ -560,7 +579,11 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
parse->priv->pad_mode = GST_ACTIVATE_NONE;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_init (&parse->priv->index_lock);
+#else
+ g_mutex_init (&parse->priv->index_lock);
+#endif
/* init state */
gst_base_parse_reset (parse);
@@ -1488,11 +1511,11 @@ gst_base_parse_add_index_entry (GstBaseParse * parse, guint64 offset,
associations[1].value = offset;
/* index might change on-the-fly, although that would be nutty app ... */
- g_static_mutex_lock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_LOCK (parse);
gst_index_add_associationv (parse->priv->index, parse->priv->index_id,
(key) ? GST_ASSOCIATION_FLAG_KEY_UNIT : GST_ASSOCIATION_FLAG_DELTA_UNIT,
2, (const GstIndexAssociation *) &associations);
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
if (key) {
parse->priv->index_last_offset = offset;
@@ -3632,7 +3655,7 @@ gst_base_parse_find_offset (GstBaseParse * parse, GstClockTime time,
goto exit;
}
- g_static_mutex_lock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index) {
/* Let's check if we have an index entry for that time */
entry = gst_index_get_assoc_entry (parse->priv->index,
@@ -3656,7 +3679,7 @@ gst_base_parse_find_offset (GstBaseParse * parse, GstClockTime time,
ts = GST_CLOCK_TIME_NONE;
}
}
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
exit:
if (_ts)
@@ -4007,7 +4030,7 @@ gst_base_parse_set_index (GstElement * element, GstIndex * index)
{
GstBaseParse *parse = GST_BASE_PARSE (element);
- g_static_mutex_lock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index)
gst_object_unref (parse->priv->index);
if (index) {
@@ -4018,7 +4041,7 @@ gst_base_parse_set_index (GstElement * element, GstIndex * index)
} else {
parse->priv->index = NULL;
}
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
}
static GstIndex *
@@ -4027,10 +4050,10 @@ gst_base_parse_get_index (GstElement * element)
GstBaseParse *parse = GST_BASE_PARSE (element);
GstIndex *result = NULL;
- g_static_mutex_lock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->index)
result = gst_object_ref (parse->priv->index);
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
return result;
}
@@ -4047,7 +4070,7 @@ gst_base_parse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* If this is our own index destroy it as the
* old entries might be wrong for the new stream */
- g_static_mutex_lock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_LOCK (parse);
if (parse->priv->own_index) {
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
@@ -4063,7 +4086,7 @@ gst_base_parse_change_state (GstElement * element, GstStateChange transition)
&parse->priv->index_id);
parse->priv->own_index = TRUE;
}
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
break;
default:
break;
diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c
index f0609a1953..cc9631ab21 100644
--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -166,6 +166,7 @@
#include <string.h>
#include <gst/gst_private.h>
+#include <gst/glib-compat-private.h>
#include "gstbasesrc.h"
#include "gsttypefindhelper.h"
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index fbed657884..6946ae97cb 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -207,6 +207,7 @@
#include "../../../gst/gst_private.h"
#include "../../../gst/gst-i18n-lib.h"
+#include "../../../gst/glib-compat-private.h"
#include "gstbasetransform.h"
#include <gst/gstmarshal.h>
diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c
index 004508d321..7fb0bf42bd 100644
--- a/libs/gst/base/gstcollectpads.c
+++ b/libs/gst/base/gstcollectpads.c
@@ -73,6 +73,7 @@
*/
#include "gstcollectpads.h"
+#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (collect_pads_debug);
#define GST_CAT_DEFAULT collect_pads_debug
diff --git a/libs/gst/base/gstcollectpads2.c b/libs/gst/base/gstcollectpads2.c
index f549bef410..fbd6150d0e 100644
--- a/libs/gst/base/gstcollectpads2.c
+++ b/libs/gst/base/gstcollectpads2.c
@@ -84,6 +84,8 @@
#include "gstcollectpads2.h"
+#include "../../../gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (collect_pads2_debug);
#define GST_CAT_DEFAULT collect_pads2_debug
diff --git a/libs/gst/base/gstdataqueue.c b/libs/gst/base/gstdataqueue.c
index f6b11177cb..2d325e3e41 100644
--- a/libs/gst/base/gstdataqueue.c
+++ b/libs/gst/base/gstdataqueue.c
@@ -33,6 +33,7 @@
#include <gst/gst.h>
#include "string.h"
#include "gstdataqueue.h"
+#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (data_queue_debug);
#define GST_CAT_DEFAULT (data_queue_debug)
diff --git a/libs/gst/check/gstcheck.h b/libs/gst/check/gstcheck.h
index e77c007bce..46bf6c5422 100644
--- a/libs/gst/check/gstcheck.h
+++ b/libs/gst/check/gstcheck.h
@@ -286,6 +286,68 @@ gst_g_thread_create (GThreadFunc func, gpointer data, gboolean joinable,
g_assert (joinable);
return g_thread_try_new ("gst-check", func, data, error);
}
+#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
#define MAIN_INIT() \
diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c
index f6e2cbf2e7..44480871ca 100644
--- a/libs/gst/controller/gstcontroller.c
+++ b/libs/gst/controller/gstcontroller.c
@@ -80,6 +80,7 @@
#include "gstcontrollerprivate.h"
#include "gstcontrolsource.h"
#include "gstinterpolationcontrolsource.h"
+#include "gst/glib-compat-private.h"
#define GST_CAT_DEFAULT controller_debug
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
diff --git a/libs/gst/controller/gstinterpolationcontrolsource.c b/libs/gst/controller/gstinterpolationcontrolsource.c
index f320d7d0fc..2bdefeb8c6 100644
--- a/libs/gst/controller/gstinterpolationcontrolsource.c
+++ b/libs/gst/controller/gstinterpolationcontrolsource.c
@@ -43,6 +43,7 @@
#include "gstcontrolsource.h"
#include "gstinterpolationcontrolsource.h"
#include "gstinterpolationcontrolsourceprivate.h"
+#include "gst/glib-compat-private.h"
#define GST_CAT_DEFAULT controller_debug
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
diff --git a/libs/gst/controller/gstlfocontrolsource.c b/libs/gst/controller/gstlfocontrolsource.c
index 06711b285f..61396875d6 100644
--- a/libs/gst/controller/gstlfocontrolsource.c
+++ b/libs/gst/controller/gstlfocontrolsource.c
@@ -43,6 +43,8 @@
#include "gstlfocontrolsource.h"
#include "gstlfocontrolsourceprivate.h"
+#include "gst/glib-compat-private.h"
+
#include <gst/math-compat.h>
#define EMPTY(x) (x)
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index c143cbfdbc..19030fb37e 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -59,6 +59,8 @@
#include "gstinputselector.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
#define GST_CAT_DEFAULT input_selector_debug
diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c
index e291abd5df..25829d8013 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -61,6 +61,7 @@
#include "gstqueue.h"
#include "../../gst/gst-i18n-lib.h"
+#include "../../gst/glib-compat-private.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 244023627f..8c4e4ccad4 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -63,6 +63,7 @@
#include <glib/gstdio.h>
#include "gst/gst-i18n-lib.h"
+#include "gst/glib-compat-private.h"
#include <string.h>
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c
index 6b9e7cc800..6b875a78a0 100644
--- a/plugins/elements/gsttee.c
+++ b/plugins/elements/gsttee.c
@@ -48,6 +48,7 @@
#endif
#include "gsttee.h"
+#include "gst/glib-compat-private.h"
#include <string.h>