summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a8b7951)
raw | patch | inline | side by side (parent: a8b7951)
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 4 Dec 2011 13:35:38 +0000 (13:35 +0000) | ||
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 4 Dec 2011 13:35:38 +0000 (13:35 +0000) |
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 can't change most of
these in 0.10 because they're part of our API and ABI.
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
20 files changed:
index 7b5d6cf860fb93f4c5e634a9a757599789dfae47..d143d3257dbc07467d6f8faf7225a05591fcae47 100644 (file)
/* 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 42c66def54520ce2e021c2b575aaac25a4ce50e0..b80420b9ded635f5de7670e79c5b29bda480e00c 100644 (file)
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
#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 45f503e731661711c791cc6ce8574699676dcd58..bd2eb8f23c5c3922be343273a3283826671c9c0e 100644 (file)
--- a/gst/gstclock.c
+++ b/gst/gstclock.c
#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 afa25b9d3717cbe247c5606cf9bbd57e73886cc7..6577428d70b1990a029fed09acdbf1460252ac9c 100644 (file)
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
#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 b9c5206d4b2f450816dfce8e3f007f4f1fd6cbaa..a522aeebb49c1263584b891502dd3cf2d10645a4 100644 (file)
--- a/gst/gstobject.h
+++ b/gst/gstobject.h
*
* 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 e06e0d69176eaf330dfe744ce32c99485841d887..c66c7b760c57db82acde38e0722b72e6002b0092 100644 (file)
--- a/gst/gsttask.c
+++ b/gst/gsttask.c
#include "gstinfo.h"
#include "gsttask.h"
+#include "glib-compat-private.h"
#include <stdio.h>
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 */
} 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
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);
}
index 308bb8a8955d8329abb3d409ede9efa6c29670c3..3cd4db50782315ce44d243600d0cf8d6f85d4e14 100644 (file)
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;
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);
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);
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);
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;
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,
ts = GST_CLOCK_TIME_NONE;
}
}
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
exit:
if (_ts)
{
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) {
} else {
parse->priv->index = NULL;
}
- g_static_mutex_unlock (&parse->priv->index_lock);
+ GST_BASE_PARSE_INDEX_UNLOCK (parse);
}
static GstIndex *
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;
}
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;
&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;
index f0609a19536f2daa8616612e321a5111fc441e04..cc9631ab21e0157ff31f89a76cf5a612f9be5d60 100644 (file)
#include <string.h>
#include <gst/gst_private.h>
+#include <gst/glib-compat-private.h>
#include "gstbasesrc.h"
#include "gsttypefindhelper.h"
index fbed6578849548be2bd2a8d093e9f45953a33295..6946ae97cb3eeb2ee81a34c65b038a837ea2b5dd 100644 (file)
#include "../../../gst/gst_private.h"
#include "../../../gst/gst-i18n-lib.h"
+#include "../../../gst/glib-compat-private.h"
#include "gstbasetransform.h"
#include <gst/gstmarshal.h>
index 004508d3216bee415d40764fa19e0d836f811462..7fb0bf42bd792dc8bd96cfa033d3975699fd15b7 100644 (file)
*/
#include "gstcollectpads.h"
+#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (collect_pads_debug);
#define GST_CAT_DEFAULT collect_pads_debug
index f549bef4107490faa6b4998cfddf73a7ab4e486b..fbd6150d0e36907bb5b2e154834969dca9a0dbd6 100644 (file)
#include "gstcollectpads2.h"
+#include "../../../gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (collect_pads2_debug);
#define GST_CAT_DEFAULT collect_pads2_debug
index f6b11177cb360903340875caee2fbfb43607c937..2d325e3e4141b4ba6f2fb6b80035dcd5dd044c1b 100644 (file)
#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)
index e77c007bce3783f370ff579e4aa31b4e23dfc7f6..46bf6c5422afa474243fdf0fe6ba36175fdb3bb8 100644 (file)
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() \
index f6e2cbf2e7785ae709829f21d57a1ae23c55e749..44480871cad255d77fd82824a9c38036ee1247ed 100644 (file)
#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 f320d7d0fc1422a228db78a65e4b1b6a82520101..2bdefeb8c672e7420056a3f08e9e2ed265d6f543 100644 (file)
#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);
index 06711b285f77347672a470db978960224bca0af6..61396875d627c3afbfd17d6dde42d2165250ef2c 100644 (file)
#include "gstlfocontrolsource.h"
#include "gstlfocontrolsourceprivate.h"
+#include "gst/glib-compat-private.h"
+
#include <gst/math-compat.h>
#define EMPTY(x) (x)
index c143cbfdbc40aef5b6bf2a8e8a6c688bb79dec4b..19030fb37e0f6e36b360ff57c1d94c8b1e65d4ac 100644 (file)
#include "gstinputselector.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
#define GST_CAT_DEFAULT input_selector_debug
index e291abd5df8939957ee6ffb4582cf1c0f1d2d4fd..25829d8013c707f2085ed34195866b3f439c6a02 100644 (file)
#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,
index 244023627fec85466547075a95af6864a94b672a..8c4e4ccad48d1348f425f07d7dc75846398fef69 100644 (file)
#include <glib/gstdio.h>
#include "gst/gst-i18n-lib.h"
+#include "gst/glib-compat-private.h"
#include <string.h>
index 6b9e7cc8009a5060906cc71a924e2e9ac9c0cf39..6b875a78a0830764362d8d368aef38c2ba97e2a8 100644 (file)
#endif
#include "gsttee.h"
+#include "gst/glib-compat-private.h"
#include <string.h>